ai-developer-skill-os 1.0.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/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/_template/SKILL.md +154 -0
- package/_template/examples/example-en.md +49 -0
- package/_template/examples/example-vi.md +49 -0
- package/bin/install.js +56 -0
- package/docs/CHI_TIET_SKILLS.md +117 -0
- package/docs/HUONG_DAN_SU_DUNG.md +102 -0
- package/package.json +34 -0
- package/skills/backend/auth-security/SKILL.md +94 -0
- package/skills/backend/backend-architecture/SKILL.md +123 -0
- package/skills/backend/database-engineer/SKILL.md +102 -0
- package/skills/backend/deployment/SKILL.md +94 -0
- package/skills/engineering/agent-orchestrator/SKILL.md +177 -0
- package/skills/engineering/api-integration/SKILL.md +378 -0
- package/skills/engineering/bug-fix/SKILL.md +211 -0
- package/skills/engineering/context-manager/SKILL.md +174 -0
- package/skills/engineering/git-engineer/SKILL.md +302 -0
- package/skills/engineering/migration/SKILL.md +282 -0
- package/skills/engineering/project-audit/SKILL.md +278 -0
- package/skills/engineering/refactor/SKILL.md +220 -0
- package/skills/frontend/accessibility-audit/SKILL.md +119 -0
- package/skills/frontend/component-generator/SKILL.md +134 -0
- package/skills/frontend/design-system/SKILL.md +135 -0
- package/skills/frontend/form-builder/SKILL.md +138 -0
- package/skills/frontend/frontend-architecture/SKILL.md +153 -0
- package/skills/frontend/frontend-debug/SKILL.md +131 -0
- package/skills/frontend/frontend-performance/SKILL.md +127 -0
- package/skills/frontend/frontend-testing/SKILL.md +144 -0
- package/skills/frontend/state-management/SKILL.md +138 -0
- package/skills/frontend/table-crud-generator/SKILL.md +125 -0
- package/skills/frontend/ui-builder/SKILL.md +150 -0
- package/skills.json +667 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-orchestrator
|
|
3
|
+
description: >-
|
|
4
|
+
Phân tích yêu cầu, lên kế hoạch thực thi chi tiết và điều phối các tác vụ cho đúng skill. Không tự viết code.
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
category: engineering
|
|
7
|
+
tags: [orchestration, planning, workflow, task-decomposition]
|
|
8
|
+
platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Agent Orchestrator
|
|
12
|
+
|
|
13
|
+
> **Language rule:**
|
|
14
|
+
> Use **English** for: skill names, phase labels, technical decisions, file paths.
|
|
15
|
+
> Use **the user's language** for: explanations, questions, plan summaries, and feedback.
|
|
16
|
+
|
|
17
|
+
> ⚠️ **CRITICAL CONSTRAINT: This skill MUST NOT write any code.**
|
|
18
|
+
> Its only job is to analyze, plan, and delegate.
|
|
19
|
+
> If the orchestrator starts writing implementation code — it is violating its role.
|
|
20
|
+
> Immediately stop and delegate to the appropriate skill instead.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Trigger
|
|
25
|
+
|
|
26
|
+
Activate this skill when:
|
|
27
|
+
- User describes a task without knowing where to start
|
|
28
|
+
- User request spans multiple concerns (UI + API + state + tests)
|
|
29
|
+
- Request is ambiguous and needs decomposition before action
|
|
30
|
+
- User says: "help me plan", "what should I do first", "how do I approach this"
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Scope
|
|
35
|
+
|
|
36
|
+
- ✅ Analyze the user's request
|
|
37
|
+
- ✅ Identify which skills are needed
|
|
38
|
+
- ✅ Define the correct execution order
|
|
39
|
+
- ✅ Create a step-by-step plan
|
|
40
|
+
- ✅ Delegate each step to the correct skill
|
|
41
|
+
- ✅ Track overall progress
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Non-goals
|
|
46
|
+
|
|
47
|
+
- ❌ Do NOT write implementation code
|
|
48
|
+
- ❌ Do NOT modify files
|
|
49
|
+
- ❌ Do NOT fix bugs directly (delegate to `bug-fix`)
|
|
50
|
+
- ❌ Do NOT build UI directly (delegate to `ui-builder`)
|
|
51
|
+
- ❌ Do NOT make architectural decisions unilaterally (delegate to `frontend-architecture`)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Workflow
|
|
56
|
+
|
|
57
|
+
### Phase 1 — Request Analysis
|
|
58
|
+
|
|
59
|
+
Parse the user's request:
|
|
60
|
+
|
|
61
|
+
1. **What** is being asked? (feature, fix, refactor, review, deploy?)
|
|
62
|
+
2. **Where** does it belong? (frontend, backend, shared, infrastructure?)
|
|
63
|
+
3. **What is the scope?** (single component, full feature, entire codebase?)
|
|
64
|
+
4. **What is unknown?** List any ambiguities that need clarification.
|
|
65
|
+
|
|
66
|
+
If critical information is missing → ask before planning.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### Phase 2 — Skill Selection
|
|
71
|
+
|
|
72
|
+
Map the request to skills from the registry:
|
|
73
|
+
|
|
74
|
+
| Request type | Recommended skill(s) |
|
|
75
|
+
|---|---|
|
|
76
|
+
| "I don't know what's wrong" | `project-audit` → `bug-fix` |
|
|
77
|
+
| "Build a new page" | `frontend-architecture` → `design-system` → `ui-builder` |
|
|
78
|
+
| "Add API call" | `context-manager` → `api-integration` |
|
|
79
|
+
| "App is slow" | `project-audit` → `frontend-performance` |
|
|
80
|
+
| "Upgrade dependencies" | `migration` |
|
|
81
|
+
| "Write tests" | `frontend-testing` |
|
|
82
|
+
|
|
83
|
+
Always check dependencies from `skills.json` — load dependent skills first.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### Phase 3 — Execution Plan
|
|
88
|
+
|
|
89
|
+
Produce a numbered, ordered plan. Each step maps to one skill.
|
|
90
|
+
|
|
91
|
+
Format:
|
|
92
|
+
```
|
|
93
|
+
Step 1: [skill-name] — [what it will do]
|
|
94
|
+
Step 2: [skill-name] — [what it will do]
|
|
95
|
+
Step 3: [skill-name] — [what it will do]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Mark dependencies explicitly:
|
|
99
|
+
```
|
|
100
|
+
Step 2 requires Step 1 to complete first.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Phase 4 — Delegation
|
|
106
|
+
|
|
107
|
+
For each step in the plan:
|
|
108
|
+
1. Announce which skill is being activated
|
|
109
|
+
2. Pass relevant context to that skill
|
|
110
|
+
3. Wait for skill output
|
|
111
|
+
4. Confirm completion before moving to next step
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### Phase 5 — Progress Tracking
|
|
116
|
+
|
|
117
|
+
After each skill completes:
|
|
118
|
+
- Mark step as ✅ done
|
|
119
|
+
- Note any output or blockers
|
|
120
|
+
- Adjust remaining plan if needed
|
|
121
|
+
- Report overall progress to user
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Decision Tree
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
Is the request clear enough to plan?
|
|
129
|
+
├── No → Ask 1-3 clarifying questions, then plan
|
|
130
|
+
└── Yes → Does it span multiple concerns?
|
|
131
|
+
├── Yes → Create multi-step plan with skill sequence
|
|
132
|
+
└── No → Route directly to single skill
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
Does a skill dependency exist?
|
|
137
|
+
├── Yes → Run dependency skill first
|
|
138
|
+
└── No → Run skill directly
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## Output Format
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
📋 Plan: [Brief description of what we're doing]
|
|
147
|
+
|
|
148
|
+
Step 1: `[skill-name]` — [Purpose]
|
|
149
|
+
Step 2: `[skill-name]` — [Purpose] ← requires Step 1
|
|
150
|
+
Step 3: `[skill-name]` — [Purpose]
|
|
151
|
+
|
|
152
|
+
⏳ Starting with Step 1...
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
After each step:
|
|
156
|
+
```
|
|
157
|
+
✅ Step 1 complete: [Brief outcome]
|
|
158
|
+
▶️ Moving to Step 2: `[skill-name]`
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Validation Checklist
|
|
164
|
+
|
|
165
|
+
Before finishing orchestration:
|
|
166
|
+
|
|
167
|
+
- [ ] All planned steps completed
|
|
168
|
+
- [ ] Each step was handled by the correct skill
|
|
169
|
+
- [ ] No code was written by the orchestrator itself
|
|
170
|
+
- [ ] User has been informed of final outcome
|
|
171
|
+
- [ ] Next recommended actions provided if relevant
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Examples
|
|
176
|
+
|
|
177
|
+
See `examples/` folder.
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-integration
|
|
3
|
+
description: >-
|
|
4
|
+
Chuyển đổi tài liệu API (curl, swagger...) thành code tích hợp frontend chuẩn xác, có type an toàn và xử lý lỗi.
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
category: engineering
|
|
7
|
+
tags: [api, integration, rest, graphql, axios, fetch, react-query, typescript]
|
|
8
|
+
platforms: [antigravity, claude-code, kilo-code, cursor, windsurf]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# API Integration Engineer
|
|
12
|
+
|
|
13
|
+
> **Language rule:**
|
|
14
|
+
> Use **English** for: type names, function names, file paths, API terms, HTTP concepts.
|
|
15
|
+
> Use **the user's language** for: explanations, questions, and summaries.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Trigger
|
|
20
|
+
|
|
21
|
+
Activate this skill when the user provides any of:
|
|
22
|
+
- `curl` command
|
|
23
|
+
- Swagger 2.0 / OpenAPI 3.0 (YAML or JSON)
|
|
24
|
+
- Postman collection or HAR file
|
|
25
|
+
- API documentation (endpoint, method, request/response)
|
|
26
|
+
- Code snippet to reverse-engineer (fetch/axios/custom client)
|
|
27
|
+
- Backend controller or route handler to mirror on the frontend
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Scope
|
|
32
|
+
|
|
33
|
+
- ✅ Parse and understand any API input format
|
|
34
|
+
- ✅ Extract the full API contract (request + response + errors)
|
|
35
|
+
- ✅ Detect existing project patterns (HTTP client, state layer, conventions)
|
|
36
|
+
- ✅ Generate typed service/client, hooks/queries, and TypeScript types
|
|
37
|
+
- ✅ Follow and extend existing architecture — never duplicate it
|
|
38
|
+
- ✅ Handle special cases: file upload, file download, pagination, auth, WebSocket
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Non-goals
|
|
43
|
+
|
|
44
|
+
- ❌ Do NOT create a new HTTP client if one already exists
|
|
45
|
+
- ❌ Do NOT introduce a new state system if one is already in use
|
|
46
|
+
- ❌ Do NOT write UI logic inside the API layer
|
|
47
|
+
- ❌ Do NOT hardcode URLs, tokens, or secrets
|
|
48
|
+
- ❌ Do NOT use `any` when types can be inferred
|
|
49
|
+
- ❌ Do NOT overwrite existing files without explicit user approval
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Severity Levels
|
|
54
|
+
|
|
55
|
+
| Level | Meaning |
|
|
56
|
+
|-------|---------|
|
|
57
|
+
| P0 | Conflict with existing endpoint or type — must resolve before generating |
|
|
58
|
+
| P1 | Missing critical info (auth, response schema) — ask before proceeding |
|
|
59
|
+
| P2 | Naming or structure inconsistency — warn and apply best guess |
|
|
60
|
+
| P3 | Missing optional fields — document assumption and proceed |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Workflow
|
|
65
|
+
|
|
66
|
+
### Phase 1 — Input Validation
|
|
67
|
+
|
|
68
|
+
Before parsing, verify:
|
|
69
|
+
- URL is valid and method is correct (GET/POST/PUT/PATCH/DELETE)
|
|
70
|
+
- Auth format is identifiable (Bearer, API Key, OAuth2, Basic, Cookie)
|
|
71
|
+
- Request info is present (path params, query params, body)
|
|
72
|
+
- Response structure is clear (JSON, binary, stream, paginated)
|
|
73
|
+
- Error cases are documented
|
|
74
|
+
|
|
75
|
+
If critical info is missing → **stop and ask**. Do not guess.
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"validation": {
|
|
80
|
+
"status": "VALID | INVALID | INCOMPLETE",
|
|
81
|
+
"confidence": 0.95,
|
|
82
|
+
"errors": [],
|
|
83
|
+
"warnings": [],
|
|
84
|
+
"input_type": "curl | openapi | postman | docs | code"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
### Phase 2 — API Contract Extraction
|
|
92
|
+
|
|
93
|
+
Extract the full contract:
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
metadata:
|
|
97
|
+
name, domain, endpoint, method, version, description
|
|
98
|
+
|
|
99
|
+
request:
|
|
100
|
+
pathParams: { name, type, required }
|
|
101
|
+
queryParams: { name, type, required, default }
|
|
102
|
+
headers: { name, value, required }
|
|
103
|
+
body: { contentType, schema { field, type, required, nullable } }
|
|
104
|
+
auth: { type, location, name }
|
|
105
|
+
|
|
106
|
+
response:
|
|
107
|
+
success: { statusCode, contentType, schema, pagination? }
|
|
108
|
+
errors: [ { statusCode, message, businessCode? } ]
|
|
109
|
+
|
|
110
|
+
special:
|
|
111
|
+
rateLimit, timeout, retryable, streaming
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Map each field: `type`, `required`, `nullable`, `enum`, `example`.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
### Phase 3 — Project Profile Detection
|
|
119
|
+
|
|
120
|
+
1. Check for `.api-config.json` at project root → use if present
|
|
121
|
+
2. Otherwise infer from:
|
|
122
|
+
- Framework: `package.json`, config files, imports
|
|
123
|
+
- HTTP client: existing axios instance, fetch wrapper, custom client
|
|
124
|
+
- State management: React Query, Redux, Zustand, Pinia, Apollo, Vuex
|
|
125
|
+
- Type system: `tsconfig.json`, JSDoc, plain JS
|
|
126
|
+
- Folder conventions: `services/`, `hooks/`, `api/`, `types/`, `adapters/`
|
|
127
|
+
- Naming: camelCase, PascalCase, snake_case, file patterns
|
|
128
|
+
3. Read 1-2 existing API files to capture exact patterns for imports, typing, error handling, naming
|
|
129
|
+
|
|
130
|
+
If project context is ambiguous → use conservative defaults and document all assumptions.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### Phase 4 — Conflict Detection
|
|
135
|
+
|
|
136
|
+
Before generating code, check for:
|
|
137
|
+
|
|
138
|
+
| Conflict | Action |
|
|
139
|
+
|----------|--------|
|
|
140
|
+
| `ENDPOINT_DUPLICATE` — endpoint already exists | Reuse if same, warn if different |
|
|
141
|
+
| `FUNCTION_DUPLICATE` — function name conflicts | Warn, propose new name |
|
|
142
|
+
| `TYPE_DUPLICATE` — type already defined | Extend or reuse existing |
|
|
143
|
+
| `LOGIC_OVERLAP` — logic exists in another service | Consolidate, don't duplicate |
|
|
144
|
+
| `IMPORT_CONFLICT` — import path conflicts | Resolve before generating |
|
|
145
|
+
|
|
146
|
+
**P0 conflict → stop, report, wait for user decision before proceeding.**
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### Phase 5 — Code Generation
|
|
151
|
+
|
|
152
|
+
Generate the minimum necessary set for the task:
|
|
153
|
+
|
|
154
|
+
#### TypeScript Types
|
|
155
|
+
```typescript
|
|
156
|
+
// Request types
|
|
157
|
+
export interface CreateUserRequest {
|
|
158
|
+
name: string;
|
|
159
|
+
email: string;
|
|
160
|
+
role?: UserRole;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Response types
|
|
164
|
+
export interface CreateUserResponse {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
email: string;
|
|
168
|
+
createdAt: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// Error types
|
|
172
|
+
export interface ApiError {
|
|
173
|
+
code: string;
|
|
174
|
+
message: string;
|
|
175
|
+
details?: Record<string, unknown>;
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
#### Service / API Layer
|
|
180
|
+
```typescript
|
|
181
|
+
// Thin layer: HTTP + mapping only. No UI, no business logic.
|
|
182
|
+
export const createUser = async (
|
|
183
|
+
data: CreateUserRequest
|
|
184
|
+
): Promise<CreateUserResponse> => {
|
|
185
|
+
const response = await apiClient.post<CreateUserResponse>('/users', data);
|
|
186
|
+
return response.data;
|
|
187
|
+
};
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### Hook / Query (if project uses React Query)
|
|
191
|
+
```typescript
|
|
192
|
+
export const useCreateUser = () => {
|
|
193
|
+
return useMutation<CreateUserResponse, ApiError, CreateUserRequest>({
|
|
194
|
+
mutationFn: createUser,
|
|
195
|
+
onSuccess: () => {
|
|
196
|
+
queryClient.invalidateQueries({ queryKey: ['users'] });
|
|
197
|
+
},
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**If project uses Redux** → follow existing slice/thunk pattern.
|
|
203
|
+
**If project uses Zustand** → follow existing store pattern.
|
|
204
|
+
**If project uses Pinia/Vuex** → follow existing composable/action pattern.
|
|
205
|
+
|
|
206
|
+
Do NOT mix patterns.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
### Phase 6 — Special Case Handling
|
|
211
|
+
|
|
212
|
+
#### File Upload (`multipart/form-data`)
|
|
213
|
+
```typescript
|
|
214
|
+
// Always use FormData — never send File object in JSON
|
|
215
|
+
const formData = new FormData();
|
|
216
|
+
formData.append('file', file);
|
|
217
|
+
formData.append('name', name);
|
|
218
|
+
await apiClient.post('/upload', formData, {
|
|
219
|
+
headers: { 'Content-Type': 'multipart/form-data' },
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
#### File Download (binary response)
|
|
224
|
+
```typescript
|
|
225
|
+
const response = await apiClient.get('/export', { responseType: 'blob' });
|
|
226
|
+
const url = URL.createObjectURL(response.data);
|
|
227
|
+
const a = document.createElement('a');
|
|
228
|
+
a.href = url;
|
|
229
|
+
a.download = filename;
|
|
230
|
+
a.click();
|
|
231
|
+
URL.revokeObjectURL(url);
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
#### Pagination
|
|
235
|
+
```typescript
|
|
236
|
+
interface PaginatedResponse<T> {
|
|
237
|
+
items: T[];
|
|
238
|
+
total: number;
|
|
239
|
+
page: number;
|
|
240
|
+
limit: number;
|
|
241
|
+
}
|
|
242
|
+
// Implement consistently with existing project pagination pattern
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Authentication
|
|
246
|
+
- Follow existing auth mechanism (interceptor, header injection, cookie)
|
|
247
|
+
- Never hardcode tokens or credentials
|
|
248
|
+
- Refresh token logic belongs in the existing interceptor
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
### Phase 7 — Quality Validation
|
|
253
|
+
|
|
254
|
+
Before marking as ready:
|
|
255
|
+
|
|
256
|
+
- [ ] TypeScript strict — compiles clean, no `any` without justification
|
|
257
|
+
- [ ] All functions/params have explicit types and return types
|
|
258
|
+
- [ ] No unused imports, no debug code
|
|
259
|
+
- [ ] Error handling complete (try/catch, `.catch`, fallback)
|
|
260
|
+
- [ ] No hardcoded URLs, tokens, or secrets — use env vars
|
|
261
|
+
- [ ] Naming matches project conventions
|
|
262
|
+
- [ ] Reuses existing HTTP client, interceptors, and query client
|
|
263
|
+
- [ ] JSDoc added for public API if project convention requires it
|
|
264
|
+
- [ ] React: dependency arrays correct, cleanup present, no race conditions
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Decision Tree
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
Is required info complete?
|
|
272
|
+
├── No → Ask for missing info (auth, response schema, base URL)
|
|
273
|
+
└── Yes → Check for conflicts
|
|
274
|
+
├── P0 conflict → Stop, report, wait for user decision
|
|
275
|
+
└── No P0 → Generate code following project patterns
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
```
|
|
279
|
+
Does project have existing HTTP client?
|
|
280
|
+
├── Yes → Extend it
|
|
281
|
+
└── No → Create minimal axios/fetch wrapper following project style
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
Does project use state management?
|
|
286
|
+
├── React Query → useMutation / useQuery pattern
|
|
287
|
+
├── Redux → slice + thunk / RTK Query
|
|
288
|
+
├── Zustand → store action
|
|
289
|
+
├── Pinia → action in store
|
|
290
|
+
└── None → Service function only
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Output Format
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
📋 API Contract
|
|
299
|
+
─────────────────────────────────────────────────
|
|
300
|
+
Name: [API name]
|
|
301
|
+
Endpoint: [METHOD /path]
|
|
302
|
+
Auth: [type]
|
|
303
|
+
Input: [brief description]
|
|
304
|
+
Output: [brief description]
|
|
305
|
+
|
|
306
|
+
🔍 Project Pattern Detected
|
|
307
|
+
─────────────────────────────────────────────────
|
|
308
|
+
HTTP client: [axios instance at src/lib/axios.ts]
|
|
309
|
+
State: [React Query]
|
|
310
|
+
Types path: [src/types/]
|
|
311
|
+
Service path: [src/services/]
|
|
312
|
+
Hook path: [src/hooks/]
|
|
313
|
+
|
|
314
|
+
⚠️ Assumptions
|
|
315
|
+
─────────────────────────────────────────────────
|
|
316
|
+
• [Assumption 1]
|
|
317
|
+
• [Assumption 2]
|
|
318
|
+
|
|
319
|
+
📁 Files Generated
|
|
320
|
+
─────────────────────────────────────────────────
|
|
321
|
+
[NEW] src/types/user.types.ts
|
|
322
|
+
[NEW] src/services/user.service.ts
|
|
323
|
+
[NEW] src/hooks/useCreateUser.ts
|
|
324
|
+
[EXTEND] src/services/index.ts
|
|
325
|
+
|
|
326
|
+
🔗 Next steps:
|
|
327
|
+
→ Import hook in your component
|
|
328
|
+
→ Add env var: VITE_API_BASE_URL
|
|
329
|
+
→ Test with: [example usage snippet]
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Validation Checklist
|
|
335
|
+
|
|
336
|
+
- [ ] All 7 phases completed
|
|
337
|
+
- [ ] Input validated — no missing critical fields
|
|
338
|
+
- [ ] Conflicts checked — none unresolved
|
|
339
|
+
- [ ] Types generated and strict
|
|
340
|
+
- [ ] Existing HTTP client reused
|
|
341
|
+
- [ ] Existing state pattern followed
|
|
342
|
+
- [ ] Special cases handled if applicable (upload, download, pagination, auth)
|
|
343
|
+
- [ ] No hardcoded secrets
|
|
344
|
+
- [ ] Output format produced with files listed
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Project Config Reference (`.api-config.json`)
|
|
349
|
+
|
|
350
|
+
```json
|
|
351
|
+
{
|
|
352
|
+
"framework": "React",
|
|
353
|
+
"httpClient": "axios",
|
|
354
|
+
"stateManagement": "react-query",
|
|
355
|
+
"typing": "typescript",
|
|
356
|
+
"conventions": {
|
|
357
|
+
"servicePath": "src/services/",
|
|
358
|
+
"typePath": "src/types/",
|
|
359
|
+
"hookPath": "src/hooks/",
|
|
360
|
+
"naming": "camelCase",
|
|
361
|
+
"fileNaming": "{name}.service.ts",
|
|
362
|
+
"typeFileNaming": "{Name}.types.ts",
|
|
363
|
+
"hookFileNaming": "use{Name}.ts"
|
|
364
|
+
},
|
|
365
|
+
"httpConfig": {
|
|
366
|
+
"baseURL": "process.env.VITE_API_URL",
|
|
367
|
+
"interceptor": "src/lib/axios.ts",
|
|
368
|
+
"authHeader": "Authorization",
|
|
369
|
+
"timeout": 30000
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
---
|
|
375
|
+
|
|
376
|
+
## Examples
|
|
377
|
+
|
|
378
|
+
See `examples/` folder.
|