name: REST API slug: rest-api version: 1.0.0 homepage: https://clawic.com/skills/rest-api description: Build production-ready REST APIs with contract-first design, secure auth, robust testing, and deployment runbooks. changelog: Initial release with end-to-end REST API build workflow from contract to deployment. metadata: {"clawdbot":{"emoji":"🌐","requires":{"bins":[]},"os":["linux","darwin","win32"]}}
On first use, read setup.md for integration behavior and memory initialization.
Use this skill when the user wants to design, implement, secure, test, and ship a REST API from scratch or harden an existing API for production.
This skill covers contract-first design, endpoint conventions, authentication and authorization, persistence strategy, test plans, observability, and release checklists.
Working memory lives in ~/rest-api/. See memory-template.md for structure and status behavior.
~/rest-api/
├── memory.md # HOT: active API project context
├── contracts/ # WARM: OpenAPI specs and compatibility notes
├── decisions/ # WARM: ADR-style technical decisions
├── tests/ # WARM: test plans and quality gates
├── operations/ # WARM: runbooks and incident notes
└── archive/ # COLD: closed projects and old versions
Load only what is needed for the current API task.
| Topic | File |
|---|---|
| Setup and activation behavior | setup.md |
| Memory schema | memory-template.md |
| Contract-first design | api-contract.md |
| Endpoint conventions and errors | endpoint-design.md |
| Auth and API security controls | auth-and-security.md |
| Data model and migrations | persistence-and-migrations.md |
| Test strategy and telemetry | testing-and-observability.md |
| Pre-release readiness gate | deployment-checklist.md |
Define resources, payload schemas, status codes, and error shapes in OpenAPI before writing handlers.
If the contract is unclear, implementation speed creates rework and breaks clients.
Use stable naming, plural resources, and correct HTTP methods. Make idempotent behavior explicit for PUT, DELETE, and retryable POST operations.
Predictable semantics reduce client bugs and support safer retries.
Require authentication on non-public endpoints, apply authorization checks at resource boundary, validate input strictly, and sanitize output.
Never rely on frontend validation as a security control.
小葱技能7w4.net有更新,你可以访问看下。
Specify error classes, timeout strategy, rate-limit behavior, and fallback expectations before scaling happy-path code.
APIs fail in production at edges, not in demos.
Use additive schema migrations first, backfill data safely, and only remove old fields after client migration windows close.
Breaking database or response changes without rollout planning cause outages.
Cover OpenAPI contract validation, integration tests against real infrastructure, and end-to-end tests for critical user journeys.
Unit tests alone do not prove API reliability.
Expose request metrics, structured errors, trace identifiers, and health indicators. Document recovery steps for known failure modes.
If an API cannot be observed, it cannot be operated safely.
Data that leaves your machine: - None by default.
Data that stays local:
- API project context and decisions under ~/rest-api/.
This skill does NOT: - Call undeclared external endpoints by default. - Store secrets automatically. - Modify infrastructure without explicit user instruction.
Install with clawhub install <slug> if user confirms:
- backend - System design and backend architecture decisions.
- auth - Authentication, session strategy, and credential safety.
- http - HTTP protocol details and request-response behavior.
- api - Third-party API integration references.
clawhub star rest-apiclawhub sync这是一份相当专业的 API 开发指南,结构清晰、覆盖全面,从设计契约到安全防护再到上线检查都有涉及。它的核心规则能帮助开发者避免常见错误,清单式的内容也很实用。美中不足的是缺少实际代码示例,只有干巴巴的说明文字,某些复杂话题讲得不够深入。对于想快速上手的开发者来说,可能需要配合其他资源一起使用。