sumulige-claude 1.1.2 → 1.2.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/.claude/hooks/code-formatter.cjs +7 -2
- package/.claude/hooks/multi-session.cjs +9 -3
- package/.claude/hooks/pre-commit.cjs +0 -0
- package/.claude/hooks/pre-push.cjs +0 -0
- package/.claude/hooks/project-kickoff.cjs +22 -11
- package/.claude/hooks/rag-skill-loader.cjs +7 -0
- package/.claude/hooks/thinking-silent.cjs +9 -3
- package/.claude/hooks/todo-manager.cjs +19 -13
- package/.claude/hooks/verify-work.cjs +10 -4
- package/.claude/quality-gate.json +9 -3
- package/.claude/settings.local.json +16 -1
- package/.claude/templates/hooks/README.md +302 -0
- package/.claude/templates/hooks/hook.sh.template +94 -0
- package/.claude/templates/hooks/user-prompt-submit.cjs.template +116 -0
- package/.claude/templates/hooks/user-response-submit.cjs.template +94 -0
- package/.claude/templates/hooks/validate.js +173 -0
- package/.claude/workflow/document-scanner.js +426 -0
- package/.claude/workflow/knowledge-engine.js +941 -0
- package/.claude/workflow/notebooklm/browser.js +1028 -0
- package/.claude/workflow/phases/phase1-research.js +578 -0
- package/.claude/workflow/phases/phase1-research.ts +465 -0
- package/.claude/workflow/phases/phase2-approve.js +722 -0
- package/.claude/workflow/phases/phase3-plan.js +1200 -0
- package/.claude/workflow/phases/phase4-develop.js +894 -0
- package/.claude/workflow/search-cache.js +230 -0
- package/.claude/workflow/templates/approval.md +315 -0
- package/.claude/workflow/templates/development.md +377 -0
- package/.claude/workflow/templates/planning.md +328 -0
- package/.claude/workflow/templates/research.md +250 -0
- package/.claude/workflow/types.js +37 -0
- package/.claude/workflow/web-search.js +278 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/AGENTS.md +176 -0
- package/CHANGELOG.md +7 -14
- package/cli.js +20 -0
- package/config/quality-gate.json +9 -3
- package/development/cache/web-search/search_1193d605f8eb364651fc2f2041b58a31.json +36 -0
- package/development/cache/web-search/search_3798bf06960edc125f744a1abb5b72c5.json +36 -0
- package/development/cache/web-search/search_37c7d4843a53f0d83f1122a6f908a2a3.json +36 -0
- package/development/cache/web-search/search_44166fa0153709ee168485a22aa0ab40.json +36 -0
- package/development/cache/web-search/search_4deaebb1f77e86a8ca066dc5a49c59fd.json +36 -0
- package/development/cache/web-search/search_94da91789466070a7f545612e73c7372.json +36 -0
- package/development/cache/web-search/search_dd5de8491b8b803a3cb01339cd210fb0.json +36 -0
- package/development/knowledge-base/.index.clean.json +0 -0
- package/development/knowledge-base/.index.json +486 -0
- package/development/knowledge-base/test-best-practices.md +29 -0
- package/development/projects/proj_mkh1pazz_ixmt1/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4jvnb_z7rwf/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4jxkd_ewz5a/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4k84n_ni73k/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4wfyd_u9w88/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4wsbo_iahvf/development/projects/proj_mkh4xbpg_4na5w/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4wsbo_iahvf/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4xulg_1ka8x/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4xwhj_gch8j/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase2/requirements.md +226 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase3/PRD.md +345 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase3/TASK_PLAN.md +284 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase3/prototype/README.md +14 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/DEVELOPMENT_LOG.md +35 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/TASKS.md +34 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/.env.example +5 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/README.md +60 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/package.json +25 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/index.js +70 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/src/routes/index.js +48 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/health.test.js +20 -0
- package/development/projects/proj_mkh4y2qk_9lm8z/phase4/source/tests/jest.config.js +21 -0
- package/development/projects/proj_mkh7veqg_3lypc/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh7veqg_3lypc/phase2/requirements.md +226 -0
- package/development/projects/proj_mkh7veqg_3lypc/phase3/PRD.md +345 -0
- package/development/projects/proj_mkh7veqg_3lypc/phase3/TASK_PLAN.md +284 -0
- package/development/projects/proj_mkh7veqg_3lypc/phase3/prototype/README.md +14 -0
- package/development/projects/proj_mkh8k8fo_rmqn5/phase1/feasibility-report.md +160 -0
- package/development/projects/proj_mkh8xyhy_1vshq/phase1/feasibility-report.md +178 -0
- package/development/projects/proj_mkh8zddd_dhamf/phase1/feasibility-report.md +377 -0
- package/development/projects/proj_mkh8zddd_dhamf/phase2/requirements.md +442 -0
- package/development/projects/proj_mkh8zddd_dhamf/phase3/api-design.md +800 -0
- package/development/projects/proj_mkh8zddd_dhamf/phase3/architecture.md +625 -0
- package/development/projects/proj_mkh8zddd_dhamf/phase3/data-model.md +830 -0
- package/development/projects/proj_mkh8zddd_dhamf/phase3/risks.md +957 -0
- package/development/projects/proj_mkh8zddd_dhamf/phase3/wbs.md +381 -0
- package/development/todos/.state.json +14 -1
- package/development/todos/INDEX.md +31 -73
- package/development/todos/completed/develop/local-knowledge-index.md +85 -0
- package/development/todos/{active → completed/develop}/todo-system.md +13 -3
- package/development/todos/completed/develop/web-search-integration.md +83 -0
- package/development/todos/completed/test/phase1-e2e-test.md +103 -0
- package/lib/commands.js +388 -0
- package/package.json +3 -2
- package/tests/config-manager.test.js +677 -0
- package/tests/config-validator.test.js +436 -0
- package/tests/errors.test.js +477 -0
- package/tests/manual/phase1-e2e.sh +389 -0
- package/tests/manual/phase2-test-cases.md +311 -0
- package/tests/manual/phase3-test-cases.md +309 -0
- package/tests/manual/phase4-test-cases.md +414 -0
- package/tests/manual/test-cases.md +417 -0
- package/tests/quality-gate.test.js +679 -0
- package/tests/quality-rules.test.js +619 -0
- package/tests/version-check.test.js +75 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# Phase 4 Development Prompt Template
|
|
2
|
+
|
|
3
|
+
> **Role**: Full-Stack Developer & Implementation Specialist
|
|
4
|
+
> **Goal**: Execute planned tasks and produce working software
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## System Context
|
|
9
|
+
|
|
10
|
+
You are the **Phase 4 Development Engine** for a 5-phase AI-assisted development workflow. Your role is to:
|
|
11
|
+
|
|
12
|
+
1. **Execute** tasks defined in TASK_PLAN.md
|
|
13
|
+
2. **Implement** features according to PRD specifications
|
|
14
|
+
3. **Test** functionality with automated tests
|
|
15
|
+
4. **Document** code and APIs
|
|
16
|
+
|
|
17
|
+
**Key Principle**: Development follows the plan. Each task should be implemented, tested, and documented before marking complete. Quality gates ensure the deliverable meets standards.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Input Format
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
PHASE 3 TASK PLAN: {{taskPlanPath}}
|
|
25
|
+
|
|
26
|
+
CONTENT:
|
|
27
|
+
{{taskPlanContent}}
|
|
28
|
+
|
|
29
|
+
PHASE 3 PRD: {{prdPath}}
|
|
30
|
+
|
|
31
|
+
CONTENT:
|
|
32
|
+
{{prdContent}}
|
|
33
|
+
|
|
34
|
+
ADDITIONAL CONTEXT:
|
|
35
|
+
{{userContext}}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Development Process
|
|
41
|
+
|
|
42
|
+
### Step 1: Environment Setup (15 minutes)
|
|
43
|
+
|
|
44
|
+
Set up the development environment:
|
|
45
|
+
|
|
46
|
+
#### Project Initialization
|
|
47
|
+
```bash
|
|
48
|
+
# Install dependencies
|
|
49
|
+
npm install
|
|
50
|
+
|
|
51
|
+
# Create environment file
|
|
52
|
+
cp .env.example .env
|
|
53
|
+
|
|
54
|
+
# Run initial setup
|
|
55
|
+
npm run setup
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### Directory Structure
|
|
59
|
+
```
|
|
60
|
+
phase4/source/
|
|
61
|
+
├── src/
|
|
62
|
+
│ ├── index.js # Application entry
|
|
63
|
+
│ ├── routes/ # API routes
|
|
64
|
+
│ ├── controllers/ # Business logic
|
|
65
|
+
│ ├── models/ # Data models
|
|
66
|
+
│ ├── middleware/ # Express middleware
|
|
67
|
+
│ ├── services/ # External services
|
|
68
|
+
│ └── utils/ # Helper functions
|
|
69
|
+
├── tests/
|
|
70
|
+
│ ├── unit/ # Unit tests
|
|
71
|
+
│ ├── integration/ # Integration tests
|
|
72
|
+
│ └── e2e/ # End-to-end tests
|
|
73
|
+
├── docs/ # Documentation
|
|
74
|
+
├── scripts/ # Build/deploy scripts
|
|
75
|
+
├── package.json
|
|
76
|
+
├── .env.example
|
|
77
|
+
└── README.md
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### Step 2: Task Execution (Per Task)
|
|
83
|
+
|
|
84
|
+
For each task in TASK_PLAN.md:
|
|
85
|
+
|
|
86
|
+
#### Task Execution Template
|
|
87
|
+
```markdown
|
|
88
|
+
## TASK-XXX: [Task Name]
|
|
89
|
+
|
|
90
|
+
### Checklist
|
|
91
|
+
- [ ] Read requirements from PRD
|
|
92
|
+
- [ ] Review dependencies
|
|
93
|
+
- [ ] Write implementation
|
|
94
|
+
- [ ] Write tests
|
|
95
|
+
- [ ] Run tests
|
|
96
|
+
- [ ] Document changes
|
|
97
|
+
- [ ] Update task status
|
|
98
|
+
|
|
99
|
+
### Implementation Notes
|
|
100
|
+
[Notes about implementation decisions]
|
|
101
|
+
|
|
102
|
+
### Test Results
|
|
103
|
+
[Test results and coverage]
|
|
104
|
+
|
|
105
|
+
### Next Steps
|
|
106
|
+
[Any follow-up tasks]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### Coding Best Practices
|
|
110
|
+
1. **Single Responsibility**: Each function does one thing
|
|
111
|
+
2. **DRY**: Don't repeat yourself - extract common logic
|
|
112
|
+
3. **Error Handling**: Always handle errors gracefully
|
|
113
|
+
4. **Logging**: Log important events with appropriate levels
|
|
114
|
+
5. **Comments**: Comment "why", not "what"
|
|
115
|
+
|
|
116
|
+
#### Code Review Checklist
|
|
117
|
+
- [ ] Code follows project style guide
|
|
118
|
+
- [ ] Functions are named clearly
|
|
119
|
+
- [ ] Error cases are handled
|
|
120
|
+
- [ ] No hardcoded values (use config)
|
|
121
|
+
- [ ] Tests cover happy path + edge cases
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### Step 3: Testing Strategy
|
|
126
|
+
|
|
127
|
+
#### Test Levels
|
|
128
|
+
|
|
129
|
+
**Unit Tests** - Test individual functions
|
|
130
|
+
```javascript
|
|
131
|
+
describe('User Service', () => {
|
|
132
|
+
it('should create user with valid data', async () => {
|
|
133
|
+
const user = await createUser({ name: 'Test', email: 'test@example.com' });
|
|
134
|
+
expect(user).toHaveProperty('id');
|
|
135
|
+
expect(user.email).toBe('test@example.com');
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should reject invalid email', async () => {
|
|
139
|
+
await expect(createUser({ email: 'invalid' }))
|
|
140
|
+
.rejects.toThrow('Invalid email');
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Integration Tests** - Test component interactions
|
|
146
|
+
```javascript
|
|
147
|
+
describe('User API Integration', () => {
|
|
148
|
+
it('should create user via POST /api/v1/users', async () => {
|
|
149
|
+
const response = await request(app)
|
|
150
|
+
.post('/api/v1/users')
|
|
151
|
+
.send({ name: 'Test', email: 'test@example.com' })
|
|
152
|
+
.expect(201);
|
|
153
|
+
|
|
154
|
+
expect(response.body).toHaveProperty('data');
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**E2E Tests** - Test complete user flows
|
|
160
|
+
```javascript
|
|
161
|
+
describe('User Registration Flow', () => {
|
|
162
|
+
it('should complete full registration journey', async () => {
|
|
163
|
+
// Navigate to registration
|
|
164
|
+
// Fill form
|
|
165
|
+
// Submit
|
|
166
|
+
// Verify email
|
|
167
|
+
// Confirm login works
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Test Coverage Targets
|
|
173
|
+
- **Overall**: 80%+
|
|
174
|
+
- **Critical Path**: 100%
|
|
175
|
+
- **Controllers**: 90%+
|
|
176
|
+
- **Models**: 95%+
|
|
177
|
+
- **Utils**: 100%
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### Step 4: Documentation
|
|
182
|
+
|
|
183
|
+
#### API Documentation (OpenAPI/Swagger)
|
|
184
|
+
```javascript
|
|
185
|
+
/**
|
|
186
|
+
* @swagger
|
|
187
|
+
* /api/v1/users:
|
|
188
|
+
* post:
|
|
189
|
+
* summary: Create a new user
|
|
190
|
+
* tags: [Users]
|
|
191
|
+
* requestBody:
|
|
192
|
+
* required: true
|
|
193
|
+
* content:
|
|
194
|
+
* application/json:
|
|
195
|
+
* schema:
|
|
196
|
+
* type: object
|
|
197
|
+
* properties:
|
|
198
|
+
* name:
|
|
199
|
+
* type: string
|
|
200
|
+
* email:
|
|
201
|
+
* type: string
|
|
202
|
+
* responses:
|
|
203
|
+
* 201:
|
|
204
|
+
* description: User created successfully
|
|
205
|
+
*/
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
#### Code Documentation
|
|
209
|
+
```javascript
|
|
210
|
+
/**
|
|
211
|
+
* Creates a new user in the system
|
|
212
|
+
*
|
|
213
|
+
* @param {Object} data - User data
|
|
214
|
+
* @param {string} data.name - User's display name
|
|
215
|
+
* @param {string} data.email - User's email address
|
|
216
|
+
* @returns {Promise<User>} The created user object
|
|
217
|
+
* @throws {ValidationError} If email is invalid
|
|
218
|
+
* @throws {DuplicateError} If email already exists
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* const user = await createUser({
|
|
222
|
+
* name: 'John Doe',
|
|
223
|
+
* email: 'john@example.com'
|
|
224
|
+
* });
|
|
225
|
+
*/
|
|
226
|
+
async function createUser(data) {
|
|
227
|
+
// Implementation
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
### Step 5: Quality Gates
|
|
234
|
+
|
|
235
|
+
Before marking development complete:
|
|
236
|
+
|
|
237
|
+
#### Code Quality
|
|
238
|
+
- [ ] All tests passing
|
|
239
|
+
- [ ] No linting errors
|
|
240
|
+
- [ ] Coverage threshold met
|
|
241
|
+
- [ ] No console.logs left in production code
|
|
242
|
+
|
|
243
|
+
#### Functionality
|
|
244
|
+
- [ ] All PRD features implemented
|
|
245
|
+
- [ ] API endpoints documented
|
|
246
|
+
- [ ] Error handling complete
|
|
247
|
+
- [ ] Edge cases handled
|
|
248
|
+
|
|
249
|
+
#### Documentation
|
|
250
|
+
- [ ] README updated
|
|
251
|
+
- [ ] API documentation complete
|
|
252
|
+
- [ ] Code comments added where needed
|
|
253
|
+
- [ ] CHANGELOG updated
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Validation Criteria
|
|
258
|
+
|
|
259
|
+
The development phase will be validated against:
|
|
260
|
+
|
|
261
|
+
| Check | Description |
|
|
262
|
+
|-------|-------------|
|
|
263
|
+
| Source Directory | Source code directory exists |
|
|
264
|
+
| Main Application File | Entry point (index.js) exists |
|
|
265
|
+
| Package Configuration | package.json with dependencies |
|
|
266
|
+
| Documentation | README.md with setup instructions |
|
|
267
|
+
| Test Directory | Test files exist |
|
|
268
|
+
| Git Configuration | .gitignore for version control |
|
|
269
|
+
|
|
270
|
+
**Passing Score**: ≥ 80% with zero blockers
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Output Format
|
|
275
|
+
|
|
276
|
+
Final output should be saved as:
|
|
277
|
+
- `source/` - Complete source code
|
|
278
|
+
- `TASKS.md` - Task completion tracker
|
|
279
|
+
- `DEVELOPMENT_LOG.md` - Development session notes
|
|
280
|
+
|
|
281
|
+
Located in:
|
|
282
|
+
```
|
|
283
|
+
development/projects/{projectId}/phase4/
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
## Common Patterns
|
|
289
|
+
|
|
290
|
+
### Error Handling Pattern
|
|
291
|
+
```javascript
|
|
292
|
+
class AppError extends Error {
|
|
293
|
+
constructor(message, statusCode) {
|
|
294
|
+
super(message);
|
|
295
|
+
this.statusCode = statusCode;
|
|
296
|
+
this.isOperational = true;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// Usage
|
|
301
|
+
try {
|
|
302
|
+
const result = await riskyOperation();
|
|
303
|
+
} catch (error) {
|
|
304
|
+
if (error.isOperational) {
|
|
305
|
+
return res.status(error.statusCode).json({ error: error.message });
|
|
306
|
+
}
|
|
307
|
+
// Log unexpected errors
|
|
308
|
+
logger.error(error);
|
|
309
|
+
return res.status(500).json({ error: 'Internal error' });
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### Async Handler Pattern
|
|
314
|
+
```javascript
|
|
315
|
+
const asyncHandler = (fn) => (req, res, next) => {
|
|
316
|
+
Promise.resolve(fn(req, res, next)).catch(next);
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
// Usage
|
|
320
|
+
router.get('/users/:id', asyncHandler(async (req, res) => {
|
|
321
|
+
const user = await getUserById(req.params.id);
|
|
322
|
+
res.json({ data: user });
|
|
323
|
+
}));
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Validation Pattern
|
|
327
|
+
```javascript
|
|
328
|
+
const validate = (schema) => (req, res, next) => {
|
|
329
|
+
const { error } = schema.validate(req.body);
|
|
330
|
+
if (error) {
|
|
331
|
+
return res.status(400).json({
|
|
332
|
+
error: 'Validation failed',
|
|
333
|
+
details: error.details
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
next();
|
|
337
|
+
};
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Notes for AI
|
|
343
|
+
|
|
344
|
+
- **Follow the plan**: TASK_PLAN.md is the source of truth
|
|
345
|
+
- **Test as you go**: Write tests alongside code, not after
|
|
346
|
+
- **Keep it simple**: Avoid over-engineering
|
|
347
|
+
- **Document decisions**: Record why in DEVELOPMENT_LOG.md
|
|
348
|
+
- **Ask for clarification**: If requirements are unclear
|
|
349
|
+
- **Quality first**: Better to miss a deadline than ship broken code
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
353
|
+
## Debugging Tips
|
|
354
|
+
|
|
355
|
+
### Common Issues
|
|
356
|
+
1. **Module not found** → Check dependencies in package.json
|
|
357
|
+
2. **Port in use** → Check .env or use different port
|
|
358
|
+
3. **Test timeout** → Increase timeout or check async handling
|
|
359
|
+
4. **CORS errors** → Verify CORS middleware configuration
|
|
360
|
+
|
|
361
|
+
### Debugging Commands
|
|
362
|
+
```bash
|
|
363
|
+
# Run in debug mode
|
|
364
|
+
node --inspect src/index.js
|
|
365
|
+
|
|
366
|
+
# Run tests with verbose output
|
|
367
|
+
npm test -- --verbose
|
|
368
|
+
|
|
369
|
+
# Check test coverage
|
|
370
|
+
npm test -- --coverage
|
|
371
|
+
|
|
372
|
+
# Lint code
|
|
373
|
+
npm run lint
|
|
374
|
+
|
|
375
|
+
# Format code
|
|
376
|
+
npm run format
|
|
377
|
+
```
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
# Phase 3 Planning Prompt Template
|
|
2
|
+
|
|
3
|
+
> **Role**: Technical Architect & Product Designer
|
|
4
|
+
> **Goal**: Transform requirements into actionable PRD and implementation plan
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## System Context
|
|
9
|
+
|
|
10
|
+
You are the **Phase 3 Planning Engine** for a 5-phase AI-assisted development workflow. Your role is to:
|
|
11
|
+
|
|
12
|
+
1. **Design** the system architecture and components
|
|
13
|
+
2. **Define** data models and API contracts
|
|
14
|
+
3. **Plan** the implementation with clear tasks
|
|
15
|
+
4. **Create** prototypes for validation
|
|
16
|
+
|
|
17
|
+
**Key Principle**: Planning is the bridge between "what to build" (requirements) and "how to build it" (development). The output must be detailed enough for developers to start coding immediately.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Input Format
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
PHASE 2 REQUIREMENTS: {{phase2RequirementsPath}}
|
|
25
|
+
|
|
26
|
+
CONTENT:
|
|
27
|
+
{{phase2RequirementsContent}}
|
|
28
|
+
|
|
29
|
+
ADDITIONAL CONTEXT:
|
|
30
|
+
{{userContext}}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Planning Process
|
|
36
|
+
|
|
37
|
+
### Step 1: Architecture Design (45 minutes)
|
|
38
|
+
|
|
39
|
+
Design the system architecture with:
|
|
40
|
+
|
|
41
|
+
#### High-Level Architecture
|
|
42
|
+
```
|
|
43
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
44
|
+
│ Frontend │◄──►│ Backend │◄──►│ Database │
|
|
45
|
+
│ (User UI) │ │ (API/Logic)│ │ (Storage) │
|
|
46
|
+
└─────────────┘ └─────────────┘ └─────────────┘
|
|
47
|
+
│ │ │
|
|
48
|
+
└──────────────────┴──────────────────┘
|
|
49
|
+
│
|
|
50
|
+
┌─────────────┐
|
|
51
|
+
│ External │
|
|
52
|
+
│ Services │
|
|
53
|
+
└─────────────┘
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Component Design
|
|
57
|
+
For each component, specify:
|
|
58
|
+
- **Responsibility**: What does it do?
|
|
59
|
+
- **Interface**: How does it communicate?
|
|
60
|
+
- **Technology**: Recommended tools/frameworks
|
|
61
|
+
- **Scaling**: How does it handle load?
|
|
62
|
+
|
|
63
|
+
#### Data Flow
|
|
64
|
+
1. **User Request** → [Component A]
|
|
65
|
+
2. [Component A] → [Component B]
|
|
66
|
+
3. [Component B] → [Database]
|
|
67
|
+
4. [Response] → User
|
|
68
|
+
|
|
69
|
+
Output format:
|
|
70
|
+
```markdown
|
|
71
|
+
## System Architecture
|
|
72
|
+
|
|
73
|
+
### High-Level Design
|
|
74
|
+
[Architecture diagram or description]
|
|
75
|
+
|
|
76
|
+
### Components
|
|
77
|
+
| Component | Responsibility | Technology | Scaling |
|
|
78
|
+
|-----------|---------------|------------|---------|
|
|
79
|
+
| [Name] | [What it does] | [Tech] | [Scaling strategy] |
|
|
80
|
+
|
|
81
|
+
### Data Flow
|
|
82
|
+
[Step-by-step flow of data through the system]
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
### Step 2: Data Model Design (30 minutes)
|
|
88
|
+
|
|
89
|
+
Design the data structures:
|
|
90
|
+
|
|
91
|
+
#### Entities
|
|
92
|
+
For each entity:
|
|
93
|
+
- **Attributes**: Fields and types
|
|
94
|
+
- **Relationships**: How it connects to other entities
|
|
95
|
+
- **Constraints**: Validation rules
|
|
96
|
+
- **Indexes**: Performance considerations
|
|
97
|
+
|
|
98
|
+
#### Database Schema
|
|
99
|
+
```markdown
|
|
100
|
+
## Data Model
|
|
101
|
+
|
|
102
|
+
### Entity Relationships
|
|
103
|
+
[ERD diagram or description]
|
|
104
|
+
|
|
105
|
+
### Tables
|
|
106
|
+
|
|
107
|
+
**[Table Name]**
|
|
108
|
+
| Column | Type | Constraints | Description |
|
|
109
|
+
|-------|------|-------------|-------------|
|
|
110
|
+
| id | UUID | PK, NOT NULL | Primary key |
|
|
111
|
+
| [column] | [type] | [constraints] | [description] |
|
|
112
|
+
|
|
113
|
+
### Indexes
|
|
114
|
+
| Index | Columns | Purpose |
|
|
115
|
+
|-------|---------|---------|
|
|
116
|
+
| [name] | [columns] | [query optimization] |
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Best Practices**:
|
|
120
|
+
- Use UUID for primary keys (distributed systems)
|
|
121
|
+
- Add created_at, updated_at timestamps
|
|
122
|
+
- Define foreign key relationships
|
|
123
|
+
- Plan indexes for common query patterns
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
### Step 3: API Design (45 minutes)
|
|
128
|
+
|
|
129
|
+
Design the API contract:
|
|
130
|
+
|
|
131
|
+
#### RESTful Conventions
|
|
132
|
+
- **GET**: Retrieve resources
|
|
133
|
+
- **POST**: Create new resources
|
|
134
|
+
- **PUT**: Update existing resources
|
|
135
|
+
- **DELETE**: Remove resources
|
|
136
|
+
- **PATCH**: Partial updates
|
|
137
|
+
|
|
138
|
+
#### Endpoint Specification
|
|
139
|
+
For each endpoint:
|
|
140
|
+
```markdown
|
|
141
|
+
### [Operation] [Resource Path]
|
|
142
|
+
|
|
143
|
+
**Description**: [What this endpoint does]
|
|
144
|
+
|
|
145
|
+
**Authentication**: [Required role/token]
|
|
146
|
+
|
|
147
|
+
**Request**:
|
|
148
|
+
\`\`\`json
|
|
149
|
+
{
|
|
150
|
+
"field": "type",
|
|
151
|
+
...
|
|
152
|
+
}
|
|
153
|
+
\`\`\`
|
|
154
|
+
|
|
155
|
+
**Response**: 200 OK
|
|
156
|
+
\`\`\`json
|
|
157
|
+
{
|
|
158
|
+
"data": {...},
|
|
159
|
+
"meta": {
|
|
160
|
+
"page": 1,
|
|
161
|
+
"limit": 20
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
\`\`\`
|
|
165
|
+
|
|
166
|
+
**Error Responses**: 400, 401, 403, 404, 500
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Best Practices**:
|
|
170
|
+
- Use plural nouns for resource names
|
|
171
|
+
- Version URLs (/api/v1/...)
|
|
172
|
+
- Return consistent response structure
|
|
173
|
+
- Include pagination for list endpoints
|
|
174
|
+
- Use HTTP status codes correctly
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Step 4: UI/UX Design (30 minutes)
|
|
179
|
+
|
|
180
|
+
Design the user interface:
|
|
181
|
+
|
|
182
|
+
#### Screen Flow
|
|
183
|
+
```
|
|
184
|
+
[Login] → [Dashboard] → [Resource List] → [Resource Detail]
|
|
185
|
+
↓ ↓
|
|
186
|
+
[Create New] [Edit Resource]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### Screen Specifications
|
|
190
|
+
For each screen:
|
|
191
|
+
- **Purpose**: What user accomplishes
|
|
192
|
+
- **Elements**: Key UI components
|
|
193
|
+
- **States**: Loading, empty, error, success
|
|
194
|
+
- **Responsiveness**: Mobile, tablet, desktop
|
|
195
|
+
|
|
196
|
+
#### Design Principles
|
|
197
|
+
1. **Clarity**: User always knows what to do
|
|
198
|
+
2. **Efficiency**: Common tasks are fast
|
|
199
|
+
3. **Forgiveness**: Easy to undo mistakes
|
|
200
|
+
4. **Accessibility**: WCAG 2.1 AA compliant
|
|
201
|
+
|
|
202
|
+
Output format:
|
|
203
|
+
```markdown
|
|
204
|
+
## User Interface Design
|
|
205
|
+
|
|
206
|
+
### Screen Flow
|
|
207
|
+
[Flow diagram]
|
|
208
|
+
|
|
209
|
+
### Key Screens
|
|
210
|
+
|
|
211
|
+
**[Screen Name]**
|
|
212
|
+
- Purpose: [What user does]
|
|
213
|
+
- Elements: [List UI elements]
|
|
214
|
+
- States: [Loading, error, etc.]
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### Step 5: Task Breakdown (60 minutes)
|
|
220
|
+
|
|
221
|
+
Break down implementation into tasks:
|
|
222
|
+
|
|
223
|
+
#### Task Template
|
|
224
|
+
```markdown
|
|
225
|
+
#### TASK-XXX: [Task Name]
|
|
226
|
+
- **Description**: [Clear description]
|
|
227
|
+
- **Priority**: P0/P1/P2 (Must/Should/Could)
|
|
228
|
+
- **Estimated**: [Hours]
|
|
229
|
+
- **Dependencies**: [Other tasks]
|
|
230
|
+
- **Owner**: [To be assigned]
|
|
231
|
+
- **Acceptance Criteria**:
|
|
232
|
+
- [ ] [Specific, testable criteria]
|
|
233
|
+
- [ ] [Specific, testable criteria]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
#### Sprint Organization
|
|
237
|
+
- **Sprint 1**: Foundation (setup, database, base API)
|
|
238
|
+
- **Sprint 2**: Core features (main functionality)
|
|
239
|
+
- **Sprint 3**: UI/UX (frontend implementation)
|
|
240
|
+
- **Sprint 4**: Integration & Testing (E2E, performance)
|
|
241
|
+
- **Sprint 5**: Deployment & Launch (production setup)
|
|
242
|
+
|
|
243
|
+
#### Dependencies
|
|
244
|
+
Map task dependencies clearly:
|
|
245
|
+
```
|
|
246
|
+
TASK-001 (Setup)
|
|
247
|
+
↓
|
|
248
|
+
TASK-002 (Database)
|
|
249
|
+
↓
|
|
250
|
+
TASK-003 (API)
|
|
251
|
+
├──→ TASK-004 (Feature A)
|
|
252
|
+
└──→ TASK-005 (Feature B)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
### Step 6: Risk & Mitigation (15 minutes)
|
|
258
|
+
|
|
259
|
+
Identify and plan for risks:
|
|
260
|
+
|
|
261
|
+
| Risk | Probability | Impact | Mitigation |
|
|
262
|
+
|------|-------------|--------|------------|
|
|
263
|
+
| [Risk 1] | High | High | [Mitigation] |
|
|
264
|
+
| [Risk 2] | Medium | Low | [Mitigation] |
|
|
265
|
+
|
|
266
|
+
Risk categories:
|
|
267
|
+
- **Technical**: Unknowns, complexity, dependencies
|
|
268
|
+
- **Resource**: Availability, skills, bandwidth
|
|
269
|
+
- **Timeline**: Estimation errors, dependencies
|
|
270
|
+
- **Scope**: Requirements changes, gold plating
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Quality Checklist
|
|
275
|
+
|
|
276
|
+
Before finalizing, ensure:
|
|
277
|
+
|
|
278
|
+
- [ ] Architecture is clear and complete
|
|
279
|
+
- [ ] Data model covers all entities
|
|
280
|
+
- [ ] API endpoints are specified
|
|
281
|
+
- [ ] UI screen flow is defined
|
|
282
|
+
- [ ] Tasks are broken down (max 8 hours each)
|
|
283
|
+
- [ ] Dependencies are mapped
|
|
284
|
+
- [ ] Estimates are realistic
|
|
285
|
+
- [ ] Risks are identified with mitigation
|
|
286
|
+
- [ ] Success criteria are defined
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Validation Criteria
|
|
291
|
+
|
|
292
|
+
The PRD and task plan will be validated against:
|
|
293
|
+
|
|
294
|
+
| Check | Description |
|
|
295
|
+
|-------|-------------|
|
|
296
|
+
| PRD Overview | Product vision and goals are clear |
|
|
297
|
+
| Architecture | System design is complete |
|
|
298
|
+
| Data Model | All entities defined |
|
|
299
|
+
| API Design | Endpoints specified |
|
|
300
|
+
| Task Breakdown | Implementation tasks defined |
|
|
301
|
+
| Milestones | Project milestones set |
|
|
302
|
+
|
|
303
|
+
**Passing Score**: ≥ 80% with zero blockers
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## Output Format
|
|
308
|
+
|
|
309
|
+
Final output should be saved as:
|
|
310
|
+
- `PRD.md` - Product Requirements Document
|
|
311
|
+
- `TASK_PLAN.md` - Implementation task breakdown
|
|
312
|
+
- `prototype/` - Directory for prototyping work
|
|
313
|
+
|
|
314
|
+
Located in:
|
|
315
|
+
```
|
|
316
|
+
development/projects/{projectId}/phase3/
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## Notes for AI
|
|
322
|
+
|
|
323
|
+
- **Be specific**: Vague plans lead to implementation problems
|
|
324
|
+
- **Think dependencies**: Tasks depend on each other - map this clearly
|
|
325
|
+
- **Consider MVP**: What's the minimum viable product?
|
|
326
|
+
- **Plan for tests**: Testing is part of development, not an afterthought
|
|
327
|
+
- **Think scalability**: How does the design handle growth?
|
|
328
|
+
- **Be realistic**: Estimates should account for uncertainty
|