From spec-writer
Use when designing or updating a REST API from existing requirements/screen + database specs (docs/spec/) — sinh tài liệu Thiết kế API 2 tầng (chung + theo resource) với request/response JSON, validation, error code, và cập nhật index truy vết để map API-ID ↔ F-NNN ↔ màn ↔ bảng. Là Stage 4 (API) trong pipeline spec-writer.
How this skill is triggered — by the user, by Claude, or both
Slash command
/spec-writer:api-designerThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Sinh & quản lý **tài liệu Thiết kế API 2 tầng** từ spec (`spec-writer`) và thiết kế DB (`db-designer`).
Sinh & quản lý tài liệu Thiết kế API 2 tầng từ spec (spec-writer) và thiết kế DB (db-designer).
Mục tiêu: tài liệu API đủ căn cứ để sinh test spec và code — endpoint có request/response JSON, validation khớp ràng buộc DB, error code, route mapping — đồng thời giữ truy vết API-ID ↔ F-NNN ↔ màn (F-NNN) ↔ bảng DB.
Ngôn ngữ: tiếng Việt là chính; method/URL/JSON key/tên kiểu để tiếng Anh (theo mẫu).
Write/Edit. KHÔNG in/dán toàn bộ nội dung tài liệu (endpoint, JSON) ra chat.api-designer là Stage 4 (API) — chạy SAU DB (db-designer), TRƯỚC plan/code.
| Stage | Việc | Skill |
|---|---|---|
| 2. Spec | Spec tổng + spec con màn hình | spec-writer |
| 3. DB | Thiết kế CSDL | db-designer |
| 4. API | Thiết kế API từ spec + DB | api-designer ← đang ở đây |
| 5. Plan / 6. Code | Lập kế hoạch & code | superpowers:writing-plans / executing-plans |
Hết Stage 4 LUÔN hỏi người dùng: "Dừng ở API, hay tiếp tục sang plan (Stage 5)?"
docs/spec/00_index.md + 01_requirements.md + screens/. Thiếu → đề nghị chạy spec-writer.docs/spec/database/03_database-design.md. Thiếu → cảnh báo người dùng: API thiết kế khi chưa có DB sẽ phải đoán cột → đề nghị chạy db-designer trước, hoặc chấp nhận đánh dấu Cần xác nhận cho phần dữ liệu.02_tech_context.md (backend framework, auth, base URL, JSON key style). Thiếu → bổ sung theo db-designer/references/tech-context-template.md.00_index.md (F-NNN, màn, bảng DB), các screens/F-NNN_*.md (yêu cầu dữ liệu của màn) để rút ra endpoint cần có.API design gồm tài liệu chung (1 file, toàn dự án) + tài liệu riêng (1 file/nhóm resource).
docs/spec/api/05_00_common-api.md theo references/api-common-template.md — gồm danh sách toàn bộ endpoint (gán API-NNN).docs/spec/api/05_NN_<resource>-api.md theo references/api-resource-template.md — mỗi endpoint có request/response JSON + validation + error + thao tác DB (bảng/cột).references/api-rules.md.00_index.md: thêm bảng truy vết API (xem references/api-rules.md §truy vết).00_index.md + tài liệu chung để lấy API-NNN kế tiếp, error code, format.00_index.md.00_index.md: xác định F-NNN/bảng nào đổi → endpoint nào bị ảnh hưởng.00_index.md.../spec-writer/references/cross-doc-checks.md (mục C: API ↔ màn & DB); báo CRITICAL/WARNING.docs/spec/
├── 00_index.md # bổ sung bảng truy vết API ở đây
└── api/
├── 05_00_common-api.md # tài liệu chung (BẮT BUỘC, tạo trước)
├── 05_01_<resource>-api.md # tài liệu riêng theo nhóm resource
└── 05_02_<resource>-api.md
Số file riêng: 05_01..99; 05_00 luôn là tài liệu chung.
references/api-common-template.md — khuôn tài liệu chung (10 section).references/api-resource-template.md — khuôn tài liệu riêng (6 section + per-endpoint).references/api-rules.md — quy tắc REST/đặt tên, API-ID, error code chuẩn, validation↔DB, cập nhật truy vết 00_index.md, phase-gate.API-NNN; danh sách tổng ở tài liệu chung khớp các tài liệu riêng.screens/F-NNN_*.md có endpoint phục vụ.F-NNN + màn + bảng DB trong 00_index.md; không tham chiếu bảng/cột không tồn tại.Cần xác nhận chưa xử lý; có version + Lịch sử thay đổi.npx claudepluginhub lvh149/create-document-skill --plugin spec-writerSearches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.