跳到正文
cccskills
免费在 GitHub 公开

mk-api-design-principles

Design and review durable REST, GraphQL, RPC, or event API contracts: shape, compatibility, pagination, error semantics. Discovers existing consumers first. Not implementation, schema, or release.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(3)

  • SKILL.md7.4 KB
  • references/graphql-principles.md4.5 KB
  • references/rest-principles.md4.8 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

API Design Principles

Durable interface contracts. Discover the existing contract before proposing a new one.

Ownership

OwnerOwnsDoes NOT own
mk:api-design-principlesInterface contract: resource/type/message shape, error and authorization requirements, compatibility and deprecation, consumer discoveryImplementation, persistence, security verdict, release
mk:backend-developmentEnd-to-end backend change: discovery, classification, service/handler/integration workContract authorship, schema/SQL, security verdict, deploy
mk:databaseData invariants, schema, migration and recovery, query/index evidence, ORM boundaryAPI contract, authorization verdict, infrastructure execution
mk:devopsInfrastructure-as-code, containers, CI, runtime config, deployment safety design, rollback, incident diagnosisDeploy approval and execution, security verdict, code root-cause, schema semantics

Routing rules — identical in all four skills:

  • Contract-only API question → mk:api-design-principles, even in the middle of a task owned by another skill. "Contract" means what a consumer can observe: field set, error shape, status semantics, pagination, versioning. Extending an endpoint without changing any of those is not a contract change.
  • End-to-end backend change → mk:backend-development, which invokes the API skill only when a new, public, or breaking contract is in scope.
  • A message-based change (event, webhook, RPC) splits: the message contract belongs to mk:api-design-principles; the producer or consumer implementation belongs to mk:backend-development.
  • Schema, migration, query, index, or ORM work → mk:database. No other skill writes a migration or generic SQL.
  • Infrastructure, containers, delivery, or deployment safety → mk:devops.
  • An unscoped performance request is triaged by evidence, never by guess: mk:backend-development locates where the time actually goes, then hands a query or index question to mk:database and a capacity or runtime question to mk:devops. No skill invents the target.
  • Code root cause → mk:investigate. mk:devops owns the operational picture — what changed, where it fails, which signal proves it — and hands the defect over.
  • An auth-sensitive change: the owning skill states the requirement; the security workflow owns the verdict.
  • Any production effect → mk:ship or a human.

Workflow

  1. Discover. Find existing consumers, the current contract surface, versioning scheme, error envelope, pagination shape, and contract tests. Record what already exists before proposing anything. Never invent a convention the repository already answers.
  2. Classify the interface. Preserve the discovered style. On greenfield, choose from evidence — client shape, query flexibility, streaming need, and who owns the consumer — not from habit. Say why.
  3. Model the contract. Define resource/type/message shape, the authorization requirement per operation, validation and error semantics, and only the idempotency, concurrency, or pagination the use case actually needs.
  4. Review with examples. Walk success, invalid input, forbidden, conflict/not-found, and one evolution case. A contract with no failure example is unreviewed.
  5. Hand off. Implementation to mk:backend-development, persistence to mk:database, security verdict to the security workflow, release to the release workflow.

Load references/rest-principles.md for HTTP-specific detail, references/graphql-principles.md for schema-language detail. Load neither for an RPC, event, or webhook contract.

Compatibility and evolution

Style-neutral; applies to every shared or public contract change.

  • Additive is safe. A new optional field, a new operation, a new enum member consumers already tolerate. Ship it without a version bump.
  • Breaking is everything a current consumer can observe: removing or renaming a field, narrowing a type, changing a default, tightening validation, changing an error code or status for an existing case, or changing pagination shape.
  • Prove the consumer set before breaking. Name every consumer found in discovery. If the consumer set is unknown, that is the finding — do not assume it is empty.
  • Deprecate before removing. Announce, keep the old shape working, give consumers an observable signal, and remove only after migration is evidenced.
  • Versioning follows the discovered scheme. Do not introduce a new versioning mechanism to an API that already has one. On greenfield, pick a mechanism only when a breaking change is actually foreseeable, and say which one and why.
  • Do not invent a page size, rate limit, cache policy, or sunset window. Read it from the repository or ask.

Other interface patterns

RPC, event, and webhook contracts get the same discipline, expressed in message terms: name the message and its version, define the payload shape and required fields, state delivery expectations the system actually provides (ordering, at-least-once, replay) rather than assumed ones, and define failure semantics for the consumer.

Do not translate a message contract into an invented REST resource. Do not design a queue, retry policy, or dead-letter path when the repository has no broker — say the capability is absent and stop.

Output

A compact contract decision record: discovered evidence, consumer set and stability class, style rationale, contract delta, error/authorization/compatibility semantics, validation proof (the reviewed examples), and handoffs.

References

FileLoad when
references/rest-principles.mdThe contract is HTTP-shaped — methods, status codes, resource paths
references/graphql-principles.mdThe contract is a GraphQL schema — types, fields, resolver-visible shape

Gotchas

Each default holds until its condition flips.

  • Plural nouns for collection resources. Unless the discovered API already uses another convention — consistency with the existing contract beats the convention.
  • Keep nesting shallow — one level of parent context is usually enough. Deeper nesting is legitimate when the child genuinely cannot be addressed without the full path; flatten when it can.
  • Cursor pagination when the collection is large, ordered, and concurrently written. Offset is fine for a small bounded admin list, and switching an existing endpoint's pagination shape is a breaking change.
  • One error envelope across the contract. When the API already ships two, converging them is itself a breaking change — document the target and migrate deliberately rather than emitting a third.
  • Address GraphQL relationship-fetch cost before the schema ships when a field fans out per parent row. Hand the measurement and the fix to mk:database; batching is one mechanism, not a mandate on every resolver.
  • Status semantics carry meaning consumers depend on. Changing the status or error code for an existing case is breaking even when the body is unchanged.
  • An error body must not leak internals — no stack trace, driver error, file path, or host detail.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Use this skill to generate well-branded interfaces and assets for MeowKit (AI Agent Toolkit for Claude Code), either for production or throwaway prototypes/mocks/etc. Contains essential design guidelines, colors, type, fonts, assets, and UI kit components for prototyping.

中文简介正在准备中。当前显示原文说明。

ngocsangyem/MeowKit152026年7月28日 更新

mk-advise

免费

Turn a raw idea into ONE honest recommendation: interview one question at a time until confirmed, then give a verdict with trade-offs and a checklist. Not for options or debate.

中文简介正在准备中。当前显示原文说明。

ngocsangyem/MeowKit152026年7月28日 更新

Browser automation CLI for agents: navigate, click/fill, screenshot, extract data, test apps, Electron/Slack, cloud browsers. NOT for the user's real Chrome profile/cookies (mk:chrome-profile).

中文简介正在准备中。当前显示原文说明。

ngocsangyem/MeowKit152026年7月28日 更新

Detects the right agent and complexity tier at Phase 0 orient; runs first in every workflow. NOT for runtime agent routing inside a single skill.

中文简介正在准备中。当前显示原文说明。

ngocsangyem/MeowKit152026年7月28日 更新

Angular v20+ patterns: components, signals, services, forms, routing, HTTP, testing, SSR. Auto-activates on .ts files in Angular projects (angular.json detected).

中文简介正在准备中。当前显示原文说明。

ngocsangyem/MeowKit152026年7月28日 更新

mk-ask-me

免费

Answer factual project questions (codebase, architecture) with cited evidence. NOT for brainstorming, trade-offs (mk:party), debugging (mk:investigate), review (mk:review), or plans (mk:plan-creator).

中文简介正在准备中。当前显示原文说明。

ngocsangyem/MeowKit152026年7月28日 更新

查看 ngocsangyem 的全部技能

报告此技能的问题