agentleFS
camilo-acevedocamilo-acevedo/claude-skills/api-contract/SKILL.md

api-contract

Skill0 starsChanged 7 months agoMITView on GitHub

Distill an OpenAPI 3.x spec (JSON or YAML) into a compact CONTRACT.md with endpoints, methods, brief descriptions, schema references, and auth scheme summary. Read once instead of paging through a multi-MB spec file. Use when you need to understand or work against an API whose spec is too large for direct reading.

20 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use design-system, release-notes and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • AnthropicSkill

    design-system

    Audit, document, or extend your design system. Use when checking for naming inconsistencies or hardcoded values across components, writing documentation for a component's variants, states, and accessibility notes, or designing a new pattern that fits the existing system.

    Also in 4 projects that use this

  • Microsoft AzureSkill

    release-notes

    Author and update release notes for Azure App Configuration libraries and providers. USE FOR: write release notes, add release note entry, update release notes, draft release notes, new version release notes, format release notes. DO NOT USE FOR: generating changelogs from git history, writing internal engineering notes.

    Also in 4 projects that use this

  • OpenAISkill

    systematic-debugging

    Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes

    Also in 3 projects that use this

  • CloudflareSkill

    security-audit

    Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.

    Also in 3 projects that use this

  • GoogleSkill

    code-review

    Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.

    Also in 5 projects that use this

  • MicrosoftSkill

    release

    Use ONLY when the user explicitly asks to cut/publish a Huabu desktop release or tag a version. Performs an outward action — bumps the version in apps/desktop/package.json, commits + annotated-tags vX.Y.Z, and pushes the branch + tag. That tag push auto-builds the macOS/Windows installers and publishes a GitHub Release. Provides `status`, `bump`, `tag-push`, and a one-command `run` (bump → tag-push).

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

5 rules. 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT invoke when:

    line 27
  2. Distinctive:

    If under ~1500 lines: use the Read tool to read the whole file.

    line 41
  3. Very specific:

    If type: object with properties, summarize as { key1: <type>, key2: <type>, … }.

    line 88
  4. Very specific:

    If type: array, summarize as <item-type>[].

    line 90
  5. Very specific:

    If $ref only, summarize as → <target>.

    line 92

“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

api-contract

A Markdown-only skill — no Python, no scripts. You (Claude) read the OpenAPI spec with the Read tool (or extract sections via grep when the spec is too large), parse it in-context, and write CONTRACT.md.

When to invoke

Invoke api-contract when ANY of these apply:

  • The user points you at an OpenAPI / Swagger spec file (openapi.json, swagger.yaml, …) and asks about endpoints / shapes / auth.
  • You're about to read a spec file > 1000 lines.
  • You need to call an API documented by a spec and want to know which endpoints exist before drilling into one.

Do NOT invoke when:

  • The spec is small (< 200 lines) — just read it.
  • The user wants details of a specific endpoint already in context.
  • The input is GraphQL SDL — only OpenAPI is supported in v1.

How to run

Step 1 — measure the spec

wc -l "<path>"
  • If under ~1500 lines: use the Read tool to read the whole file.
  • Otherwise: use grep + Read with offsets to extract only the sections you need (see Step 2 below).

Step 2 — extract the sections you need

For both JSON and YAML specs, you only need four top-level sections:

SectionYAML keyJSON key
Metadatainfo:"info":
Serversservers:"servers":
Endpointspaths:"paths":
Schemascomponents.schemas: or definitions: (Swagger 2)"components"."schemas" or "definitions"
Authcomponents.securitySchemes: or securityDefinitions: (Swagger 2)same

For huge specs, locate the line ranges of these sections with:

grep -nE '^(info|servers|paths|components|definitions|securityDefinitions):' "<path>"

(JSON: look for top-level keys at indent 2 — grep -nE '^\s{2}"(info|servers|paths|components|definitions)"\s*:' "<path>".)

Then use the Read tool with offset and limit to read each section individually.

Step 3 — parse and summarize

Endpoints

For each path in paths:

  • For each HTTP method (get, post, put, patch, delete, head, options):
    • Extract summary (first line) or description (first sentence) as the one-line description.
    • Extract tags (first tag is used for grouping).
    • Extract request body schema name if present (requestBody.content.*.schema.$ref → last segment after /).
    • Extract parameters of type query (list the names, comma-separated).
    • Extract success response status + schema name if present (responses.2xx.content.*.schema.$ref → last segment).

Group endpoints by tag (or (untagged)).

Schemas

For each entry in components.schemas (or definitions):

  • If type: object with properties, summarize as { key1: <type>, key2: <type>, … }. Mark required keys with (required).
  • If type: array, summarize as <item-type>[].
  • If enum, summarize as enum (<comma-list>).
  • If $ref only, summarize as → <target>.
  • Cap at the first ~5 keys; append … if more.

Auth

For each entry in securitySchemes:

  • Print <name> + <type> + key transport (header / query / cookie) + scheme/format if relevant.

Step 4 — render CONTRACT.md

# API contract — <title> (v<version>)

Servers: <comma-list of server URLs>
Base URL: <basePath if Swagger 2, else first server.url path>

## Auth
- <name> (<type>, header: <Authorization|X-API-Key|…>)
- …

## Endpoints (<total>)

### <tag>
- <METHOD> <path>            — <one-line summary>             (<body: SchemaName, query: a, b, → 200 ResponseSchema>)
- …

(Repeat per tag, alphabetized.)

## Schemas (<total>)
- <Name>            <inlined shape>
- …

By default, write to <repo-root>/CONTRACT.md (use output=<path> to override). If the file already exists, overwrite it.

Supported arguments

ArgumentDefaultPurpose
path (first positional)requiredPath to an OpenAPI 3.x JSON or YAML spec.
output=<path>CONTRACT.md at repo rootWhere to write the distilled contract.
tag=<name>noneFilter endpoints whose tag contains <name> (case-insensitive).
maxschemas=N40Cap on schemas in the Schemas section.
noschemas=trueoffSkip the Schemas section entirely.

Notes

  • v1 supports OpenAPI 3.x and Swagger 2.0 (the section keys differ, but the shapes are similar enough). GraphQL SDL is out of scope.
  • For YAML specs, you read them with the Read tool the same as JSON — no parser library is needed because YAML keys are line-oriented and shallow enough for visual parsing.
  • Schemas with deep nesting are summarized to top-level shape only. Drill into the spec directly when you need full detail on one.
  • The result is small and stable — commit CONTRACT.md to the repo so future sessions skip the distill step.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.