api-contract

api-contract is a command for Claude Code from thapaliyabikendra/ai-artifacts. It costs 10 tokens per session (2,376 once invoked), scanned A, original, Apache-2.0.

A command for designing an API contract in OpenAPI, a machine-readable description of an HTTP API's endpoints, inputs, outputs, and permissions. It checks the project context before generating the specification.

In plain words
What is it for?
Designing resource operations and generating an OpenAPI specification that documents routes, parameters, responses, schemas, and access requirements.
Why use it?
It creates a shared description of how an API should work, helping developers and clients agree on its behavior before implementation.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/thapaliyabikendra/ai-artifacts/api-contract
Clone the repo
git clone --depth 1 https://github.com/thapaliyabikendra/ai-artifacts

Made for: Claude Code.

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 api-contract

README.md
[![agentmods](https://agentmods.dev/badge/commands/thapaliyabikendra/ai-artifacts/api-contract.svg)](https://agentmods.dev/commands/thapaliyabikendra/ai-artifacts/api-contract)
Your own site
<a href="https://agentmods.dev/commands/thapaliyabikendra/ai-artifacts/api-contract"><img src="https://agentmods.dev/badge/commands/thapaliyabikendra/ai-artifacts/api-contract.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,376 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00010 $0.02376
Opus 5 $0.00005 $0.01188
Sonnet 5 $0.00002 $0.00475
Haiku 4.5 $0.00001 $0.00238

Measured 4d ago against content hash c9034f819dd6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

api-contract 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 4d 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.

.claude/commands/arch/api-contract.md · 446 lines

How it starts

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

Design API Contract

Resource: $ARGUMENTS.resource Operations: $ARGUMENTS.operations Format: $ARGUMENTS.format

Instructions

Step 1: Gather Context

  1. Check if entity exists in docs/domain/entities/
  2. Review existing API patterns in codebase
  3. Identify related resources and relationships
  4. Check permission requirements

Step 2: Generate OpenAPI Specification

openapi: 3.0.3
info:
  title: [Resource] API
  description: API for managing [resource]
  version: 1.0.0

tags:
  - name: [Resource]
    description: [Resource] management operations

paths:
  /api/app/[resource]:
    get:
      tags:
        - [Resource]
      summary: Get list of [resource]
      operationId: get[Resource]List
      parameters:
        - $ref: '#/components/parameters/SkipCount'
        - $ref: '#/components/parameters/MaxResultCount'
        - $ref: '#/components/parameters/Sorting'
        - name: filter
          in: query
          schema:
            type: string
          description: Search filter
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/[Resource]PagedResult'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - oauth2: ['[resource].read']

    post:
      tags:
        - [Resource]
      summary: Create a new [resource]
      operationId: create[Resource]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Create[Resource]Dto'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/[Resource]Dto'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
      security:
        - oauth2: ['[resource].create']

  /api/app/[resource]/{id}:
    get:
      tags:
        - [Resource]
      summary: Get [resource] by ID
      operationId: get[Resource]
      parameters:
        - $ref: '#/components/parameters/Id'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/[Resource]Dto'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - oauth2: ['[resource].read']

    put:
      tags:
        - [Resource]
      summary: Update [resource]
      operationId: update[Resource]
      parameters:
        - $ref: '#/components/parameters/Id'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Update[Resource]Dto'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/[Resource]Dto'
        '400':
          $ref: '#/components/responses/ValidationError'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - oauth2: ['[resource].update']

    delete:
      tags:
        - [Resource]
      summary: Delete [resource]
      operationId: delete[Resource]
      parameters:
        - $ref: '#/components/parameters/Id'
      responses:
        '204':
          description: Deleted
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - oauth2: ['[resource].delete']

components:
  schemas:
    [Resource]Dto:
      type: object
      properties:
        id:
          type: string
          format: uuid
        # Add entity-specific properties
        creationTime:
          type: string
          format: date-time
        lastModificationTime:
          type: string
          format: date-time
          nullable: true

    Create[Resource]Dto:
      type: object
      required:
        - name
      properties:
        # Add create-specific properties
        name:
          type: string
          maxLength: 100

    Update[Resource]Dto:
      type: object
      required:
        - name
      properties:
        # Add update-specific properties
        name:
          type: string
          maxLength: 100

    [Resource]PagedResult:
      type: object
      properties:
        totalCount:
          type: integer
          format: int64
        items:
          type: array
          items:
            $ref: '#/components/schemas/[Resource]Dto'

  parameters:
    Id:
      name: id
      in: path
      required: true
      schema:
        type: string
        format: uuid

    SkipCount:
      name: skipCount
      in: query
      schema:
        type: integer
        default: 0
        minimum: 0

    MaxResultCount:
      name: maxResultCount
      in: query
      schema:
        type: integer
        default: 10
        minimum: 1
        maximum: 1000

    Sorting:
      name: sorting
      in: query
      schema:
        type: string
      description: 'Sorting expression (e.g., "name asc, createdAt desc")'

  responses:
    ValidationError:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: string
                  message:
                    type: string
                  validationErrors:
                    type: array
                    items:
                      type: object
                      properties:
                        field:
                          type: string
                        message:
                          type: string

    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: object
                properties:
                  code:
                    type: string
                    example: "EntityNotFound"
                  message:
                    type: string

    Unauthorized:
      description: Authentication required

    Forbidden:
      description: Insufficient permissions

  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: /connect/authorize
          tokenUrl: /connect/token
          scopes:
            '[resource].read': Read [resource]
            '[resource].create': Create [resource]
            '[resource].update': Update [resource]
            '[resource].delete': Delete [resource]

Read the full file on GitHub · 446 lines

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. 4d ago First seen · 446 lines · 10 tokens per session scan A c9034f819dd6

Subscribe to this mod's changes

api-contract is a command published in the GitHub repository thapaliyabikendra/ai-artifacts (24 stars, last pushed 5mo ago), licensed Apache-2.0. It adds 10 tokens to every session and 2,376 once invoked, about $0.0001 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.