Community程式設計與開發github.com

api-contract-design

Design or change an API or event contract contract-first (REST, gRPC, GraphQL, async events) with errors, pagination, versioning, and a breaking-change check. Use when adding or changing an endpoint, message, or schema others depend on.

api-contract-design 是什麼?

api-contract-design is a Cursor agent skill that design or change an API or event contract contract-first (REST, gRPC, GraphQL, async events) with errors, pagination, versioning, and a breaking-change check. Use when adding or changing an endpoint, message, or schema others depend on.

相容平台~Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/ifundeasy/claude-crew/tree/HEAD/skills/api-contract-design

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

API contract design

Rules

  • Contract first: the specification is written and reviewed before implementation.
  • Backward compatible by default. A breaking change needs a new version or an agreed deprecation window.
  • Consistency with the existing API's conventions beats preference. Read the existing specification first.

Procedure

  1. Consumers and use cases. Who calls it, for what, how often; latency and volume expectations.
  2. Model. REST: resources as nouns with standard methods. Events: past-tense facts (order.paid) with an owner domain.
  3. Schemas. Types, required vs optional, formats:
    • Timestamps in ISO 8601 UTC.
    • Money as an integer of minor units or a decimal string, always with an ISO 4217 currency code; never floating point.
    • IDs as opaque strings.
    • Enumerations documented as extensible; consumers must tolerate unknown values.
  4. Errors. One error envelope across the API (for example RFC 9457 problem details), stable machine-readable codes, correct status codes, no internal details.
  5. Collections. Pagination from the start (cursor-based for large or changing sets), filters, sort, and a maximum page size.
  6. Idempotency and concurrency. Idempotency keys for non-idempotent creates and payments; ETag with If-Match or a version field for updates. Event consumers must tolerate duplicates and out-of-order delivery.
  7. Security. Authentication method; authorisation per operation and resource; scopes; rate limits; size and length limits; sensitive fields marked and minimised.
  8. Versioning and evolution. State the strategy (path, header, or schema evolution) and keep changes additive within a version.
  9. Breaking-change check against the current specification with breaking-changes.md.
  10. Deprecation plan for any break: announcement, dual-run period, usage telemetry on the old version, removal date, consumer sign-off.
  11. Examples for success and the main error cases.
  12. Write the specification and validate it with the project's linter if one exists (read-only run).

Output

  1. The specification change (file diff).

  2. Change summary:

    Operation / messageChangeBackward compatible?Consumer impact
  3. Open questions with options and one Recommendation.

Quality checklist

  • Existing conventions followed; deviations justified.
  • Every operation has authorisation, errors, and limits defined.
  • Collections are paginated; money and time formats are safe.
  • The breaking-change check is recorded.
  • Examples exist for success and main errors.

Pitfalls

  • Exposing the database structure as the API.
  • A boolean that later needs a third state.
  • Adding pagination after release — that is a breaking change.

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

alerting-design

Design alerts that page only for user harm — SLO burn-rate alerts, page versus ticket, owned rules with runbooks, alert quality, and deploy health gates. Use when adding or reviewing alerts, after a missed or noisy page, or defining deploy gates.

cloud-security-baseline

Assess a cloud organisation's security baseline read-only against CIS benchmarks — guardrails, root protection, federation, audit logging, threat detection, encryption — with gaps fixed as code. Use for new, inherited, or audited accounts.

ifundeasy/container-build

Write or fix a container image build — multi-stage Dockerfile, pinned minimal base, non-root user, no secrets in layers, SBOM — built locally, never pushed. Use when a Dockerfile or compose file changes, or an image is large, slow, or fails a scan.

incident-response

Run a security or operational incident from declaration to closure under a human incident commander — severity, roles, scoping, containment, recovery. Use when an alert, leaked secret, or outage may be an incident, or to scope, run, or close one.

log-source-onboarding

Onboard a log source into a SIEM — required fields, agent rollout, parsers proven by golden-sample tests, schema normalisation, and health checks. Use when a system must send logs, a detection lacks fields, or a source is silent or mis-parsed.

sensitive-data-scan

Scan outputs for secrets, personal data, and compensation data before publishing or sharing — patterns plus a full read, triage, masked findings, re-scan. Use before any output leaves the team, on flagged doc pages, or when merging agents' outputs.

siem-operations

Operate a SIEM such as Wazuh or OpenSearch safely — health and capacity, retention, snapshots and restore drills, upgrades with rollback, ingestion monitoring, tamper protection. Use when sizing, changing, or upgrading a SIEM, or ingestion lags.

相關技能