telo3-ai 5.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/AI-CONTEXT.md +263 -0
- package/LICENSE +21 -0
- package/ONBOARDING-SKILL.md +728 -0
- package/README.md +801 -0
- package/SKILL-METADATA.json +237 -0
- package/SKILL.md +666 -0
- package/cli.js +84 -0
- package/index.js +65 -0
- package/package.json +97 -0
- package/references/accessibility-quality.md +278 -0
- package/references/ai-behavior.md +363 -0
- package/references/document-specification.md +425 -0
- package/references/legal-compliance.md +408 -0
- package/references/performance-quality.md +351 -0
- package/references/privacy-compliance.md +494 -0
- package/references/project-audit.md +468 -0
- package/references/security-quality.md +254 -0
- package/references/seo-quality.md +347 -0
- package/references/smart-skill-delegation.md +451 -0
- package/references/token-optimization.md +481 -0
- package/references/ui-quality.md +491 -0
- package/references/workflow.md +474 -0
- package/scripts/init-project-context.sh +139 -0
- package/scripts/validate-project-context.sh +164 -0
- package/templates/architecture.md +418 -0
- package/templates/design.md +654 -0
- package/templates/memory.md +368 -0
- package/templates/prd.md +320 -0
- package/templates/rules.md +619 -0
- package/templates/tasks.md +220 -0
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
# AI Coding Workflow
|
|
2
|
+
|
|
3
|
+
> Detailed workflow for AI agents working with the project context system.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Core Workflow: Read → Plan → Code → Update
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
11
|
+
│ USER REQUEST RECEIVED │
|
|
12
|
+
└──────────────────────┬──────────────────────────────────────┘
|
|
13
|
+
▼
|
|
14
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
15
|
+
│ STEP 1: READ PROJECT CONTEXT │
|
|
16
|
+
│ • prd.md → Requirements │
|
|
17
|
+
│ • architecture.md → System structure │
|
|
18
|
+
│ • rules.md → Engineering standards │
|
|
19
|
+
│ • design.md → Visual patterns │
|
|
20
|
+
│ • tasks.md → Planned work │
|
|
21
|
+
│ • memory.md → Current state │
|
|
22
|
+
└──────────────────────┬───────────────────────────────────────┘
|
|
23
|
+
▼
|
|
24
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
25
|
+
│ STEP 2: INSPECT ACTUAL CODE │
|
|
26
|
+
│ • Affected files and surrounding context │
|
|
27
|
+
│ • Existing patterns and abstractions │
|
|
28
|
+
│ • Related components │
|
|
29
|
+
└──────────────────────┬───────────────────────────────────────┘
|
|
30
|
+
▼
|
|
31
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
32
|
+
│ STEP 3: ANALYZE & PLAN │
|
|
33
|
+
│ • What is the goal? │
|
|
34
|
+
│ • Which files need to change? │
|
|
35
|
+
│ • What are the implications? │
|
|
36
|
+
│ • Does this align with architecture? │
|
|
37
|
+
│ • Does this follow rules? │
|
|
38
|
+
│ • Does this match design? │
|
|
39
|
+
│ • Security/privacy/performance/legal concerns? │
|
|
40
|
+
└──────────────────────┬───────────────────────────────────────┘
|
|
41
|
+
▼
|
|
42
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
43
|
+
│ STEP 4: IMPLEMENT │
|
|
44
|
+
│ • Follow existing patterns │
|
|
45
|
+
│ • Reuse existing abstractions │
|
|
46
|
+
│ • Stay scoped (no unrelated changes) │
|
|
47
|
+
│ • Maintain security, privacy, accessibility │
|
|
48
|
+
└──────────────────────┬───────────────────────────────────────┘
|
|
49
|
+
▼
|
|
50
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
51
|
+
│ STEP 5: VERIFY │
|
|
52
|
+
│ • Does it work? │
|
|
53
|
+
│ • Are there regressions? │
|
|
54
|
+
│ • Do tests pass? │
|
|
55
|
+
└──────────────────────┬───────────────────────────────────────┘
|
|
56
|
+
▼
|
|
57
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
58
|
+
│ STEP 6: UPDATE PROJECT CONTEXT │
|
|
59
|
+
│ • tasks.md → Mark complete, add new tasks │
|
|
60
|
+
│ • memory.md → Document decisions, state changes │
|
|
61
|
+
│ • Other docs → If architecture/rules/design changed │
|
|
62
|
+
└───────────────────────────────────────────────────────────────┘
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Step 1: Read Project Context
|
|
68
|
+
|
|
69
|
+
### What to Read
|
|
70
|
+
|
|
71
|
+
| Scenario | Read |
|
|
72
|
+
|----------|------|
|
|
73
|
+
| **New to project** | All six documents |
|
|
74
|
+
| **Adding feature** | prd.md, architecture.md, design.md, tasks.md, memory.md |
|
|
75
|
+
| **Fixing bug** | architecture.md, rules.md, memory.md, tasks.md |
|
|
76
|
+
| **Refactoring** | architecture.md, rules.md, memory.md |
|
|
77
|
+
| **UI work** | design.md, architecture.md, rules.md, memory.md |
|
|
78
|
+
| **Security/privacy** | rules.md, memory.md, architecture.md, prd.md |
|
|
79
|
+
|
|
80
|
+
### How to Read
|
|
81
|
+
|
|
82
|
+
1. **Skim first** to understand structure
|
|
83
|
+
2. **Deep read** relevant sections
|
|
84
|
+
3. **Note unknowns** — what's unclear or missing?
|
|
85
|
+
4. **Check for conflicts** — does documentation match your understanding?
|
|
86
|
+
|
|
87
|
+
### Red Flags
|
|
88
|
+
|
|
89
|
+
- 🚩 Documentation is vague or incomplete
|
|
90
|
+
- 🚩 Documentation conflicts with code
|
|
91
|
+
- 🚩 Important decisions are not documented
|
|
92
|
+
- 🚩 Security/privacy implications are unclear
|
|
93
|
+
|
|
94
|
+
**Action:** Ask user or inspect code to clarify before proceeding.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Step 2: Inspect Actual Code
|
|
99
|
+
|
|
100
|
+
### What to Inspect
|
|
101
|
+
|
|
102
|
+
1. **Target files** — Files that need to change
|
|
103
|
+
2. **Related files** — Components, utilities, types used by target files
|
|
104
|
+
3. **Pattern examples** — Similar features already implemented
|
|
105
|
+
4. **Tests** — Existing test patterns
|
|
106
|
+
5. **Configuration** — Build, environment, deployment configs
|
|
107
|
+
|
|
108
|
+
### Inspection Tools
|
|
109
|
+
|
|
110
|
+
- **Read files** — Understand current implementation
|
|
111
|
+
- **Search codebase** — Find patterns, similar features
|
|
112
|
+
- **Grep** — Find usage of functions, components, patterns
|
|
113
|
+
- **File tree** — Understand organization
|
|
114
|
+
|
|
115
|
+
### What to Look For
|
|
116
|
+
|
|
117
|
+
- ✅ Existing abstractions to reuse
|
|
118
|
+
- ✅ Established patterns to follow
|
|
119
|
+
- ✅ Naming conventions in use
|
|
120
|
+
- ✅ Error handling patterns
|
|
121
|
+
- ✅ Security boundaries
|
|
122
|
+
- ⚠️ Code smells or technical debt
|
|
123
|
+
- ⚠️ Inconsistencies with documentation
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Step 3: Analyze & Plan
|
|
128
|
+
|
|
129
|
+
### Key Questions
|
|
130
|
+
|
|
131
|
+
#### Product Alignment
|
|
132
|
+
- Does this request align with documented requirements? (prd.md)
|
|
133
|
+
- Is this in scope or a scope change?
|
|
134
|
+
- Who is the target user for this feature?
|
|
135
|
+
|
|
136
|
+
#### Technical Feasibility
|
|
137
|
+
- Is the current architecture suitable for this? (architecture.md)
|
|
138
|
+
- Are there technical constraints or limitations?
|
|
139
|
+
- What are the dependencies?
|
|
140
|
+
|
|
141
|
+
#### Engineering Standards
|
|
142
|
+
- What coding standards apply? (rules.md)
|
|
143
|
+
- What security measures are required?
|
|
144
|
+
- What accessibility requirements exist?
|
|
145
|
+
- What privacy implications exist?
|
|
146
|
+
|
|
147
|
+
#### Design Consistency
|
|
148
|
+
- What design patterns apply? (design.md)
|
|
149
|
+
- What components should be reused?
|
|
150
|
+
- Is this consistent with visual language?
|
|
151
|
+
|
|
152
|
+
#### Implementation Status
|
|
153
|
+
- Has this been started? (tasks.md)
|
|
154
|
+
- Are there related tasks in progress?
|
|
155
|
+
- Is there historical context? (memory.md)
|
|
156
|
+
|
|
157
|
+
### Planning Template
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
GOAL: [Clear statement of what needs to be done]
|
|
161
|
+
|
|
162
|
+
FILES TO CHANGE:
|
|
163
|
+
- [file1]: [what changes]
|
|
164
|
+
- [file2]: [what changes]
|
|
165
|
+
|
|
166
|
+
NEW FILES NEEDED:
|
|
167
|
+
- [file1]: [purpose]
|
|
168
|
+
|
|
169
|
+
APPROACH:
|
|
170
|
+
1. [Step 1]
|
|
171
|
+
2. [Step 2]
|
|
172
|
+
3. [Step 3]
|
|
173
|
+
|
|
174
|
+
CONSIDERATIONS:
|
|
175
|
+
- Security: [concerns]
|
|
176
|
+
- Privacy: [concerns]
|
|
177
|
+
- Performance: [concerns]
|
|
178
|
+
- Accessibility: [concerns]
|
|
179
|
+
|
|
180
|
+
RISKS:
|
|
181
|
+
- [Risk 1]: [mitigation]
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Step 4: Implement
|
|
187
|
+
|
|
188
|
+
### Implementation Principles
|
|
189
|
+
|
|
190
|
+
1. **Follow existing patterns** — Consistency over cleverness
|
|
191
|
+
2. **Reuse abstractions** — DRY (Don't Repeat Yourself)
|
|
192
|
+
3. **Stay scoped** — Change only what's necessary
|
|
193
|
+
4. **No surprises** — Follow documented architecture and rules
|
|
194
|
+
5. **Security first** — Validate input, protect secrets, check authorization
|
|
195
|
+
6. **Accessible by default** — Semantic HTML, keyboard navigation, ARIA
|
|
196
|
+
7. **Privacy-conscious** — Minimize data collection, document third-party sharing
|
|
197
|
+
8. **Performance-aware** — Optimize images, lazy load, minimize JavaScript
|
|
198
|
+
|
|
199
|
+
### Implementation Checklist
|
|
200
|
+
|
|
201
|
+
#### Before Writing Code
|
|
202
|
+
- [ ] I've read relevant project context
|
|
203
|
+
- [ ] I've inspected existing code
|
|
204
|
+
- [ ] I understand the goal
|
|
205
|
+
- [ ] I have a clear plan
|
|
206
|
+
|
|
207
|
+
#### While Writing Code
|
|
208
|
+
- [ ] Following existing patterns
|
|
209
|
+
- [ ] Reusing existing abstractions
|
|
210
|
+
- [ ] Not modifying unrelated code
|
|
211
|
+
- [ ] Validating user input
|
|
212
|
+
- [ ] Handling errors appropriately
|
|
213
|
+
- [ ] Adding accessibility attributes
|
|
214
|
+
- [ ] Optimizing for performance
|
|
215
|
+
- [ ] Protecting sensitive data
|
|
216
|
+
- [ ] Following design system
|
|
217
|
+
|
|
218
|
+
#### Code Quality
|
|
219
|
+
- [ ] Meaningful variable/function names
|
|
220
|
+
- [ ] Small, focused functions
|
|
221
|
+
- [ ] Appropriate comments (why, not what)
|
|
222
|
+
- [ ] No hardcoded secrets
|
|
223
|
+
- [ ] No hardcoded environment-specific values
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Step 5: Verify
|
|
228
|
+
|
|
229
|
+
### Verification Steps
|
|
230
|
+
|
|
231
|
+
1. **Functional verification**
|
|
232
|
+
- Does it work as intended?
|
|
233
|
+
- Does it handle edge cases?
|
|
234
|
+
- Does it handle errors gracefully?
|
|
235
|
+
|
|
236
|
+
2. **Regression check**
|
|
237
|
+
- Did I break existing functionality?
|
|
238
|
+
- Do related features still work?
|
|
239
|
+
|
|
240
|
+
3. **Run tests** (if available)
|
|
241
|
+
- Do unit tests pass?
|
|
242
|
+
- Do integration tests pass?
|
|
243
|
+
- Do E2E tests pass?
|
|
244
|
+
|
|
245
|
+
4. **Security check**
|
|
246
|
+
- Is user input validated?
|
|
247
|
+
- Are secrets protected?
|
|
248
|
+
- Is authorization enforced?
|
|
249
|
+
|
|
250
|
+
5. **Accessibility check**
|
|
251
|
+
- Is it keyboard accessible?
|
|
252
|
+
- Does it work with screen readers?
|
|
253
|
+
- Is color contrast sufficient?
|
|
254
|
+
|
|
255
|
+
6. **Privacy check**
|
|
256
|
+
- Is data collection documented?
|
|
257
|
+
- Are third-party requests justified?
|
|
258
|
+
- Is consent obtained where required?
|
|
259
|
+
|
|
260
|
+
7. **Performance check**
|
|
261
|
+
- Are images optimized?
|
|
262
|
+
- Is lazy loading implemented?
|
|
263
|
+
- Are there unnecessary re-renders?
|
|
264
|
+
|
|
265
|
+
### When Verification Fails
|
|
266
|
+
|
|
267
|
+
1. **Diagnose** the issue
|
|
268
|
+
2. **Fix** the problem
|
|
269
|
+
3. **Re-verify** thoroughly
|
|
270
|
+
4. **If stuck** after 2-3 attempts, try a different approach or ask user
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Step 6: Update Project Context
|
|
275
|
+
|
|
276
|
+
### When to Update
|
|
277
|
+
|
|
278
|
+
✅ **Always update:**
|
|
279
|
+
- tasks.md — Mark completed work
|
|
280
|
+
- memory.md — Document important decisions
|
|
281
|
+
|
|
282
|
+
✅ **Update if changed:**
|
|
283
|
+
- architecture.md — If architecture changed
|
|
284
|
+
- rules.md — If engineering standards changed
|
|
285
|
+
- design.md — If design patterns changed
|
|
286
|
+
- prd.md — If requirements changed
|
|
287
|
+
|
|
288
|
+
❌ **Don't update for:**
|
|
289
|
+
- Trivial changes
|
|
290
|
+
- Planned refactoring (already documented)
|
|
291
|
+
- Bug fixes that don't add context
|
|
292
|
+
|
|
293
|
+
### What to Update
|
|
294
|
+
|
|
295
|
+
#### tasks.md
|
|
296
|
+
```markdown
|
|
297
|
+
## Recently Completed
|
|
298
|
+
- [x] **Feature name** — Completed [Date]
|
|
299
|
+
- Brief summary of what was implemented
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### memory.md
|
|
303
|
+
```markdown
|
|
304
|
+
## Recent Work
|
|
305
|
+
- **[Date]:** Implemented [feature]
|
|
306
|
+
- Details: [Brief description]
|
|
307
|
+
- Decision: [Important decision made]
|
|
308
|
+
- Files changed: [Key files]
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### architecture.md (if architecture changed)
|
|
312
|
+
```markdown
|
|
313
|
+
## Architectural Decisions
|
|
314
|
+
### [Date]: [Decision Title]
|
|
315
|
+
**Decision:** [What changed]
|
|
316
|
+
**Rationale:** [Why]
|
|
317
|
+
**Status:** Accepted
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## Special Workflows
|
|
323
|
+
|
|
324
|
+
### Workflow: Adding a New Feature
|
|
325
|
+
|
|
326
|
+
1. **Check prd.md** — Is this in scope?
|
|
327
|
+
2. **Check tasks.md** — Is it already planned?
|
|
328
|
+
3. **Read architecture.md** — How does it fit?
|
|
329
|
+
4. **Read design.md** — What components/patterns apply?
|
|
330
|
+
5. **Read rules.md** — What standards apply?
|
|
331
|
+
6. **Implement** following existing patterns
|
|
332
|
+
7. **Verify** functionality and quality
|
|
333
|
+
8. **Update tasks.md** and **memory.md**
|
|
334
|
+
|
|
335
|
+
### Workflow: Fixing a Bug
|
|
336
|
+
|
|
337
|
+
1. **Check memory.md** — Is this a known bug?
|
|
338
|
+
2. **Read architecture.md** — Understand the system
|
|
339
|
+
3. **Inspect code** — Find the root cause
|
|
340
|
+
4. **Read rules.md** — Follow standards for the fix
|
|
341
|
+
5. **Implement** the fix
|
|
342
|
+
6. **Verify** the fix doesn't cause regressions
|
|
343
|
+
7. **Add tests** (if possible) to prevent regression
|
|
344
|
+
8. **Update tasks.md** (remove from bug list) and **memory.md**
|
|
345
|
+
|
|
346
|
+
### Workflow: Refactoring Code
|
|
347
|
+
|
|
348
|
+
1. **Check memory.md** — Are there known issues or technical debt?
|
|
349
|
+
2. **Read architecture.md** — Understand the intended structure
|
|
350
|
+
3. **Read rules.md** — Follow refactoring guidelines
|
|
351
|
+
4. **Ensure tests exist** before refactoring
|
|
352
|
+
5. **Refactor incrementally** — Small changes
|
|
353
|
+
6. **Verify after each change** — Tests still pass
|
|
354
|
+
7. **Update architecture.md** if structure changed significantly
|
|
355
|
+
8. **Update memory.md** — Document technical debt addressed
|
|
356
|
+
|
|
357
|
+
### Workflow: Security/Privacy Changes
|
|
358
|
+
|
|
359
|
+
1. **Read rules.md** — Security and privacy guidelines
|
|
360
|
+
2. **Read memory.md** — Existing security/privacy context
|
|
361
|
+
3. **Read architecture.md** — Security boundaries
|
|
362
|
+
4. **Read prd.md** — Privacy requirements
|
|
363
|
+
5. **Implement** with security/privacy best practices
|
|
364
|
+
6. **Verify** — Security check, privacy check
|
|
365
|
+
7. **Update memory.md** — Document security/privacy decisions
|
|
366
|
+
8. **Update rules.md** if new security patterns established
|
|
367
|
+
|
|
368
|
+
### Workflow: Handling Documentation Conflicts
|
|
369
|
+
|
|
370
|
+
**When documentation and code disagree:**
|
|
371
|
+
|
|
372
|
+
1. **Inspect actual implementation** — Code is truth for current state
|
|
373
|
+
2. **Identify discrepancy** — What's different and why?
|
|
374
|
+
3. **Determine which is correct:**
|
|
375
|
+
- If code is correct → Update documentation
|
|
376
|
+
- If documentation is correct → Ask user before changing code
|
|
377
|
+
- If neither is clear → Ask user
|
|
378
|
+
4. **Update** the incorrect source
|
|
379
|
+
5. **Document in memory.md** if it's an important change
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Quality Gates
|
|
384
|
+
|
|
385
|
+
### Before Marking Work Complete
|
|
386
|
+
|
|
387
|
+
- [ ] Functionality verified
|
|
388
|
+
- [ ] No regressions
|
|
389
|
+
- [ ] Tests pass (if applicable)
|
|
390
|
+
- [ ] Security checked
|
|
391
|
+
- [ ] Privacy checked
|
|
392
|
+
- [ ] Accessibility checked (if UI change)
|
|
393
|
+
- [ ] Performance checked (if applicable)
|
|
394
|
+
- [ ] Project context updated
|
|
395
|
+
- [ ] No secrets committed
|
|
396
|
+
- [ ] No unrelated changes
|
|
397
|
+
|
|
398
|
+
### Signs of High-Quality Work
|
|
399
|
+
|
|
400
|
+
✅ Follows existing patterns
|
|
401
|
+
✅ Reuses existing abstractions
|
|
402
|
+
✅ Clear, meaningful names
|
|
403
|
+
✅ Appropriate error handling
|
|
404
|
+
✅ Secure by default
|
|
405
|
+
✅ Accessible by default
|
|
406
|
+
✅ Well-documented decisions
|
|
407
|
+
✅ Updated project context
|
|
408
|
+
|
|
409
|
+
### Signs of Low-Quality Work
|
|
410
|
+
|
|
411
|
+
❌ Ignores existing patterns
|
|
412
|
+
❌ Duplicates existing code
|
|
413
|
+
❌ Modifies unrelated code
|
|
414
|
+
❌ Magic numbers and unclear names
|
|
415
|
+
❌ Missing error handling
|
|
416
|
+
❌ Security vulnerabilities
|
|
417
|
+
❌ Inaccessible UI
|
|
418
|
+
❌ Undocumented decisions
|
|
419
|
+
❌ Stale project context
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Common Mistakes to Avoid
|
|
424
|
+
|
|
425
|
+
### 1. Coding Before Understanding
|
|
426
|
+
❌ **Wrong:** Jump directly to writing code
|
|
427
|
+
✅ **Right:** Read context → Inspect code → Plan → Code
|
|
428
|
+
|
|
429
|
+
### 2. Inventing Requirements
|
|
430
|
+
❌ **Wrong:** Assume what the user wants
|
|
431
|
+
✅ **Right:** Check prd.md, ask if unclear
|
|
432
|
+
|
|
433
|
+
### 3. Ignoring Existing Patterns
|
|
434
|
+
❌ **Wrong:** Implement a feature your own way
|
|
435
|
+
✅ **Right:** Follow established patterns from codebase
|
|
436
|
+
|
|
437
|
+
### 4. Modifying Unrelated Code
|
|
438
|
+
❌ **Wrong:** Refactor unrelated code "while you're there"
|
|
439
|
+
✅ **Right:** Stay scoped to the current task
|
|
440
|
+
|
|
441
|
+
### 5. Forgetting to Update Context
|
|
442
|
+
❌ **Wrong:** Complete work without updating docs
|
|
443
|
+
✅ **Right:** Always update tasks.md and memory.md
|
|
444
|
+
|
|
445
|
+
### 6. Fabricating Information
|
|
446
|
+
❌ **Wrong:** Invent features, statistics, or compliance claims
|
|
447
|
+
✅ **Right:** Document only what exists or is planned
|
|
448
|
+
|
|
449
|
+
### 7. Storing Secrets
|
|
450
|
+
❌ **Wrong:** Add API keys to project context
|
|
451
|
+
✅ **Right:** Document that secrets are needed, not the secrets themselves
|
|
452
|
+
|
|
453
|
+
### 8. Ignoring Security/Privacy
|
|
454
|
+
❌ **Wrong:** Assume it's handled elsewhere
|
|
455
|
+
✅ **Right:** Proactively validate input, protect data, check permissions
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
## Summary
|
|
460
|
+
|
|
461
|
+
**The workflow is simple:**
|
|
462
|
+
|
|
463
|
+
1. **Read** project context
|
|
464
|
+
2. **Inspect** actual code
|
|
465
|
+
3. **Plan** the implementation
|
|
466
|
+
4. **Code** following patterns and standards
|
|
467
|
+
5. **Verify** quality and correctness
|
|
468
|
+
6. **Update** project context
|
|
469
|
+
|
|
470
|
+
**The goal is simple:**
|
|
471
|
+
|
|
472
|
+
**Understand before changing. Follow before innovating. Document after completing.**
|
|
473
|
+
|
|
474
|
+
This workflow transforms AI agents from code generators into effective engineering partners.
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Project Context System Initialization Script
|
|
5
|
+
#
|
|
6
|
+
# Safely initializes project context documents without overwriting existing files.
|
|
7
|
+
# Usage: ./init-project-context.sh [target-directory]
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
set -e # Exit on error
|
|
11
|
+
|
|
12
|
+
# Colors for output
|
|
13
|
+
GREEN='\033[0;32m'
|
|
14
|
+
YELLOW='\033[1;33m'
|
|
15
|
+
RED='\033[0;31m'
|
|
16
|
+
NC='\033[0m' # No Color
|
|
17
|
+
|
|
18
|
+
# Script directory (where this script is located)
|
|
19
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
20
|
+
PROJECT_CONTEXT_SYSTEM_DIR="$(dirname "$SCRIPT_DIR")"
|
|
21
|
+
|
|
22
|
+
# Target directory (where to create project context)
|
|
23
|
+
TARGET_DIR="${1:-.}"
|
|
24
|
+
TARGET_DIR="$(cd "$TARGET_DIR" && pwd)"
|
|
25
|
+
|
|
26
|
+
# Context directory options
|
|
27
|
+
CONTEXT_DIR_OPTIONS=(
|
|
28
|
+
"project-context"
|
|
29
|
+
"docs/project-context"
|
|
30
|
+
"."
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
echo "=================================="
|
|
34
|
+
echo "Project Context System Initializer"
|
|
35
|
+
echo "=================================="
|
|
36
|
+
echo ""
|
|
37
|
+
|
|
38
|
+
# Check if templates directory exists
|
|
39
|
+
if [ ! -d "$PROJECT_CONTEXT_SYSTEM_DIR/templates" ]; then
|
|
40
|
+
echo -e "${RED}Error: Templates directory not found at $PROJECT_CONTEXT_SYSTEM_DIR/templates${NC}"
|
|
41
|
+
exit 1
|
|
42
|
+
fi
|
|
43
|
+
|
|
44
|
+
# Determine context directory
|
|
45
|
+
CONTEXT_DIR=""
|
|
46
|
+
for dir in "${CONTEXT_DIR_OPTIONS[@]}"; do
|
|
47
|
+
if [ -f "$TARGET_DIR/$dir/prd.md" ] || [ -f "$TARGET_DIR/$dir/architecture.md" ]; then
|
|
48
|
+
CONTEXT_DIR="$TARGET_DIR/$dir"
|
|
49
|
+
echo -e "${GREEN}✓ Found existing context at: $dir${NC}"
|
|
50
|
+
break
|
|
51
|
+
fi
|
|
52
|
+
done
|
|
53
|
+
|
|
54
|
+
# If no existing context found, ask user where to create
|
|
55
|
+
if [ -z "$CONTEXT_DIR" ]; then
|
|
56
|
+
echo "Where should project context be created?"
|
|
57
|
+
echo "1) project-context (recommended - clean separation)"
|
|
58
|
+
echo "2) docs/project-context (integrated with documentation)"
|
|
59
|
+
echo "3) . (project root - minimal structure)"
|
|
60
|
+
read -p "Choose [1-3, default: 1]: " choice
|
|
61
|
+
|
|
62
|
+
case $choice in
|
|
63
|
+
2) CONTEXT_DIR="$TARGET_DIR/docs/project-context" ;;
|
|
64
|
+
3) CONTEXT_DIR="$TARGET_DIR" ;;
|
|
65
|
+
*) CONTEXT_DIR="$TARGET_DIR/project-context" ;;
|
|
66
|
+
esac
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
echo ""
|
|
70
|
+
echo "Target directory: $CONTEXT_DIR"
|
|
71
|
+
echo ""
|
|
72
|
+
|
|
73
|
+
# Create context directory if it doesn't exist
|
|
74
|
+
if [ ! -d "$CONTEXT_DIR" ]; then
|
|
75
|
+
echo -e "${YELLOW}Creating directory: $CONTEXT_DIR${NC}"
|
|
76
|
+
mkdir -p "$CONTEXT_DIR"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
# Template files to copy
|
|
80
|
+
TEMPLATES=(
|
|
81
|
+
"prd.md"
|
|
82
|
+
"architecture.md"
|
|
83
|
+
"rules.md"
|
|
84
|
+
"design.md"
|
|
85
|
+
"tasks.md"
|
|
86
|
+
"memory.md"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Copy templates
|
|
90
|
+
CREATED=0
|
|
91
|
+
SKIPPED=0
|
|
92
|
+
|
|
93
|
+
for template in "${TEMPLATES[@]}"; do
|
|
94
|
+
SOURCE="$PROJECT_CONTEXT_SYSTEM_DIR/templates/$template"
|
|
95
|
+
DEST="$CONTEXT_DIR/$template"
|
|
96
|
+
|
|
97
|
+
if [ -f "$DEST" ]; then
|
|
98
|
+
echo -e "${YELLOW}⊗ Skipped (exists): $template${NC}"
|
|
99
|
+
SKIPPED=$((SKIPPED + 1))
|
|
100
|
+
elif [ -f "$SOURCE" ]; then
|
|
101
|
+
cp "$SOURCE" "$DEST"
|
|
102
|
+
echo -e "${GREEN}✓ Created: $template${NC}"
|
|
103
|
+
CREATED=$((CREATED + 1))
|
|
104
|
+
else
|
|
105
|
+
echo -e "${RED}✗ Template not found: $template${NC}"
|
|
106
|
+
fi
|
|
107
|
+
done
|
|
108
|
+
|
|
109
|
+
echo ""
|
|
110
|
+
echo "=================================="
|
|
111
|
+
echo "Initialization Complete"
|
|
112
|
+
echo "=================================="
|
|
113
|
+
echo ""
|
|
114
|
+
echo -e "${GREEN}Created: $CREATED files${NC}"
|
|
115
|
+
echo -e "${YELLOW}Skipped: $SKIPPED files (already exist)${NC}"
|
|
116
|
+
echo ""
|
|
117
|
+
|
|
118
|
+
if [ $CREATED -gt 0 ]; then
|
|
119
|
+
echo "Next steps:"
|
|
120
|
+
echo "1. Review and customize the created files"
|
|
121
|
+
echo "2. Fill in project-specific information"
|
|
122
|
+
echo "3. Remove placeholder sections not needed"
|
|
123
|
+
echo "4. Tell your AI agent to use SKILL.md from project-context-system"
|
|
124
|
+
echo ""
|
|
125
|
+
echo "Example AI instruction:"
|
|
126
|
+
echo " 'Use the project-context-system skill. Read $CONTEXT_DIR before making changes.'"
|
|
127
|
+
echo ""
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
if [ $SKIPPED -gt 0 ]; then
|
|
131
|
+
echo -e "${YELLOW}Note: Existing files were preserved. To reinitialize, delete or rename them first.${NC}"
|
|
132
|
+
echo ""
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
echo "Validation:"
|
|
136
|
+
echo " Run: $SCRIPT_DIR/validate-project-context.sh"
|
|
137
|
+
echo ""
|
|
138
|
+
|
|
139
|
+
exit 0
|