content-safety-implementationlisted
Install: claude install-skill fabioc-aloha/Alex_Skill_Mall
# Content Safety Implementation
Implementation patterns for Azure Content Safety API integration, multi-layer defense pipelines, and operational safety controls for AI-facing applications.
> **Last validated**: April 2026 (Prompt Shields GA, Groundedness Detection, Custom Categories)
---
## Azure Content Safety API
```typescript
import ContentSafetyClient from '@azure-rest/ai-content-safety';
interface ContentSafetyConfig {
endpoint: string; // from Key Vault
apiKey: string; // from Key Vault
thresholds: {
hate: 'low' | 'medium' | 'high';
sexual: 'low' | 'medium' | 'high';
selfHarm: 'low' | 'medium' | 'high';
violence: 'low' | 'medium' | 'high';
};
}
```
### Threshold Selection Guide
| Category | Low (strict) | Medium | High (permissive) |
|----------|-------------|--------|-------------------|
| **Hate** | Consumer apps, children | General audiences | Historical fiction, education |
| **Sexual** | Most applications | Dating/health apps | Medical/clinical |
| **Self-Harm** | Default — always strict | Crisis support apps | Clinical research |
| **Violence** | Most applications | News, crime fiction | Medical, forensic |
### Usage Pattern
```typescript
async function analyzeContent(text: string, config: ContentSafetyConfig): Promise<SafetyResult> {
const client = ContentSafetyClient(config.endpoint, { key: config.apiKey });
const result = await client.path('/text:analyze').post({
body: { text, categories: ['Hate', 'Sexual