AI-Gateway: Skill for Claude Code

.github/skills/apim-policies/SKILL.md

apim-policies is a skill for Claude Code, Codex from Azure-Samples/AI-Gateway. It costs 74 tokens per session (1,731 once invoked), scanned A, original, MIT.

A guide to writing XML policies for Azure API Management, Microsoft’s service for publishing and controlling APIs. It covers request and response handling, authentication, rate limits, caching, transformations, AI gateway rules, and policy expressions.

In plain words
What is it for?
Use it when creating or changing APIM policies for authentication, traffic limits, caching, transformations, or AI gateway behavior.
Why use it?
It helps you write or understand the rules that control how API requests and responses are processed, without having to work out the policy structure and syntax yourself.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

This is Azure-Samples/AI-Gateway's own configuration. It tells Claude Code and Codex how to work on AI-Gateway itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything AI-Gateway configures →

Reuse

Borrowing it

Nothing to install: this file belongs to Azure-Samples/AI-Gateway. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/Azure-Samples/AI-Gateway/main/.github/skills/apim-policies/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/Azure-Samples/AI-Gateway

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for apim-policies

README.md
[![agentmods](https://agentmods.dev/badge/skills/azure-samples/ai-gateway/apim-policies/github.svg)](https://agentmods.dev/skills/azure-samples/ai-gateway/apim-policies)
Your own site
<a href="https://agentmods.dev/skills/azure-samples/ai-gateway/apim-policies"><img src="https://agentmods.dev/badge/skills/azure-samples/ai-gateway/apim-policies/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for apim-policies

Your own site · 80×15
<a href="https://agentmods.dev/skills/azure-samples/ai-gateway/apim-policies"><img src="https://agentmods.dev/badge/skills/azure-samples/ai-gateway/apim-policies.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,731 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 2 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Prompt Injection · line 18
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
  • high Prompt Injection · line 93
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.01731
Opus 5 $0.00037 $0.00865
Sonnet 5 $0.00015 $0.00346
Haiku 4.5 $0.00007 $0.00173

Measured 11d ago against content hash cedf8f3ac055, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

apim-policies scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/apim-policies/SKILL.md · 249 lines

How it starts

The opening of the file, as written. The whole thing — 249 lines — stays where its author put it; the contents beside it link to each section on GitHub.

APIM Policies

This skill provides guidance for creating Azure API Management XML policies.

Policy Document Structure

Every APIM policy document follows this structure:

<policies>
    <inbound>
        <base />
        <!-- Policies applied to incoming requests -->
    </inbound>
    <backend>
        <base />
        <!-- Policies applied before forwarding to backend -->
    </backend>
    <outbound>
        <base />
        <!-- Policies applied to outgoing responses -->
    </outbound>
    <on-error>
        <base />
        <!-- Policies applied when errors occur -->
    </on-error>
</policies>

The <base /> element inherits policies from parent scopes (Global → Product → API → Operation).

Policy Categories Quick Reference

Category Common Policies Section
Authentication authentication-managed-identity, validate-azure-ad-token, validate-jwt inbound
Rate Limiting rate-limit-by-key, llm-token-limit, azure-openai-token-limit inbound
Caching azure-openai-semantic-cache-lookup/store, cache-lookup/store inbound/outbound
Routing set-backend-service, forward-request, retry inbound/backend
Transformation set-header, set-body, set-variable, rewrite-uri any
AI Gateway llm-content-safety, llm-emit-token-metric, azure-openai-emit-token-metric inbound
Control Flow choose, return-response, retry, wait any

Essential Policies

Set Backend Service

Route requests to a specific backend:

<set-backend-service backend-id="my-backend" />

Authentication with Managed Identity

Authenticate to Azure services using APIM's managed identity:

<authentication-managed-identity resource="https://cognitiveservices.azure.com" 
    output-token-variable-name="managed-id-access-token" ignore-error="false" />
<set-header name="Authorization" exists-action="override">
    <value>@("Bearer " + (string)context.Variables["managed-id-access-token"])</value>
</set-header>

Read the full file on GitHub · 249 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 249 lines · 74 tokens per session scan A cedf8f3ac055

Subscribe to this mod's changes

apim-policies is a skill published in the GitHub repository Azure-Samples/AI-Gateway (985 stars, last pushed today), licensed MIT. It adds 74 tokens to every session and 1,731 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

azure-maps-search-dotnet

Azure Maps SDK for .NET. Location-based services including geocoding, routing, rendering, geolocation, and weather. Use for address search, directions, map tiles, IP geolocation, and weather data. Triggers: "Azure Maps", "MapsSearchClient", "MapsRoutingClient", "MapsRenderingClient", "geocoding .NET", "route…

microsoft/skills · 91 tokens

microsoft-azure-webjobs-extensions-authentication-events-dotnet

Microsoft Entra Authentication Events SDK for .NET. Azure Functions triggers for custom authentication extensions. Use for token enrichment, custom claims, attribute collection, and OTP customization in Entra ID. Triggers: "Authentication Events", "WebJobsAuthenticationEventsTrigger", "OnTokenIssuanceStart"…

microsoft/skills · 97 tokens

azure-eventgrid-dotnet

Azure Event Grid SDK for .NET. Client library for publishing and consuming events with Azure Event Grid. Use for event-driven architectures, pub/sub messaging, CloudEvents, and EventGridEvents. Triggers: "Event Grid", "EventGridPublisherClient", "CloudEvent", "EventGridEvent", "publish events .NET", "event-driven"…

microsoft/skills · 80 tokens

azure-eventhub-dotnet

Azure Event Hubs SDK for .NET. Use for high-throughput event streaming: sending events (EventHubProducerClient, EventHubBufferedProducerClient), receiving events (EventProcessorClient with checkpointing), partition management, and real-time data ingestion. Triggers: "Event Hubs", "event streaming"…

microsoft/skills · 94 tokens

azure-mgmt-apicenter-dotnet

Azure API Center SDK for .NET. Centralized API inventory management with governance, versioning, and discovery. Use for creating API services, workspaces, APIs, versions, definitions, environments, deployments, and metadata schemas. Triggers: "API Center", "ApiCenterService", "ApiCenterWorkspace", "ApiCenterApi", "API…

microsoft/skills · 97 tokens

azure-servicebus-dotnet

Azure Service Bus SDK for .NET. Enterprise messaging with queues, topics, subscriptions, and sessions. Use for reliable message delivery, pub/sub patterns, dead letter handling, and background processing. Triggers: "Service Bus", "ServiceBusClient", "ServiceBusSender", "ServiceBusReceiver", "ServiceBusProcessor"…

microsoft/skills · 86 tokens