Azure AI Content Safety for TypeScript
Add text and image harm detection with customizable blocklists to TypeScript applications.
The skill exposes the API key, credential, endpoint, base64 image content, and Blob URL data flows, and its operations are generally scoped to content analysis and blocklists. However, it provides no user-confirmation requirement for creating, modifying, or deleting blocklists, and does not explain sensitive-content privacy, retention, log redaction, access isolation, or recovery. MIT licensing and Microsoft provenance provide limited attribution evidence but do not replace safety controls.
The examples are mostly internally consistent, correctly identifying ContentSafetyClient as a function and repeatedly using isUnexpected(). However, there are no skill-specific tests, compatibility verification, retry/timeout guidance, input constraints, or diagnostic failure messages; the delete example also omits error checking. Because static review caps this dimension at10, the score remains conservative.
The audience, input types, and main operations are reasonably clear, covering text, images, harm categories, and blocklists. Boundaries are incomplete: non-fit cases, regional/network prerequisites, Chinese-language handling, and mainland-China reachability are not stated, and semantic trigger conditions are not precise enough.
The document includes installation, environment variables, authentication, operation examples, types, endpoints, severity levels, and best practices, with MIT, author, and 1.0.0 metadata. It lacks a changelog, explicit maintenance owner and update path, troubleshooting, pinned SDK compatibility guidance, privacy limitations, and FAQs; progressive disclosure is also limited.
The examples cover the core analysis and blocklist tasks, and the moderation helper returns a directly usable structured result. However, executability is not verified, and empty text, oversized input, unsupported image formats, network failures, empty analysis results, and policy differences are not fully handled. The static-review cap is7, so the score is intentionally limited.
The skill supplies auditable code, endpoint mappings, type names, and version metadata; the repository also shows generic CI and test infrastructure. There are no skill-specific tests, real execution results, or independent third-party corroboration, and the generic harness files do not establish coverage of this skill's key paths. Because static review caps this dimension at5, no higher score is warranted.
- Do not place CONTENT_SAFETY_KEY in source code, logs, or prompts; prefer managed identity with least-privilege access.
- Add human confirmation, auditing, and recoverable backups before creating, updating, or deleting production blocklists.
- Treat user text and images as sensitive data and document Azure region, cross-border transfer, retention, redaction, and access controls.
- Add real CI/integration tests before adoption to verify SDK compatibility, severity thresholds, empty input, oversized text, image formats, and network failures.
- Confirm actual reachability of the target Azure service endpoint for the intended user regions, including mainland-China network conditions.
What it does & when to use it
This skill teaches coding agents how to use the Azure AI Content Safety REST SDK for TypeScript. It covers text and image analysis for hate, sexual, violence, and self-harm categories, with configurable severity output. It also documents creating, updating, listing, and deleting custom text blocklists. It fits TypeScript applications that need moderation guidance for user-generated content.
Installs and configures @azure-rest/ai-content-safety, @azure/identity, and @azure/core-auth; creates the ContentSafetyClient function with an API key or DefaultAzureCredential; calls /text:analyze for text and /image:analyze for Base64 image content or a Blob URL; manages text blocklists and their items; checks category severity and blocklist matches; and uses isUnexpected() for error handling.
- A TypeScript community application developer needs to screen user comments for hate, sexual, violent, or self-harm content.
- A content-platform engineer needs to analyze uploaded images and choose allow, warn, or block actions from severity results.
- An enterprise application developer needs custom blocklists for domain-specific prohibited terms.
- An engineering team supporting compliance needs to record moderation decisions, category severity, and blocklist matches.
Pros & cons
- Covers both text and image moderation.
- Documents API-key and DefaultAzureCredential authentication.
- Includes core create, update, list, and delete blocklist examples.
- Provides guidance on severity thresholds, error handling, and moderation logging.
- Requires an Azure Content Safety endpoint, credentials, and network access.
- Targets the TypeScript REST SDK and does not provide implementations for other languages.
- The source does not document pricing, quotas, regional availability, or a complete test suite.
- The image example reads a local file, so that implementation requires filesystem access.
How to install
Run npx skills add microsoft/skills and select this skill in the installation wizard. To use the SDK, run npm install @azure-rest/ai-content-safety @azure/identity @azure/core-auth. Set CONTENT_SAFETY_ENDPOINT and CONTENT_SAFETY_KEY; when using DefaultAzureCredential in production, also set AZURE_TOKEN_CREDENTIALS=prod or a specific credential value.
How to use
Give the coding agent a request such as: Use azure-ai-contentsafety-ts to add text moderation for my TypeScript comment pipeline, including severity thresholds, a custom blocklist, and isUnexpected() error handling. The agent should follow the documented REST SDK patterns and handle category analysis and blocklist matches.