Skip to Content
MeowKit
Skills

mk:api-design-principles

Designs and reviews API contracts (REST, GraphQL, RPC, events) by finding the existing consumers and conventions first.

Source.claude/skills/api-design-principles/SKILL.md
Ownerportability
Runtimeportable
Riskhigh

mk:api-design-principles authors and reviews what an API promises consumers: shape, error and authorization requirements, compatibility, deprecation and pagination. It finds the existing consumers and conventions before recommending anything, so an extension matches the API it extends. Use it before handlers are written, or to review a contract.

When not to use it

If you needUse
The handler or service implementedmk:backend-development
Schema, migration, query or index workmk:database
Infrastructure, delivery or rollbackmk:devops
A security verdictthe security workflow (mk:cso)

A contract-only question stays here even in the middle of a backend task. A backend task loads this skill only when a new, public or breaking contract is in scope. A message-based change splits: the message contract is here, the producer or consumer code is mk:backend-development.

Usage

/mk:api-design-principles [contract or review] [--rest|--graphql|--rpc|--event]
FlagMeaning
--restHTTP contract. Loads references/rest-principles.md
--graphqlGraphQL schema. Loads references/graphql-principles.md
--rpc, --eventMessage contract. Loads neither reference

What it does

  1. Discover: existing consumers, contract surface, versioning scheme, error envelope, pagination shape and contract tests.
  2. Classify: keep the discovered style. On greenfield work, choose from client shape, query flexibility, streaming need and consumer ownership, and say why.
  3. Model: shape, authorization requirement, validation and error semantics, and only the idempotency, concurrency or pagination the use case needs.
  4. Review with examples: success, invalid input, forbidden, conflict or not found, and one evolution case. A contract with no failure example is unreviewed.
  5. Hand off: implementation, persistence, security verdict and release go to their owners.

Compatibility rules

CaseRule
Additive (optional field, new operation)Safe, no version bump
BreakingAnything a current consumer can observe: removed or renamed field, narrowed type, changed default, tighter validation, changed status or error code, changed pagination shape
Before breakingName every consumer found. An unknown consumer set is itself a finding
RemovalDeprecate first, keep the old shape working, signal to consumers, remove after migration is evidenced
VersioningFollow the discovered scheme

Page sizes, rate limits, cache policies and sunset windows are read from the repository or asked for, never invented.

Output

A compact contract decision record: discovered evidence, consumer set and stability class, style rationale, contract delta, error, authorization and compatibility semantics, the reviewed examples, and hand-offs.

Gotchas

  • Consistency with the shipped contract beats any convention. Plural nouns, shallow nesting and cursor pagination are defaults that yield to what the API already does.
  • Two error envelopes already shipped means converging them is a breaking change. Document the target instead of adding a third.
  • An error body must not leak stack traces, driver errors, file paths or host details.
  • A GraphQL field that fans out per parent row needs its fetch cost addressed before the schema ships. The fix goes to mk:database.
  • With no broker in the repository, the skill says the capability is absent and does not design a queue or retry path.

On this page