Official agent skill

Azure AI Contentsafety TS

by microsoft in microsoft/skills

Analyze text and images for harmful content using Azure AI Content Safety (@azure-rest/ai-content-safety).

OfficialMITAuto-check passedDevOps & Cloud

Install Azure AI Contentsafety TS

skills CLI
$ npx skills add microsoft/skills --skill azure-ai-contentsafety-ts -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/skills azure-ai-contentsafety-ts --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.github/plugins/azure-sdk-typescript/skills/azure-ai-contentsafety-ts .claude/skills/azure-ai-contentsafety-ts && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
azure-ai-contentsafety-ts
GitHub stars
3.1k
Token cost
~2.1k tokens
SKILL.md length
233 words
Files
1
Skills in repo
150
Repo updated
First seen
Licence
MIT

At a glance

Analyze text and images for harmful content using Azure AI Content Safety (@azure-rest/ai-content-safety).

  • Works in 5 steps: Always use isUnexpected() - Type guard… → Set appropriate thresholds - Different… → Use blocklists for domain-specific terms… → …
  • Moderating user-generated content
  • SKILL.md covers Installation, Environment Variables, Authentication and Analyze Text, plus 8 more sections
  • Calls npm; reaches learn.microsoft.com and storage.blob.core.windows.net; needs AZURE_TOKEN_CREDENTIALS and CONTENT_SAFETY_KEY

What it does

Azure AI Contentsafety TS is an agent skill from microsoft/skills, published by the product's own GitHub organization. Analyze text and images for harmful content using Azure AI Content Safety (@azure-rest/ai-content-safety). Use when moderating user-generated content, detecting hate speech, violence, sexual content, or self-harm, or managing custom blocklists.

Its SKILL.md is about 2.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in DevOps & Cloud. It works with Microsoft Azure, Azure AI Content Safety and TypeScript. The repository describes itself as: Skills, MCP servers, Custom Agents, Agents.md for SDKs to ground Coding Agents. The licence is MIT.

When your agent uses it

  • Moderating user-generated content
  • Detecting hate speech
  • Managing custom blocklists

Example prompts

  • “/azure-ai-contentsafety-ts”

Requirements

  • Node.js
  • A credential in CONTENT_SAFETY_KEY

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Always use isUnexpected() - Type guard for error handling
  2. Set appropriate thresholds - Different categories may need different severity thresholds
  3. Use blocklists for domain-specific terms - Supplement AI detection with custom rules
  4. Log moderation decisions - Keep audit trail for compliance
  5. Handle edge cases - Empty text, very long text, unsupported image formats

What it can do on your machine

Read from SKILL.md and the folder at commit d5741a1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • npm

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • learn.microsoft.com
    • storage.blob.core.windows.net

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • AZURE_TOKEN_CREDENTIALS
    • CONTENT_SAFETY_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Azure AI Contentsafety TS loads about 2.1k tokens when it runs. Until then it costs about 68 tokens; SKILL.md has 233 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~68
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microsoft/skills at commit d5741a1, republished under its MIT licence (© microsoft). 233 words, ~2,076 tokens.

Download SKILL.mdSave it as .claude/skills/azure-ai-contentsafety-ts/SKILL.md (or your agent's skills folder).
name
azure-ai-contentsafety-ts
description
Analyze text and images for harmful content using Azure AI Content Safety (@azure-rest/ai-content-safety). Use when moderating user-generated content, detecting hate speech, violence, sexual content, or self-harm, or managing custom blocklists.
license
MIT
metadata.author
Microsoft
metadata.version
1.0.0
metadata.package
@azure-rest/ai-content-safety

Azure AI Content Safety REST SDK for TypeScript

Analyze text and images for harmful content with customizable blocklists.

Installation

bash
npm install @azure-rest/ai-content-safety @azure/identity @azure/core-auth

Environment Variables

bash
CONTENT_SAFETY_ENDPOINT=https://<resource>.cognitiveservices.azure.com
CONTENT_SAFETY_KEY=<api-key>
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production

Authentication

Important: This is a REST client. ContentSafetyClient is a function, not a class.

API Key
typescript
import ContentSafetyClient from "@azure-rest/ai-content-safety";
import { AzureKeyCredential } from "@azure/core-auth";

const client = ContentSafetyClient(
  process.env.CONTENT_SAFETY_ENDPOINT!,
  new AzureKeyCredential(process.env.CONTENT_SAFETY_KEY!)
);
DefaultAzureCredential
typescript
import ContentSafetyClient from "@azure-rest/ai-content-safety";
import { DefaultAzureCredential, ManagedIdentityCredential } from "@azure/identity";

// Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
const credential = new DefaultAzureCredential({requiredEnvVars: ["AZURE_TOKEN_CREDENTIALS"]});
// Or use a specific credential directly in production:
// See https://learn.microsoft.com/javascript/api/overview/azure/identity-readme?view=azure-node-latest#credential-classes
// const credential = new ManagedIdentityCredential();

const client = ContentSafetyClient(
  process.env.CONTENT_SAFETY_ENDPOINT!,
  credential
);

Analyze Text

typescript
import ContentSafetyClient, { isUnexpected } from "@azure-rest/ai-content-safety";

const result = await client.path("/text:analyze").post({
  body: {
    text: "Text content to analyze",
    categories: ["Hate", "Sexual", "Violence", "SelfHarm"],
    outputType: "FourSeverityLevels"  // or "EightSeverityLevels"
  }
});

if (isUnexpected(result)) {
  throw result.body;
}

for (const analysis of result.body.categoriesAnalysis) {
  console.log(`${analysis.category}: severity ${analysis.severity}`);
}

Analyze Image

Base64 Content
typescript
import { readFileSync } from "node:fs";

const imageBuffer = readFileSync("./image.png");
const base64Image = imageBuffer.toString("base64");

const result = await client.path("/image:analyze").post({
  body: {
    image: { content: base64Image }
  }
});

if (isUnexpected(result)) {
  throw result.body;
}

for (const analysis of result.body.categoriesAnalysis) {
  console.log(`${analysis.category}: severity ${analysis.severity}`);
}
Blob URL
typescript
const result = await client.path("/image:analyze").post({
  body: {
    image: { blobUrl: "https://storage.blob.core.windows.net/container/image.png" }
  }
});

Blocklist Management

Create Blocklist
typescript
const result = await client
  .path("/text/blocklists/{blocklistName}", "my-blocklist")
  .patch({
    contentType: "application/merge-patch+json",
    body: {
      description: "Custom blocklist for prohibited terms"
    }
  });

if (isUnexpected(result)) {
  throw result.body;
}

console.log(`Created: ${result.body.blocklistName}`);
Add Items to Blocklist
typescript
const result = await client
  .path("/text/blocklists/{blocklistName}:addOrUpdateBlocklistItems", "my-blocklist")
  .post({
    body: {
      blocklistItems: [
        { text: "prohibited-term-1", description: "First blocked term" },
        { text: "prohibited-term-2", description: "Second blocked term" }
      ]
    }
  });

if (isUnexpected(result)) {
  throw result.body;
}

for (const item of result.body.blocklistItems ?? []) {
  console.log(`Added: ${item.blocklistItemId}`);
}
Analyze with Blocklist
typescript
const result = await client.path("/text:analyze").post({
  body: {
    text: "Text that might contain blocked terms",
    blocklistNames: ["my-blocklist"],
    haltOnBlocklistHit: false
  }
});

if (isUnexpected(result)) {
  throw result.body;
}

// Check blocklist matches
if (result.body.blocklistsMatch) {
  for (const match of result.body.blocklistsMatch) {
    console.log(`Blocked: "${match.blocklistItemText}" from ${match.blocklistName}`);
  }
}
List Blocklists
typescript
const result = await client.path("/text/blocklists").get();

if (isUnexpected(result)) {
  throw result.body;
}

for (const blocklist of result.body.value ?? []) {
  console.log(`${blocklist.blocklistName}: ${blocklist.description}`);
}
Delete Blocklist
typescript
await client.path("/text/blocklists/{blocklistName}", "my-blocklist").delete();

Harm Categories

CategoryAPI TermDescription
Hate and FairnessHateDiscriminatory language targeting identity groups
SexualSexualSexual content, nudity, pornography
ViolenceViolencePhysical harm, weapons, terrorism
Self-HarmSelfHarmSelf-injury, suicide, eating disorders

Severity Levels

LevelRiskRecommended Action
0SafeAllow
2LowReview or allow with warning
4MediumBlock or require human review
6HighBlock immediately

Output Types:

  • FourSeverityLevels (default): Returns 0, 2, 4, 6
  • EightSeverityLevels: Returns 0-7

Content Moderation Helper

typescript
import ContentSafetyClient, { 
  isUnexpected, 
  TextCategoriesAnalysisOutput 
} from "@azure-rest/ai-content-safety";

interface ModerationResult {
  isAllowed: boolean;
  flaggedCategories: string[];
  maxSeverity: number;
  blocklistMatches: string[];
}

async function moderateContent(
  client: ReturnType<typeof ContentSafetyClient>,
  text: string,
  maxAllowedSeverity = 2,
  blocklistNames: string[] = []
): Promise<ModerationResult> {
  const result = await client.path("/text:analyze").post({
    body: { text, blocklistNames, haltOnBlocklistHit: false }
  });

  if (isUnexpected(result)) {
    throw result.body;
  }

  const flaggedCategories = result.body.categoriesAnalysis
    .filter(c => (c.severity ?? 0) > maxAllowedSeverity)
    .map(c => c.category!);

  const maxSeverity = Math.max(
    ...result.body.categoriesAnalysis.map(c => c.severity ?? 0)
  );

  const blocklistMatches = (result.body.blocklistsMatch ?? [])
    .map(m => m.blocklistItemText!);

  return {
    isAllowed: flaggedCategories.length === 0 && blocklistMatches.length === 0,
    flaggedCategories,
    maxSeverity,
    blocklistMatches
  };
}

API Endpoints

OperationMethodPath
Analyze TextPOST/text:analyze
Analyze ImagePOST/image:analyze
Create/Update BlocklistPATCH/text/blocklists/{blocklistName}
List BlocklistsGET/text/blocklists
Delete BlocklistDELETE/text/blocklists/{blocklistName}
Add Blocklist ItemsPOST/text/blocklists/{blocklistName}:addOrUpdateBlocklistItems
List Blocklist ItemsGET/text/blocklists/{blocklistName}/blocklistItems
Remove Blocklist ItemsPOST/text/blocklists/{blocklistName}:removeBlocklistItems

Key Types

typescript
import ContentSafetyClient, {
  isUnexpected,
  AnalyzeTextParameters,
  AnalyzeImageParameters,
  TextCategoriesAnalysisOutput,
  ImageCategoriesAnalysisOutput,
  TextBlocklist,
  TextBlocklistItem
} from "@azure-rest/ai-content-safety";

Best Practices

  1. Always use isUnexpected() - Type guard for error handling
  2. Set appropriate thresholds - Different categories may need different severity thresholds
  3. Use blocklists for domain-specific terms - Supplement AI detection with custom rules
  4. Log moderation decisions - Keep audit trail for compliance
  5. Handle edge cases - Empty text, very long text, unsupported image formats

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .github/plugins/azure-sdk-typescript/skills/azure-ai-contentsafety-ts of microsoft/skills.

Open the folder on GitHubat commit d5741a1

Compare with similar skills

Azure AI Contentsafety TS next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Azure AI Contentsafety TS compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Azure AI Contentsafety TS this skillmicrosoft/skills3.1k—~2.1kAutomated safety check: PassMIT
Aspire DeploymentCommunityToolkit/Aspire627—~4.5kAutomated safety check: NotesMIT
Azure Content SafetyMicrosoftDocs/Agent-Skills776—~1.8kAutomated safety check: PassCC-BY-4.0
Cloud Cost Optimizationwshobson/agents40k14 repos~1.7kAutomated safety check: PassMIT
AWS Cdk Developmentzxkane/aws-skills3672 repos~2.5kAutomated safety check: PassMIT
Terravision Cloud Diagramspatrickchugh/terravision1.6k—~5.6kAutomated safety check: NotesAGPL-3.0-only

Similar skills

  • Aspire Deployment

    CommunityToolkit/Aspire

    WORKFLOW SKILL — Deploy Aspire apps from AppHost models to Docker Compose, Kubernetes, Azure, AWS, or preview Radius.

    627 GitHub stars~4.5k tokensUpdated 2 days ago
    DevOps & CloudAuto-check: notes
  • Azure Content Safety

    MicrosoftDocs/Agent-Skills

    Official

    Expert knowledge for Content Safety in Foundry Control Plane development including troubleshooting, best practices, decision making, architecture & design patterns, limits & quotas, security…

    776 GitHub stars~1.8k tokensUpdated 5 days ago
    DevelopmentAuto-check passed
  • Cuts cloud spend across AWS, Azure, GCP and OCI with cost tagging, rightsizing, commitment and spot pricing models, and architecture changes.

    40k GitHub starsUsed in 14 repos~1.7k tokens
    DevOps & CloudAuto-check passed
  • AWS Cdk Development

    zxkane/aws-skills

    AWS Cloud Development Kit (CDK) expert for building cloud infrastructure with TypeScript/Python.

    367 GitHub starsUsed in 2 repos~2.5k tokens
    DevOps & CloudAuto-check passed
  • Terravision Cloud Diagrams

    patrickchugh/terravision

    Draw cloud architecture diagrams for AWS, Azure or GCP with the official provider icon sets, using TerraVision.

    1.6k GitHub stars~5.6k tokensUpdated 4 days ago
    DevOps & CloudAuto-check: notes
  • Thesvg

    glincker/thesvg

    Fetch brand SVG logos and cloud architecture icons (AWS, Azure, GCP) from theSVG.

    2.8k GitHub stars~1.5k tokensUpdated today
    DevOps & CloudAuto-check passed

More from microsoft/skills

All 150 skills in this repo
  • Official

    Covers producer, consumer, and checkpoint-store setup for Azure Event Hubs streaming in Python, with Entra ID auth and partition targeting.

    3.1k GitHub starsUsed in 1 repo~2.3k tokens
    Auto-check passed
  • Official

    Builds podcast-style audio narration from text with Azure OpenAI's GPT Realtime Mini over WebSocket, from a Python FastAPI backend to a React player.

    3.1k GitHub starsUsed in 1 repo~947 tokens
    Auto-check passed
  • Frontend UI Dark TS

    microsoft/skills

    Official

    Build dark-themed React applications using Tailwind CSS with custom theming, glassmorphism effects, and Framer Motion animations.

    3.1k GitHub starsUsed in 5 repos~3.6k tokens
    Auto-check passed
  • Pydantic Models Py

    microsoft/skills

    Official

    Create Pydantic models following the multi-model pattern with Base, Create, Update, Response, and InDB variants.

    3.1k GitHub starsUsed in 5 repos~496 tokens
    Auto-check passed
  • Official

    Reference for building on Microsoft Foundry with the azure-ai-projects Python SDK: project clients, versioned agents, evaluations, connections, datasets and indexes.

    3.1k GitHub stars~2.8k tokensUpdated yesterday
    Auto-check passed
  • Skill Creator

    microsoft/skills

    Official

    Guide for creating effective skills for AI coding agents working with Azure SDKs and Microsoft Foundry services.

    3.1k GitHub starsUsed in 5 repos~17k tokens
    Auto-check passed

Categories

Questions about Azure AI Contentsafety TS

What does Azure AI Contentsafety TS do?

Analyze text and images for harmful content using Azure AI Content Safety (@azure-rest/ai-content-safety). Azure AI Contentsafety TS is an agent skill from microsoft/skills, published by the product's own GitHub organization. Analyze text and images for harmful content using Azure AI Content Safety (@azure-rest/ai-content-safety).

When should I use Azure AI Contentsafety TS?

Azure AI Contentsafety TS fits situations like: moderating user-generated content; detecting hate speech; managing custom blocklists.

How do I install Azure AI Contentsafety TS in Claude Code?

Run `npx skills add microsoft/skills --skill azure-ai-contentsafety-ts -a claude-code`. Or copy the skill folder (.github/plugins/azure-sdk-typescript/skills/azure-ai-contentsafety-ts in microsoft/skills) into .claude/skills/azure-ai-contentsafety-ts in your project. Claude Code loads it when a task matches its description.

How do I install Azure AI Contentsafety TS in Codex?

Run `npx skills add microsoft/skills --skill azure-ai-contentsafety-ts -a codex`. Or copy the skill folder (.github/plugins/azure-sdk-typescript/skills/azure-ai-contentsafety-ts in microsoft/skills) into .agents/skills/azure-ai-contentsafety-ts in your project. Codex loads it when a task matches its description.

Can I use Azure AI Contentsafety TS in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/skills --skill azure-ai-contentsafety-ts -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/azure-ai-contentsafety-ts, .gemini/skills/azure-ai-contentsafety-ts, .github/skills/azure-ai-contentsafety-ts and .opencode/skills/azure-ai-contentsafety-ts in your project.

What does Azure AI Contentsafety TS need to run?

Going by SKILL.md and its folder, Azure AI Contentsafety TS needs the command-line tools its instructions call (npm) and credentials named AZURE_TOKEN_CREDENTIALS and CONTENT_SAFETY_KEY. Our summary lists: Node.js; A credential in CONTENT_SAFETY_KEY.

Does Azure AI Contentsafety TS access the network?

SKILL.md names 2 domains. In commands or code: learn.microsoft.com and storage.blob.core.windows.net; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Azure AI Contentsafety TS safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Azure AI Contentsafety TS use?

Azure AI Contentsafety TS is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Azure AI Contentsafety TS use?

About 2.1k tokens (SKILL.md is roughly 8.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Azure AI Contentsafety TS?

Skills that share tags, products or a category with Azure AI Contentsafety TS: Aspire Deployment (CommunityToolkit/Aspire, 627 stars), Azure Content Safety (MicrosoftDocs/Agent-Skills, 776 stars), Cloud Cost Optimization (wshobson/agents, 40k stars) and AWS Cdk Development (zxkane/aws-skills, 367 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Azure AI Contentsafety TS?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/skills, which has 3,097 GitHub stars. The repository holds 150 skills in this directory. The repository was last updated on October 9, 2026.

Source: microsoft/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.