Api design

From akillness/jeo-skills · View interactive version

Api design is an AI agent skill from the GitHub repository akillness/jeo-skills. Design or refactor API contracts for REST and GraphQL systems.

How to use this skill

Skill file

API Design

Use this skill to turn a vague integration idea, backend feature, or service boundary into a stable API contract that other skills can build on.

The job is not to generate pretty docs. The job is to:

Read references/contract-review-checklist.md and references/boundary-guide.md before handling unusual or high-risk API work.

If the user mainly needs:

When to use this skill

When not to use this skill

Instructions

Step 1: Frame the contract problem

Capture the design inputs before inventing endpoints.

Record:

If the request is underspecified, state the missing assumptions explicitly inside the design packet.

Step 2: Choose the interface style deliberately

Do not default to a style out of habit.

Prefer REST when
Prefer GraphQL when
Prefer a mixed approach only when

State the reason for the chosen style. “Because everyone uses it” is not enough.

Step 3: Model resources, operations, and boundaries

For REST:

For GraphQL:

For either style:

Step 4: Define the request/response contract

Design the contract, not just the happy path.

Include:

If the API supports both machine-to-machine and frontend clients, note where response shapes or expansion patterns differ.

Step 5: Design auth, errors, and compatibility rules

Capture the operational semantics clients depend on.

Define:

Do not fully implement auth here. Define the contract and hand off detailed setup to authentication-setup when needed.

Step 6: Produce the contract artifact

Pick the lightest artifact that still enables downstream work.

Recommended formats:

Minimum contract packet:

Step 7: Review for breakage and handoff quality

Before finalizing, check:

Route next steps clearly:

Output format

## API Design Packet: [Name]

### Contract framing
- Style: [REST | GraphQL | mixed-with-justification]
- Consumers: [internal services / frontend app / partners / public developers]
- Primary job: [what the API enables]

### Resource or type model
- [resource/type]: [purpose]
- [resource/type]: [purpose]

### Operations
| Operation | Purpose | Input summary | Output summary | Notes |
|-----------|---------|---------------|----------------|-------|
| [GET/POST/query/mutation] | ... | ... | ... | ... |

### Contract rules
- Auth model: [...]
- Error model: [...]
- Pagination/filtering: [...]
- Versioning / compatibility: [...]

### Risks / open questions
- [...]

### Handoffs
- Documentation: [does `api-documentation` need to turn this into published docs?]
- Testing: [does `backend-testing` need contract/integration coverage?]
- Auth / data model: [adjacent handoffs]

Examples

Example 1: Public REST contract for partner integrations

Input: “Design a partner-facing order status API for ecommerce vendors. We need stable polling, webhook fallback later, and careful versioning.”

Good response shape:

Example 2: GraphQL schema for a dashboard client

Input: “We need a dashboard API for projects, deployments, incidents, and alerts. The UI has many views and keeps over-fetching in REST.”

Good response shape:

Best practices

  1. Treat the API contract as a product boundary, not just a code convenience.
  2. Separate design decisions from documentation publishing.
  3. Record assumptions and open questions instead of pretending certainty.
  4. Prefer additive evolution and explicit deprecation over surprise breaking changes.
  5. Keep rationale visible when choosing REST vs GraphQL.
  6. Use the smallest artifact that lets downstream teams act.
  7. Hand off intentionally to adjacent skills instead of bloating this one.

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.