moicle 1.7.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -27
- package/assets/architecture/_shared/severity-levels.md +34 -0
- package/assets/architecture/_shared/stack-detection.md +34 -0
- package/assets/commands/marketing.md +7 -7
- package/assets/skills/docs/sync/SKILL.md +245 -0
- package/assets/skills/docs/write/SKILL.md +274 -0
- package/assets/skills/feature/api/SKILL.md +277 -0
- package/assets/skills/feature/deprecate/SKILL.md +276 -0
- package/assets/skills/feature/new/SKILL.md +273 -0
- package/assets/skills/feature/refactor/SKILL.md +269 -0
- package/assets/skills/fix/hotfix/SKILL.md +233 -0
- package/assets/skills/fix/incident/SKILL.md +360 -0
- package/assets/skills/fix/pr-comment/SKILL.md +186 -0
- package/assets/skills/fix/root-cause/SKILL.md +276 -0
- package/assets/skills/marketing/content/SKILL.md +269 -0
- package/assets/skills/marketing/logo/SKILL.md +252 -0
- package/assets/skills/marketing/seo-blog/SKILL.md +367 -0
- package/assets/skills/marketing/video/SKILL.md +258 -0
- package/assets/skills/research/onboarding/SKILL.md +225 -0
- package/assets/skills/research/spike/SKILL.md +228 -0
- package/assets/skills/research/web/SKILL.md +204 -0
- package/assets/skills/review/architect/SKILL.md +274 -0
- package/assets/skills/review/branch/SKILL.md +277 -0
- package/assets/skills/review/pr/SKILL.md +231 -0
- package/assets/skills/review/tdd/SKILL.md +245 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +2 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/utils/symlink.d.ts +7 -0
- package/dist/utils/symlink.d.ts.map +1 -1
- package/dist/utils/symlink.js +82 -0
- package/dist/utils/symlink.js.map +1 -1
- package/package.json +1 -1
- package/assets/skills/api-integration/SKILL.md +0 -883
- package/assets/skills/architect-review/SKILL.md +0 -393
- package/assets/skills/content-writer/SKILL.md +0 -721
- package/assets/skills/deep-debug/SKILL.md +0 -114
- package/assets/skills/deprecation/SKILL.md +0 -923
- package/assets/skills/documentation/SKILL.md +0 -1333
- package/assets/skills/fix-pr-comment/SKILL.md +0 -283
- package/assets/skills/hotfix/SKILL.md +0 -397
- package/assets/skills/incident-response/SKILL.md +0 -946
- package/assets/skills/logo-design/SKILL.md +0 -477
- package/assets/skills/new-feature/SKILL.md +0 -297
- package/assets/skills/onboarding/SKILL.md +0 -607
- package/assets/skills/pr-review/SKILL.md +0 -620
- package/assets/skills/refactor/SKILL.md +0 -338
- package/assets/skills/research/SKILL.md +0 -124
- package/assets/skills/review-changes/SKILL.md +0 -312
- package/assets/skills/spike/SKILL.md +0 -535
- package/assets/skills/sync-docs/SKILL.md +0 -575
- package/assets/skills/tdd/SKILL.md +0 -828
- package/assets/skills/video-content/SKILL.md +0 -651
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: docs-write
|
|
3
|
+
description: Documentation workflow for authoring project documentation manually. Use when documenting, writing docs, generating documentation, or when user says "document", "generate docs", "write docs", "create documentation", "update docs".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Documentation Workflow
|
|
7
|
+
|
|
8
|
+
Hand-author project docs (README, API.md, ARCHITECTURE.md, CONTRIBUTING.md) with full control over voice and structure. For automated batch generation of a whole `docs/` tree with a review loop, use `/docs:sync` instead.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- ✅ Authoring or updating a specific document
|
|
13
|
+
- ✅ Need opinionated prose, not just structure
|
|
14
|
+
- ✅ Doc is small / scoped — a single file or section
|
|
15
|
+
- ❌ Want automated multi-doc generation → use `/docs:sync`
|
|
16
|
+
- ❌ Just need API reference from OpenAPI → use `/feature:api` Phase 4
|
|
17
|
+
|
|
18
|
+
## Read Architecture First
|
|
19
|
+
|
|
20
|
+
Detect stack via `~/.claude/architecture/_shared/stack-detection.md`. Read `ddd-architecture.md` + stack doc. Docs must reflect the architecture, not contradict it.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
SCAN → ANALYZE → GENERATE → REVIEW (loop)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Phase 1: SCAN
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
tree -L 3 -I 'node_modules|vendor|dist|build'
|
|
36
|
+
find . -maxdepth 3 -name "*.md" -o -name "README*"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Identify what needs work:
|
|
40
|
+
- README (project overview)
|
|
41
|
+
- API.md (endpoints, schemas)
|
|
42
|
+
- ARCHITECTURE.md (system design)
|
|
43
|
+
- CONTRIBUTING.md (dev setup, PR flow)
|
|
44
|
+
- Setup / deployment / runbook
|
|
45
|
+
- DB schema, config reference
|
|
46
|
+
|
|
47
|
+
### Gate
|
|
48
|
+
- [ ] Architecture doc read
|
|
49
|
+
- [ ] Existing docs inventoried
|
|
50
|
+
- [ ] Gaps identified, priorities set
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Phase 2: ANALYZE
|
|
55
|
+
|
|
56
|
+
For each doc define:
|
|
57
|
+
- **Purpose** — what problem does this solve?
|
|
58
|
+
- **Audience** — new contributor / API consumer / on-call?
|
|
59
|
+
- **Source** — which files / sections of the code feed this doc?
|
|
60
|
+
|
|
61
|
+
### Required sections per doc type
|
|
62
|
+
|
|
63
|
+
**README.md**
|
|
64
|
+
- One-line description + badges
|
|
65
|
+
- Quick start (≤5 commands)
|
|
66
|
+
- Tech stack (link to architecture)
|
|
67
|
+
- Common commands (build / test / lint / dev)
|
|
68
|
+
- Project structure (top 2 levels only)
|
|
69
|
+
- Link to ARCHITECTURE.md / CONTRIBUTING.md / API.md
|
|
70
|
+
|
|
71
|
+
**API.md**
|
|
72
|
+
- Auth method + how to obtain credentials
|
|
73
|
+
- Base URL per environment
|
|
74
|
+
- Per endpoint: method, path, request, response, errors, example
|
|
75
|
+
- Pagination convention (one block, not per endpoint)
|
|
76
|
+
- Error response format (one block, not per endpoint)
|
|
77
|
+
- Rate limits, versioning policy
|
|
78
|
+
|
|
79
|
+
**ARCHITECTURE.md**
|
|
80
|
+
- One mermaid layer diagram
|
|
81
|
+
- Domain list with 1-line responsibility
|
|
82
|
+
- Cross-domain communication pattern (events)
|
|
83
|
+
- Key tech decisions (DB, queue, auth) with rationale
|
|
84
|
+
- Link to `~/.claude/architecture/<stack>.md` for layer rules
|
|
85
|
+
|
|
86
|
+
**CONTRIBUTING.md**
|
|
87
|
+
- Local dev setup (prerequisites + ≤5 steps)
|
|
88
|
+
- Branch + commit conventions
|
|
89
|
+
- PR flow + review expectations
|
|
90
|
+
- Test commands + coverage expectations
|
|
91
|
+
- Where to ask for help
|
|
92
|
+
|
|
93
|
+
### Gate
|
|
94
|
+
- [ ] Each doc has purpose, audience, source
|
|
95
|
+
- [ ] Required sections listed
|
|
96
|
+
- [ ] Aligned with architecture doc
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Phase 3: GENERATE
|
|
101
|
+
|
|
102
|
+
### Rules
|
|
103
|
+
- **Use real code from the repo** — never invent examples
|
|
104
|
+
- **Link to architecture docs**, don't duplicate them
|
|
105
|
+
- **Code blocks must be runnable** — copy verbatim from working files
|
|
106
|
+
- **Diagrams** — mermaid; one per major concept
|
|
107
|
+
- **Tables** for any list with >3 parallel items (endpoints, env vars, commands)
|
|
108
|
+
|
|
109
|
+
### Minimal skeletons
|
|
110
|
+
|
|
111
|
+
Use these as starting points. For full templates, see `/docs:sync` (which generates the full set).
|
|
112
|
+
|
|
113
|
+
**README.md** (≤80 lines for most projects)
|
|
114
|
+
```markdown
|
|
115
|
+
# {Project Name}
|
|
116
|
+
|
|
117
|
+
> One-line value proposition.
|
|
118
|
+
|
|
119
|
+
## Quick Start
|
|
120
|
+
```bash
|
|
121
|
+
{install}
|
|
122
|
+
{run}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Tech Stack
|
|
126
|
+
- {language + version}, {framework}, {DB / queue}
|
|
127
|
+
|
|
128
|
+
See [ARCHITECTURE.md](./ARCHITECTURE.md).
|
|
129
|
+
|
|
130
|
+
## Commands
|
|
131
|
+
| Command | Purpose |
|
|
132
|
+
|---------|---------|
|
|
133
|
+
| `{cmd}` | {what} |
|
|
134
|
+
|
|
135
|
+
## Docs
|
|
136
|
+
- [API.md](./API.md) · [ARCHITECTURE.md](./ARCHITECTURE.md) · [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**API.md** (per-endpoint block)
|
|
140
|
+
```markdown
|
|
141
|
+
### POST /resource
|
|
142
|
+
|
|
143
|
+
Create a resource. Idempotent via `Idempotency-Key` header.
|
|
144
|
+
|
|
145
|
+
**Auth:** Bearer
|
|
146
|
+
|
|
147
|
+
**Request**
|
|
148
|
+
```json
|
|
149
|
+
{ "field": "value" }
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Response 201**
|
|
153
|
+
```json
|
|
154
|
+
{ "id": "...", "field": "value" }
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Errors:** `invalid_field` 400 · `unauthorized` 401 · `already_exists` 409
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**ARCHITECTURE.md** opener
|
|
161
|
+
```markdown
|
|
162
|
+
# Architecture
|
|
163
|
+
|
|
164
|
+
## Overview
|
|
165
|
+
{1-2 paragraphs: what this system does, key constraints}
|
|
166
|
+
|
|
167
|
+
## Layers
|
|
168
|
+
```mermaid
|
|
169
|
+
graph TD
|
|
170
|
+
App[Application] --> Domain
|
|
171
|
+
Domain --> Infra[Infrastructure]
|
|
172
|
+
```
|
|
173
|
+
See [DDD rules](~/.claude/architecture/ddd-architecture.md) for layer details.
|
|
174
|
+
|
|
175
|
+
## Domains
|
|
176
|
+
| Domain | Responsibility |
|
|
177
|
+
|--------|---------------|
|
|
178
|
+
| {name} | {one line} |
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**CONTRIBUTING.md** opener
|
|
182
|
+
```markdown
|
|
183
|
+
# Contributing
|
|
184
|
+
|
|
185
|
+
## Setup
|
|
186
|
+
```bash
|
|
187
|
+
{1-5 commands}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## Branch + Commits
|
|
191
|
+
- Branch: `{prefix}/{ticket}-{slug}`
|
|
192
|
+
- Commit: Conventional Commits
|
|
193
|
+
|
|
194
|
+
## PR Flow
|
|
195
|
+
1. Open PR vs `{base}`
|
|
196
|
+
2. CI green
|
|
197
|
+
3. ≥1 review approval
|
|
198
|
+
4. Squash merge
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Gate
|
|
202
|
+
- [ ] All planned docs drafted
|
|
203
|
+
- [ ] Code examples taken from real files
|
|
204
|
+
- [ ] Diagrams render
|
|
205
|
+
- [ ] Cross-links between docs work
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Phase 4: REVIEW
|
|
210
|
+
|
|
211
|
+
### Per-doc checklist
|
|
212
|
+
- [ ] Reflects current architecture (not outdated)
|
|
213
|
+
- [ ] All commands run as written (try them)
|
|
214
|
+
- [ ] All file paths exist
|
|
215
|
+
- [ ] All endpoints / functions referenced still exist
|
|
216
|
+
- [ ] Internal + external links resolve
|
|
217
|
+
- [ ] Code blocks compile / are valid syntax
|
|
218
|
+
- [ ] Diagrams match actual code structure
|
|
219
|
+
|
|
220
|
+
### Cross-doc consistency
|
|
221
|
+
- [ ] Same terminology everywhere (e.g., "domain" vs "module")
|
|
222
|
+
- [ ] No duplicated info — link instead
|
|
223
|
+
|
|
224
|
+
### Loop
|
|
225
|
+
If any issue → return to Phase 3 for that doc, fix, re-review.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Final Report
|
|
230
|
+
|
|
231
|
+
```markdown
|
|
232
|
+
## Documentation Update
|
|
233
|
+
|
|
234
|
+
### Files
|
|
235
|
+
- `README.md` — {changes}
|
|
236
|
+
- `API.md` — {changes}
|
|
237
|
+
- `ARCHITECTURE.md` — {changes}
|
|
238
|
+
- `CONTRIBUTING.md` — {changes}
|
|
239
|
+
|
|
240
|
+
### Verification
|
|
241
|
+
- [x] All commands tested
|
|
242
|
+
- [x] All links resolve
|
|
243
|
+
- [x] All examples compile
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## Hard Rules
|
|
249
|
+
|
|
250
|
+
- **Real examples only** — invented code drifts and lies
|
|
251
|
+
- **Link, don't duplicate** — refer to architecture docs, don't restate rules
|
|
252
|
+
- **Test every command** before publishing
|
|
253
|
+
- **Update the doc when you change the code** — stale docs are worse than no docs
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Related Skills
|
|
258
|
+
|
|
259
|
+
| When | Use |
|
|
260
|
+
|------|-----|
|
|
261
|
+
| Generate full doc site from codebase | `/docs:sync` |
|
|
262
|
+
| Document a newly added API endpoint | `/feature:api` Phase 4 |
|
|
263
|
+
| Onboard self / new dev | `/research:onboarding` |
|
|
264
|
+
| Write blog / social content | `/marketing:content` |
|
|
265
|
+
|
|
266
|
+
## Recommended Agents
|
|
267
|
+
|
|
268
|
+
| Phase | Agent | Purpose |
|
|
269
|
+
|-------|-------|---------|
|
|
270
|
+
| SCAN | `@clean-architect` | Identify doc needs |
|
|
271
|
+
| ANALYZE (API) | `@api-designer` | API doc structure |
|
|
272
|
+
| ANALYZE (DB) | `@db-designer` | Database doc structure |
|
|
273
|
+
| GENERATE | `@docs-writer` | Write all docs |
|
|
274
|
+
| REVIEW | `@code-reviewer` | Verify accuracy vs code |
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: feature-api
|
|
3
|
+
description: API integration workflow for adding new endpoints or integrating external APIs. Use when adding API endpoints, integrating third-party APIs, or when user says "integrate api", "add endpoint", "new api", "connect api", "api integration".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API Integration Workflow
|
|
7
|
+
|
|
8
|
+
End-to-end workflow for designing, implementing, testing, and documenting APIs — both internal endpoints and third-party integrations.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- ✅ Adding a new REST / GraphQL endpoint to your service
|
|
13
|
+
- ✅ Integrating a third-party API (Stripe, OpenAI, etc.) into the system
|
|
14
|
+
- ✅ Replacing or upgrading an existing API integration
|
|
15
|
+
- ❌ Just need a one-off HTTP call in a script → use Bash directly
|
|
16
|
+
- ❌ Need to research which API to use → use `/research:web` first
|
|
17
|
+
- ❌ Building a whole new domain → use `/feature:new` (which calls this skill internally for the API surface)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
DESIGN → IMPLEMENT → TEST → DOCUMENT → REVIEW LOOP
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Read Architecture First
|
|
28
|
+
|
|
29
|
+
Before any phase, read:
|
|
30
|
+
1. `~/.claude/architecture/ddd-architecture.md` (core DDD)
|
|
31
|
+
2. Stack-specific doc (`go-backend.md`, `nodejs-nestjs.md`, etc.)
|
|
32
|
+
3. Existing API conventions in the project (look at 1–2 existing endpoints as reference)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Phase 1: DESIGN
|
|
37
|
+
|
|
38
|
+
**Goal:** lock the API contract before writing any code.
|
|
39
|
+
|
|
40
|
+
### Actions
|
|
41
|
+
1. Identify API type: REST / GraphQL / gRPC / third-party client
|
|
42
|
+
2. Define contract:
|
|
43
|
+
- Endpoints / operations (method + path)
|
|
44
|
+
- Request / response schema (use real types from domain entities)
|
|
45
|
+
- Auth method
|
|
46
|
+
- Error codes per endpoint
|
|
47
|
+
- Pagination (cursor or offset) — pick ONE, apply to all list endpoints
|
|
48
|
+
- Idempotency keys for POST/PUT (if applicable)
|
|
49
|
+
3. Write the contract as **OpenAPI 3.0** (REST) or **GraphQL SDL**
|
|
50
|
+
|
|
51
|
+
### Minimal OpenAPI skeleton
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
openapi: 3.0.0
|
|
55
|
+
info: { title: <name>, version: 1.0.0 }
|
|
56
|
+
servers: [{ url: https://api.example.com/v1 }]
|
|
57
|
+
components:
|
|
58
|
+
securitySchemes:
|
|
59
|
+
BearerAuth: { type: http, scheme: bearer }
|
|
60
|
+
schemas:
|
|
61
|
+
Error: { type: object, properties: { code: { type: string }, message: { type: string } } }
|
|
62
|
+
paths:
|
|
63
|
+
/resource:
|
|
64
|
+
post:
|
|
65
|
+
summary: Create resource
|
|
66
|
+
security: [{ BearerAuth: [] }]
|
|
67
|
+
requestBody: { content: { application/json: { schema: { $ref: '#/components/schemas/CreateInput' } } } }
|
|
68
|
+
responses:
|
|
69
|
+
'201': { description: Created, content: { application/json: { schema: { $ref: '#/components/schemas/Resource' } } } }
|
|
70
|
+
'400': { description: Validation error, content: { application/json: { schema: { $ref: '#/components/schemas/Error' } } } }
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Gate
|
|
74
|
+
- [ ] Endpoints listed in a table (method, path, auth, purpose)
|
|
75
|
+
- [ ] Request / response schemas defined
|
|
76
|
+
- [ ] Error codes listed (with stable string codes, not just HTTP status)
|
|
77
|
+
- [ ] Pagination strategy chosen (cursor preferred)
|
|
78
|
+
- [ ] **User CONFIRMED contract** before continuing
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Phase 2: IMPLEMENT
|
|
83
|
+
|
|
84
|
+
**Goal:** implement the contract per stack conventions, respecting DDD layers.
|
|
85
|
+
|
|
86
|
+
### Layered placement (DDD)
|
|
87
|
+
|
|
88
|
+
| Concern | Layer | Notes |
|
|
89
|
+
|---------|-------|-------|
|
|
90
|
+
| Route definition | `application/ports/http/` | Thin handler: parse → service → respond |
|
|
91
|
+
| Request / Response DTOs | `application/ports/http/dto/` | NOT domain types |
|
|
92
|
+
| Validation | Handler or domain (depending on stack) | Reject bad input before reaching usecase |
|
|
93
|
+
| Business logic | `domain/{domain}/usecases/` | NEVER in the handler |
|
|
94
|
+
| External API client | `infrastructure/adapters/` | Implements a port in `domain/{domain}/ports/` |
|
|
95
|
+
| Auth check | Middleware / decorator | NOT inline in handler |
|
|
96
|
+
|
|
97
|
+
### Standard error response
|
|
98
|
+
|
|
99
|
+
All endpoints return errors in the same shape:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{ "error": { "code": "STRING", "message": "human-readable", "details": {} } }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
`code` is stable across versions; `message` may change. Map domain errors → HTTP codes in ONE place (middleware / interceptor).
|
|
106
|
+
|
|
107
|
+
### Standard pagination (cursor)
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
GET /resource?cursor=<opaque>&limit=<int 1..100, default 20>
|
|
111
|
+
→
|
|
112
|
+
{
|
|
113
|
+
"data": [...],
|
|
114
|
+
"pagination": { "next_cursor": "..." | null }
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Gate
|
|
119
|
+
- [ ] Routes registered in router / app module
|
|
120
|
+
- [ ] Handler is thin (parse → service → respond)
|
|
121
|
+
- [ ] Business logic in usecase, not handler
|
|
122
|
+
- [ ] External calls go through infrastructure adapter
|
|
123
|
+
- [ ] Auth + validation in middleware, not handler
|
|
124
|
+
- [ ] Build passes: `{stack_build_command}`
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Phase 3: TEST
|
|
129
|
+
|
|
130
|
+
**Goal:** verify the contract holds and breaks safely.
|
|
131
|
+
|
|
132
|
+
### Test layers
|
|
133
|
+
|
|
134
|
+
| Layer | Type | What |
|
|
135
|
+
|-------|------|------|
|
|
136
|
+
| Handler | Unit | Validation, error mapping (mock service) |
|
|
137
|
+
| UseCase | Unit | Business logic (mock port) |
|
|
138
|
+
| Adapter (external API) | Integration | Real HTTP call to sandbox OR contract test with `nock` / `WireMock` |
|
|
139
|
+
| End-to-end | Integration | Full request → response, real DB |
|
|
140
|
+
|
|
141
|
+
### Mandatory test cases per endpoint
|
|
142
|
+
- [ ] Happy path
|
|
143
|
+
- [ ] Auth failure (missing / invalid token)
|
|
144
|
+
- [ ] Validation failure (each required field missing)
|
|
145
|
+
- [ ] Permission failure (valid token, wrong scope)
|
|
146
|
+
- [ ] Not found (where applicable)
|
|
147
|
+
- [ ] Rate limit / quota (where applicable)
|
|
148
|
+
- [ ] Idempotency (POST with same key returns same response)
|
|
149
|
+
|
|
150
|
+
### Gate
|
|
151
|
+
- [ ] All mandatory cases covered
|
|
152
|
+
- [ ] Tests pass: `{stack_test_command}`
|
|
153
|
+
- [ ] Error response shape verified in tests
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## Phase 4: DOCUMENT
|
|
158
|
+
|
|
159
|
+
**Goal:** update API docs so consumers can use it without reading code.
|
|
160
|
+
|
|
161
|
+
### What to update
|
|
162
|
+
1. **OpenAPI spec** committed to repo (`openapi.yaml` or per-resource files)
|
|
163
|
+
2. **API.md** — append the new endpoint(s) (or refer to `/docs:write` skill for full re-author)
|
|
164
|
+
3. **CHANGELOG.md** — note breaking / additive changes
|
|
165
|
+
4. **README.md** — if this changes quick-start
|
|
166
|
+
|
|
167
|
+
### Endpoint doc entry (minimal)
|
|
168
|
+
|
|
169
|
+
```markdown
|
|
170
|
+
### POST /resource
|
|
171
|
+
|
|
172
|
+
Create a resource. Idempotent via `Idempotency-Key` header.
|
|
173
|
+
|
|
174
|
+
**Auth:** Bearer
|
|
175
|
+
|
|
176
|
+
**Request**
|
|
177
|
+
```json
|
|
178
|
+
{ "field": "value" }
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Response 201**
|
|
182
|
+
```json
|
|
183
|
+
{ "id": "...", "field": "value" }
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Errors**
|
|
187
|
+
| Code | HTTP | Meaning |
|
|
188
|
+
|------|------|---------|
|
|
189
|
+
| `invalid_field` | 400 | `field` failed validation |
|
|
190
|
+
| `unauthorized` | 401 | Token missing or invalid |
|
|
191
|
+
| `already_exists` | 409 | Same idempotency key with different body |
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Gate
|
|
195
|
+
- [ ] OpenAPI spec updated and lints
|
|
196
|
+
- [ ] API.md entry added
|
|
197
|
+
- [ ] CHANGELOG entry
|
|
198
|
+
- [ ] At least 1 example request runs successfully (curl / Postman)
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Phase 5: REVIEW LOOP
|
|
203
|
+
|
|
204
|
+
Run `/review:architect` for the touched domain. Loop until score ≥ B.
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
LOOP:
|
|
208
|
+
1. Run /review:architect {stack} {domain}
|
|
209
|
+
2. Fix violations
|
|
210
|
+
3. Re-run tests + build
|
|
211
|
+
4. GOTO 1 (until score ≥ B)
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Final Report
|
|
217
|
+
|
|
218
|
+
```markdown
|
|
219
|
+
## API Integration Complete
|
|
220
|
+
|
|
221
|
+
### Endpoints Added / Changed
|
|
222
|
+
| Method | Path | Purpose |
|
|
223
|
+
|--------|------|---------|
|
|
224
|
+
| POST | /v1/resource | Create resource |
|
|
225
|
+
|
|
226
|
+
### Files Created
|
|
227
|
+
- `application/ports/http/resource_handler.{ext}`
|
|
228
|
+
- `domain/{domain}/usecases/create_resource.{ext}`
|
|
229
|
+
- `infrastructure/adapters/{external_service}.{ext}` (if applicable)
|
|
230
|
+
|
|
231
|
+
### Tests
|
|
232
|
+
- {N} test files, {M} test cases
|
|
233
|
+
- Coverage: handler, usecase, adapter, e2e
|
|
234
|
+
|
|
235
|
+
### Documentation
|
|
236
|
+
- [x] OpenAPI spec updated
|
|
237
|
+
- [x] API.md entry added
|
|
238
|
+
- [x] CHANGELOG entry
|
|
239
|
+
|
|
240
|
+
### Review Score: {A/B}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Hard Rules
|
|
246
|
+
|
|
247
|
+
- **NEVER put business logic in the handler** — handler is thin parse-call-respond
|
|
248
|
+
- **NEVER call an external API directly from a usecase** — go through an infrastructure adapter that implements a domain port
|
|
249
|
+
- **Error codes are stable strings**, not just HTTP status — frontend/SDK depend on them
|
|
250
|
+
- **Pick one pagination style** for the whole API (cursor preferred), don't mix
|
|
251
|
+
- **Idempotency key required** for any POST that creates state
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Related Skills
|
|
256
|
+
|
|
257
|
+
| When | Use |
|
|
258
|
+
|------|-----|
|
|
259
|
+
| Designing the API contract from scratch | `@api-designer` agent |
|
|
260
|
+
| Adding the endpoint as part of a larger feature | `/feature:new` (calls this internally) |
|
|
261
|
+
| Writing tests for the endpoint | `/review:tdd` |
|
|
262
|
+
| Documenting the full API surface | `/docs:write` |
|
|
263
|
+
| Reviewing architecture compliance | `/review:architect` |
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## Recommended Agents
|
|
268
|
+
|
|
269
|
+
| Phase | Agent | Purpose |
|
|
270
|
+
|-------|-------|---------|
|
|
271
|
+
| DESIGN | `@api-designer` | API contract design (OpenAPI / GraphQL) |
|
|
272
|
+
| DESIGN | `@clean-architect` | Ensure DDD compliance |
|
|
273
|
+
| IMPLEMENT | Stack-specific dev agent | Implementation |
|
|
274
|
+
| IMPLEMENT | `@db-designer` | DB schema if new tables needed |
|
|
275
|
+
| TEST | `@test-writer` | Unit + integration tests |
|
|
276
|
+
| TEST | `@security-audit` | Auth / injection / rate-limit checks |
|
|
277
|
+
| DOCUMENT | `@docs-writer` | OpenAPI + API.md |
|