Skip to content
AI Skills Central

Type to search Agent Skills, workflows, tutorials, tools and the glossary.

Agent Skills guide

Skill recipe: your internal API

When a skill beats an MCP server for an internal API, and a worked skill that teaches agents your endpoints, auth and error handling without exposing secrets.

By Intermediate · Updated 20 November 20265 min read
Bookmark

Bookmarks are kept in your free account, so you can find this page again on any device.

Sign in to bookmark
On this page

An internal API skill explains your company’s API to an agent that can already call it through your SDK or CLI: how to authenticate without secrets, the endpoints people actually use, error handling and what the agent must never do. It is cheaper to build than an MCP server and fits best when developers write code against the API.

Every company has an API that models were never trained on: the billing service, the feature-flag service, the internal admin API. There are two ways to teach an agent to use it. You can build an MCP server that exposes the API as tools, or you can write a skill that explains the API to an agent that already has a way to call it. This recipe helps you choose, then builds the skill version.

Skill or MCP server?

The two are not rivals; many vendor skills are “how to use our API or MCP server well”. But for a first step, the question is where the knowledge and the access should live.

Situation Better fit
Developers write code against the API in this repository Skill. The agent writes client code; it needs conventions, not live calls
The agent needs to call the API at run time, often, with structured inputs MCP server, maybe plus a skill on when to call which tool
Non-developers will use it from the Claude apps or ChatGPT MCP server or connector. Those users have no terminal or SDK
Auth involves OAuth, per-user tokens or anything you would not put in a shell MCP server, which can hold credentials and enforce scopes
You need it working this afternoon and it is mostly reads Skill using the existing CLI or SDK

A skill is cheaper to build and change: it is a Markdown file reviewed in a pull request. An MCP server is a service to run and secure, but it gives you one controlled place for auth and permissions. If you go that way, our MCP server workflow and the MCP builder skill walk through it. The rest of this recipe is the skill.

What goes in

  • Which client to use (your SDK, not raw HTTP) and how to construct it.
  • How authentication works, described without a single real secret.
  • The handful of endpoints people actually use, with the gotchas.
  • Error handling, retries and rate limits.
  • What the agent must never do (write to production, bypass the SDK).

Leave out the full endpoint reference; link to it or put a generated copy in references/.

The skill

---
name: billing-api
description: >-
  Writes and reviews code that calls Acme's internal Billing API through the
  @acme/billing-client SDK: customers, invoices, refunds and usage records.
  Use when code in this repo needs to read or change billing data, or when
  debugging Billing API errors. Not for the public Stripe integration.
compatibility: Requires the @acme/billing-client package and network access to the internal Billing API.
---

# Billing API

Always use `@acme/billing-client`. Never call the HTTP API with fetch or axios:
the SDK handles auth, idempotency keys and retries.

## Client setup

Create the client with `createBillingClient()` from `src/lib/billing.ts`. It
reads `BILLING_API_URL` and `BILLING_API_TOKEN` from the environment. Never
hard-code either, print them, or ask the user to paste a token.

## Common operations

| Task | Call | Notes |
|---|---|---|
| Find a customer | `billing.customers.get(id)` | Returns null, not an error, when missing |
| List open invoices | `billing.invoices.list({ status: "open" })` | Paginated; use `for await` |
| Refund | `billing.refunds.create({ invoiceId, amount })` | Amount in minor units. Needs a reason |
| Record usage | `billing.usage.record(...)` | Pass an idempotency key derived from the event ID |

Details and edge cases: references/endpoints.md.

## Errors

- 409 means a duplicate idempotency key: the first request succeeded. Do not retry.
- 429 is rate limiting. The SDK retries with backoff; do not add your own loop.
- Any 5xx from refunds: stop and report. Never retry refunds automatically.

## Safety

- Tests use the sandbox: `BILLING_API_URL=https://billing.sandbox.internal`.
- Never run code that creates refunds against production from the agent.

Notice what the skill does with secrets: it says where they come from and forbids handling them. The agent never needs to see a token to write correct code.

references/endpoints.md

If your API has an OpenAPI spec, generate a compact Markdown summary from it in CI (one heading per endpoint, parameters, one example) and commit it to the skill’s references/ folder. A generated file stays current; a hand-written one starts drifting the week after you write it. Keep it under a few hundred lines, with a table of contents, so the agent can jump to what it needs.

Testing it

In a fresh session, without naming the skill, ask for: “add a refund button to the admin page”, “why does usage recording return 409 sometimes?”, and “list customers with overdue invoices”. Check that the skill loads, the code uses the SDK, nothing reads or prints the token, and tests point at the sandbox. Add one prompt about the public Stripe integration to confirm the skill stays out of it; vendor skills like Stripe best practices handle that.

When to add an MCP server later

Add one when people outside engineering need the API, when agents call it at run time in production workflows, or when you need audit logs of what the agent did. Keep the skill: it becomes the guide to using the server’s tools, the same pattern Supabase uses for its CLI and MCP server. Our comparison of Agent Skills vs MCP covers the trade-offs in more depth.

If this is your first skill, what Agent Skills are and how to create a Claude skill cover the folder and frontmatter basics, and skill description best practices helps the skill load for the requests that need it. For the wider picture of where skills sit next to MCP servers, subagents and hooks, see skills vs subagents vs slash commands vs hooks.

  • Skills vs subagents vs slash commands vs hooks

    Skills vs subagents, slash commands, hooks, MCP servers and AGENTS.md: when to reach for each in a coding agent, with a decision table and a worked example.

    Skill guideBeginner

  • Build an MCP server for an internal API

    Two read-only tools, tested in MCP Inspector and called from Claude Code, Codex or Cursor.

    WorkflowIntermediate2 h6 steps

  • Agent Skills vs MCP servers

    When to package know-how as a skill and when to connect a system through MCP, compared on format, loading, security and upkeep.

    Comparison

  • Model Context Protocol

    Connecting AI applications to tools and data through MCP servers and clients.

    SkillIntermediate

Back to top