ai-devkit 0.11.0 → 0.13.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 +49 -198
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/init.d.ts +2 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +124 -13
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/lint.d.ts +4 -0
- package/dist/commands/lint.d.ts.map +1 -0
- package/dist/commands/lint.js +53 -0
- package/dist/commands/lint.js.map +1 -0
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +40 -2
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +2 -1
- package/dist/commands/skill.js.map +1 -1
- package/dist/lib/InitTemplate.d.ts +13 -0
- package/dist/lib/InitTemplate.d.ts.map +1 -0
- package/dist/lib/InitTemplate.js +169 -0
- package/dist/lib/InitTemplate.js.map +1 -0
- package/dist/lib/SkillManager.d.ts.map +1 -1
- package/dist/lib/SkillManager.js +9 -0
- package/dist/lib/SkillManager.js.map +1 -1
- package/dist/services/lint/constants.d.ts +14 -0
- package/dist/services/lint/constants.d.ts.map +1 -0
- package/dist/services/lint/constants.js +17 -0
- package/dist/services/lint/constants.js.map +1 -0
- package/dist/services/lint/lint.service.d.ts +6 -0
- package/dist/services/lint/lint.service.d.ts.map +1 -0
- package/dist/services/lint/lint.service.js +100 -0
- package/dist/services/lint/lint.service.js.map +1 -0
- package/dist/services/lint/rules/base-docs.rule.d.ts +3 -0
- package/dist/services/lint/rules/base-docs.rule.d.ts.map +1 -0
- package/dist/services/lint/rules/base-docs.rule.js +17 -0
- package/dist/services/lint/rules/base-docs.rule.js.map +1 -0
- package/dist/services/lint/rules/check-factories.d.ts +5 -0
- package/dist/services/lint/rules/check-factories.d.ts.map +1 -0
- package/dist/services/lint/rules/check-factories.js +36 -0
- package/dist/services/lint/rules/check-factories.js.map +1 -0
- package/dist/services/lint/rules/feature-docs.rule.d.ts +3 -0
- package/dist/services/lint/rules/feature-docs.rule.d.ts.map +1 -0
- package/dist/services/lint/rules/feature-docs.rule.js +16 -0
- package/dist/services/lint/rules/feature-docs.rule.js.map +1 -0
- package/dist/services/lint/rules/feature-name.rule.d.ts +7 -0
- package/dist/services/lint/rules/feature-name.rule.d.ts.map +1 -0
- package/dist/services/lint/rules/feature-name.rule.js +26 -0
- package/dist/services/lint/rules/feature-name.rule.js.map +1 -0
- package/dist/services/lint/rules/git-worktree.rule.d.ts +3 -0
- package/dist/services/lint/rules/git-worktree.rule.d.ts.map +1 -0
- package/dist/services/lint/rules/git-worktree.rule.js +26 -0
- package/dist/services/lint/rules/git-worktree.rule.js.map +1 -0
- package/dist/services/lint/rules/phase-docs.rule.d.ts +13 -0
- package/dist/services/lint/rules/phase-docs.rule.d.ts.map +1 -0
- package/dist/services/lint/rules/phase-docs.rule.js +54 -0
- package/dist/services/lint/rules/phase-docs.rule.js.map +1 -0
- package/dist/services/lint/types.d.ts +39 -0
- package/dist/services/lint/types.d.ts.map +1 -0
- package/dist/services/lint/types.js +3 -0
- package/dist/services/lint/types.js.map +1 -0
- package/dist/templates/commands/capture-knowledge.md +7 -45
- package/dist/templates/commands/check-implementation.md +4 -19
- package/dist/templates/commands/code-review.md +7 -81
- package/dist/templates/commands/debug.md +7 -45
- package/dist/templates/commands/execute-plan.md +6 -70
- package/dist/templates/commands/new-requirement.md +15 -128
- package/dist/templates/commands/remember.md +4 -21
- package/dist/templates/commands/review-design.md +1 -2
- package/dist/templates/commands/review-requirements.md +2 -3
- package/dist/templates/commands/simplify-implementation.md +6 -144
- package/dist/templates/commands/update-planning.md +6 -61
- package/dist/templates/commands/writing-test.md +6 -42
- package/dist/templates/templates/commands/capture-knowledge.md +7 -45
- package/dist/templates/templates/commands/check-implementation.md +4 -19
- package/dist/templates/templates/commands/code-review.md +7 -81
- package/dist/templates/templates/commands/debug.md +7 -45
- package/dist/templates/templates/commands/execute-plan.md +6 -70
- package/dist/templates/templates/commands/new-requirement.md +15 -128
- package/dist/templates/templates/commands/remember.md +4 -21
- package/dist/templates/templates/commands/review-design.md +1 -2
- package/dist/templates/templates/commands/review-requirements.md +2 -3
- package/dist/templates/templates/commands/simplify-implementation.md +6 -144
- package/dist/templates/templates/commands/update-planning.md +6 -61
- package/dist/templates/templates/commands/writing-test.md +6 -42
- package/dist/util/env.js +1 -1
- package/dist/util/env.js.map +1 -1
- package/dist/util/git.d.ts +8 -0
- package/dist/util/git.d.ts.map +1 -1
- package/dist/util/git.js +69 -0
- package/dist/util/git.js.map +1 -1
- package/dist/util/text.d.ts +2 -0
- package/dist/util/text.d.ts.map +1 -0
- package/dist/util/text.js +16 -0
- package/dist/util/text.js.map +1 -0
- package/package.json +2 -2
- package/templates/commands/capture-knowledge.md +7 -45
- package/templates/commands/check-implementation.md +4 -19
- package/templates/commands/code-review.md +7 -81
- package/templates/commands/debug.md +7 -45
- package/templates/commands/execute-plan.md +6 -70
- package/templates/commands/new-requirement.md +15 -128
- package/templates/commands/remember.md +4 -21
- package/templates/commands/review-design.md +1 -2
- package/templates/commands/review-requirements.md +2 -3
- package/templates/commands/simplify-implementation.md +6 -144
- package/templates/commands/update-planning.md +6 -61
- package/templates/commands/writing-test.md +6 -42
|
@@ -1,75 +1,11 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Execute a feature plan
|
|
2
|
+
description: Execute a feature plan task by task.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Feature Plan Execution Assistant
|
|
6
|
-
|
|
7
5
|
Help me work through a feature plan one task at a time.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
- Any supporting design/implementation docs (design, requirements, implementation)
|
|
15
|
-
- Current branch and latest diff summary (`git status -sb`, `git diff --stat`)
|
|
16
|
-
|
|
17
|
-
## Step 2: Load the Plan
|
|
18
|
-
- Request the planning doc contents or offer commands like:
|
|
19
|
-
```bash
|
|
20
|
-
cat docs/ai/planning/feature-<name>.md
|
|
21
|
-
```
|
|
22
|
-
- Parse sections that represent task lists (look for headings + checkboxes `[ ]`, `[x]`).
|
|
23
|
-
- Build an ordered queue of tasks grouped by section (e.g., Foundation, Core Features, Testing).
|
|
24
|
-
|
|
25
|
-
## Step 3: Present Task Queue
|
|
26
|
-
Show an overview:
|
|
27
|
-
```
|
|
28
|
-
### Task Queue: <Feature Name>
|
|
29
|
-
1. [status] Section • Task title
|
|
30
|
-
2. ...
|
|
31
|
-
```
|
|
32
|
-
Status legend: `todo`, `in-progress`, `done`, `blocked` (based on checkbox/notes if present).
|
|
33
|
-
|
|
34
|
-
## Step 4: Interactive Task Execution
|
|
35
|
-
For each task in order:
|
|
36
|
-
1. Display the section/context, full bullet text, and any existing notes.
|
|
37
|
-
2. Suggest relevant docs to reference (requirements/design/implementation).
|
|
38
|
-
3. Ask: "Plan for this task?" Offer to outline sub-steps using the design doc.
|
|
39
|
-
4. Prompt to mark status (`done`, `in-progress`, `blocked`, `skipped`) and capture short notes/next steps.
|
|
40
|
-
5. Encourage code/document edits inside Cursor; offer commands/snippets when useful.
|
|
41
|
-
6. If blocked, record blocker info and move task to the end or into a "Blocked" list.
|
|
42
|
-
|
|
43
|
-
## Step 5: Update Planning Doc
|
|
44
|
-
After each status change, generate a Markdown snippet the user can paste back into the planning doc, e.g.:
|
|
45
|
-
```
|
|
46
|
-
- [x] Task: Implement auth service (Notes: finished POST /auth/login, tests added)
|
|
47
|
-
```
|
|
48
|
-
Remind the user to keep the source doc updated.
|
|
49
|
-
|
|
50
|
-
## Step 6: Check for Newly Discovered Work
|
|
51
|
-
After each section, ask if new tasks were discovered. If yes, capture them in a "New Work" list with status `todo` and include in the summary.
|
|
52
|
-
|
|
53
|
-
## Step 7: Session Summary
|
|
54
|
-
Produce a summary table:
|
|
55
|
-
```
|
|
56
|
-
### Execution Summary
|
|
57
|
-
- Completed: (list)
|
|
58
|
-
- In Progress: (list + owners/next steps)
|
|
59
|
-
- Blocked: (list + blockers)
|
|
60
|
-
- Skipped / Deferred: (list + rationale)
|
|
61
|
-
- New Tasks: (list)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Step 8: Next Actions
|
|
65
|
-
Remind the user to:
|
|
66
|
-
- Update `docs/ai/planning/feature-{name}.md` with the new statuses
|
|
67
|
-
- Sync related docs (requirements/design/implementation/testing) if decisions changed
|
|
68
|
-
- Run `/check-implementation` to validate changes against design docs
|
|
69
|
-
- Run `/writing-test` to produce unit/integration tests targeting 100% coverage
|
|
70
|
-
- Run `/update-planning` to reconcile the planning doc with the latest status
|
|
71
|
-
- Run `/code-review` when ready for final review
|
|
72
|
-
- Run test suites relevant to completed tasks
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
Let me know when you're ready to start executing the plan. Provide the feature name and planning doc first.
|
|
7
|
+
1. **Gather Context** — If not already provided, ask for: feature name (kebab-case, e.g., `user-authentication`), brief feature/branch description, planning doc path (default `docs/ai/planning/feature-{name}.md`), and any supporting docs (design, requirements, implementation).
|
|
8
|
+
2. **Load & Present Plan** — Read the planning doc and parse task lists (headings + checkboxes). Present an ordered task queue grouped by section, with status: `todo`, `in-progress`, `done`, `blocked`.
|
|
9
|
+
3. **Interactive Task Execution** — For each task in order: display context and full bullet text, reference relevant design/requirements docs, offer to outline sub-steps before starting, prompt for status update (`done`, `in-progress`, `blocked`, `skipped`) with short notes after work, and if blocked record blocker and move to a "Blocked" list.
|
|
10
|
+
4. **Update Planning Doc** — After each status change, generate a markdown snippet to paste back into the planning doc. After each section, ask if new tasks were discovered.
|
|
11
|
+
5. **Session Summary** — Produce a summary: Completed, In Progress (with next steps), Blocked (with blockers), Skipped/Deferred, and New Tasks. Remind to update `docs/ai/planning/feature-{name}.md` and sync related docs if decisions changed.
|
|
@@ -1,131 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Scaffold feature documentation from requirements through planning.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- Start from `docs/ai/implementation/README.md` → save as `docs/ai/implementation/feature-{name}.md`
|
|
20
|
-
- Start from `docs/ai/testing/README.md` → save as `docs/ai/testing/feature-{name}.md`
|
|
21
|
-
|
|
22
|
-
Ensure the YAML frontmatter and section headings remain identical to the templates before filling in feature-specific content.
|
|
23
|
-
|
|
24
|
-
## Step 3: Requirements Phase
|
|
25
|
-
Help me fill out `docs/ai/requirements/feature-{name}.md`:
|
|
26
|
-
- Clarify the problem statement
|
|
27
|
-
- Define goals and non-goals
|
|
28
|
-
- Write detailed user stories
|
|
29
|
-
- Establish success criteria
|
|
30
|
-
- Identify constraints and assumptions
|
|
31
|
-
- List open questions
|
|
32
|
-
|
|
33
|
-
## Step 4: Design Phase
|
|
34
|
-
Guide me through `docs/ai/design/feature-{name}.md`:
|
|
35
|
-
- Propose system architecture changes needed
|
|
36
|
-
- Define data models/schema changes
|
|
37
|
-
- Design API endpoints or interfaces
|
|
38
|
-
- Identify components to create/modify
|
|
39
|
-
- Document key design decisions
|
|
40
|
-
- Note security and performance considerations
|
|
41
|
-
|
|
42
|
-
## Step 5: Planning Phase
|
|
43
|
-
Help me break down work in `docs/ai/planning/feature-{name}.md`:
|
|
44
|
-
- Create task breakdown with subtasks
|
|
45
|
-
- Identify dependencies (on other features, APIs, etc.)
|
|
46
|
-
- Estimate effort for each task
|
|
47
|
-
- Suggest implementation order
|
|
48
|
-
- Identify risks and mitigation strategies
|
|
49
|
-
|
|
50
|
-
## Step 6: Documentation Review (Chained Commands)
|
|
51
|
-
Once the docs above are drafted, run the following commands to tighten them up:
|
|
52
|
-
- `/review-requirements` to validate the requirements doc for completeness and clarity
|
|
53
|
-
- `/review-design` to ensure the design doc aligns with requirements and highlights key decisions
|
|
54
|
-
|
|
55
|
-
(If you are using Claude Code, reference the `review-requirements` and `review-design` commands instead.)
|
|
56
|
-
|
|
57
|
-
## Step 7: Implementation Phase (Deferred)
|
|
58
|
-
This command focuses on documentation only. Actual implementation happens later via `/execute-plan`.
|
|
59
|
-
For each task in the plan:
|
|
60
|
-
1. Review the task requirements and design
|
|
61
|
-
2. Ask me to confirm I'm starting this task
|
|
62
|
-
3. Guide implementation with reference to design docs
|
|
63
|
-
4. Suggest code structure and patterns
|
|
64
|
-
5. Help with error handling and edge cases
|
|
65
|
-
6. Update `docs/ai/implementation/feature-{name}.md` with notes
|
|
66
|
-
|
|
67
|
-
## Step 8: Testing Phase
|
|
68
|
-
Guide testing in `docs/ai/testing/feature-{name}.md`:
|
|
69
|
-
- Draft unit test cases with `/writing-test`
|
|
70
|
-
- Draft integration test scenarios with `/writing-test`
|
|
71
|
-
- Recommend manual testing steps
|
|
72
|
-
- Help write test code
|
|
73
|
-
- Verify all success criteria are testable
|
|
74
|
-
|
|
75
|
-
## Step 9: Local Testing & Verification
|
|
76
|
-
Guide me through:
|
|
77
|
-
1. Running all tests locally
|
|
78
|
-
2. Manual testing checklist
|
|
79
|
-
3. Reviewing against requirements
|
|
80
|
-
4. Checking design compliance
|
|
81
|
-
5. Preparing for code review (diff summary, list of files, design references)
|
|
82
|
-
|
|
83
|
-
## Step 10: Local Code Review (Optional but recommended)
|
|
84
|
-
Before pushing, ask me to run `/code-review` with the modified file list and relevant docs.
|
|
85
|
-
|
|
86
|
-
## Step 11: Implementation Execution Reminder
|
|
87
|
-
When ready to implement, run `/execute-plan` to work through the planning doc tasks interactively. That command will orchestrate implementation, testing, and follow-up documentation.
|
|
88
|
-
|
|
89
|
-
## Step 12: Create Merge/Pull Request
|
|
90
|
-
Provide the MR/PR description:
|
|
91
|
-
```markdown
|
|
92
|
-
## Feature: [Feature Name]
|
|
93
|
-
|
|
94
|
-
### Summary
|
|
95
|
-
[Brief description of what this feature does]
|
|
96
|
-
|
|
97
|
-
### Requirements
|
|
98
|
-
- Documented in: `docs/ai/requirements/feature-{name}.md`
|
|
99
|
-
- Related to: [issue/ticket number if applicable]
|
|
100
|
-
|
|
101
|
-
### Changes
|
|
102
|
-
- [List key changes]
|
|
103
|
-
- [List new files/components]
|
|
104
|
-
- [List modified files]
|
|
105
|
-
|
|
106
|
-
### Design
|
|
107
|
-
- Architecture: [Link to design doc section]
|
|
108
|
-
- Key decisions: [Brief summary]
|
|
109
|
-
|
|
110
|
-
### Testing
|
|
111
|
-
- Unit tests: [coverage/status]
|
|
112
|
-
- Integration tests: [status]
|
|
113
|
-
- Manual testing: Completed
|
|
114
|
-
- Test documentation: `docs/ai/testing/feature-{name}.md`
|
|
115
|
-
|
|
116
|
-
### Checklist
|
|
117
|
-
- [ ] Code follows project standards
|
|
118
|
-
- [ ] All tests pass
|
|
119
|
-
- [ ] Documentation updated
|
|
120
|
-
- [ ] No breaking changes (or documented if any)
|
|
121
|
-
- [ ] Ready for review
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Then provide the appropriate command:
|
|
125
|
-
- **GitHub**: `gh pr create --title "feat: [feature-name]" --body-file pr-description.md`
|
|
126
|
-
- **GitLab**: `glab mr create --title "feat: [feature-name]" --description "$(cat mr-description.md)"`
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
**Let's start! Tell me about the feature you want to build.**
|
|
131
|
-
|
|
5
|
+
Guide me through adding a new feature, from requirements documentation to implementation readiness.
|
|
6
|
+
|
|
7
|
+
1. **Capture Requirement** — If not already provided, ask for: feature name (kebab-case, e.g., `user-authentication`), what problem it solves and who will use it, and key user stories.
|
|
8
|
+
2. **Create Feature Documentation Structure** — Copy each template's content (preserving YAML frontmatter and section headings) into feature-specific files:
|
|
9
|
+
- `docs/ai/requirements/README.md` → `docs/ai/requirements/feature-{name}.md`
|
|
10
|
+
- `docs/ai/design/README.md` → `docs/ai/design/feature-{name}.md`
|
|
11
|
+
- `docs/ai/planning/README.md` → `docs/ai/planning/feature-{name}.md`
|
|
12
|
+
- `docs/ai/implementation/README.md` → `docs/ai/implementation/feature-{name}.md`
|
|
13
|
+
- `docs/ai/testing/README.md` → `docs/ai/testing/feature-{name}.md`
|
|
14
|
+
3. **Requirements Phase** — Fill out `docs/ai/requirements/feature-{name}.md`: problem statement, goals/non-goals, user stories, success criteria, constraints, open questions.
|
|
15
|
+
4. **Design Phase** — Fill out `docs/ai/design/feature-{name}.md`: architecture changes, data models, API/interfaces, components, design decisions, security and performance considerations.
|
|
16
|
+
5. **Planning Phase** — Fill out `docs/ai/planning/feature-{name}.md`: task breakdown with subtasks, dependencies, effort estimates, implementation order, risks.
|
|
17
|
+
6. **Documentation Review** — Run `/review-requirements` and `/review-design` to validate the drafted docs.
|
|
18
|
+
7. **Next Steps** — This command focuses on documentation. When ready to implement, use `/execute-plan`. Generate a PR description covering: summary, requirements doc link, key changes, test status, and a readiness checklist.
|
|
@@ -2,26 +2,9 @@
|
|
|
2
2
|
description: Store reusable guidance in the knowledge memory service.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Remember Knowledge
|
|
6
|
-
|
|
7
5
|
When I say "remember this" or want to save a reusable rule, help me store it in the knowledge memory service.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- Optional tags (keywords like "api", "testing")
|
|
14
|
-
- Optional scope (`global`, `project:<name>`, `repo:<name>`)
|
|
15
|
-
|
|
16
|
-
If I'm vague, ask follow-ups to make it specific and actionable.
|
|
17
|
-
|
|
18
|
-
## Step 2: Validate Quality
|
|
19
|
-
- Ensure it is specific and reusable (not generic advice).
|
|
20
|
-
- Avoid storing secrets or sensitive data.
|
|
21
|
-
|
|
22
|
-
## Step 3: Store
|
|
23
|
-
Call `memory.storeKnowledge` with title, content, tags, scope.
|
|
24
|
-
If MCP tools are unavailable, use `npx ai-devkit memory store` instead.
|
|
25
|
-
|
|
26
|
-
## Step 4: Confirm
|
|
27
|
-
Summarize what was saved and offer to store more knowledge if needed.
|
|
7
|
+
1. **Capture Knowledge** — If not already provided, ask for: a short explicit title (5-12 words), detailed content (markdown, examples encouraged), optional tags (keywords like "api", "testing"), and optional scope (`global`, `project:<name>`, `repo:<name>`). If vague, ask follow-ups to make it specific and actionable.
|
|
8
|
+
2. **Validate Quality** — Ensure it is specific and reusable (not generic advice). Avoid storing secrets or sensitive data.
|
|
9
|
+
3. **Store** — Call `memory.storeKnowledge` with title, content, tags, scope. If MCP tools are unavailable, use `npx ai-devkit memory store` instead.
|
|
10
|
+
4. **Confirm** — Summarize what was saved and offer to store more knowledge if needed.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Review
|
|
2
|
+
description: Review feature design for completeness.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
Review the design documentation in docs/ai/design/feature-{name}.md (and the project-level README if relevant). Summarize:
|
|
@@ -13,4 +13,3 @@ Review the design documentation in docs/ai/design/feature-{name}.md (and the pro
|
|
|
13
13
|
- Non-functional requirements that must be preserved
|
|
14
14
|
|
|
15
15
|
Highlight any inconsistencies, missing sections, or diagrams that need updates.
|
|
16
|
-
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Review
|
|
2
|
+
description: Review feature requirements for completeness.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Review `docs/ai/requirements/feature-{name}.md` and the project-level template `docs/ai/requirements/README.md` to ensure structure and content alignment. Summarize:
|
|
6
6
|
|
|
7
7
|
- Core problem statement and affected users
|
|
8
8
|
- Goals, non-goals, and success criteria
|
|
@@ -11,4 +11,3 @@ Please review `docs/ai/requirements/feature-{name}.md` and the project-level tem
|
|
|
11
11
|
- Any missing sections or deviations from the template
|
|
12
12
|
|
|
13
13
|
Identify gaps or contradictions and suggest clarifications.
|
|
14
|
-
|
|
@@ -1,148 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Simplify existing code to reduce complexity.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Help me simplify an existing implementation while maintaining or improving its functionality.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- Target file(s) or component(s) to simplify
|
|
12
|
-
- Current pain points (hard to understand, maintain, or extend?)
|
|
13
|
-
- Performance or scalability concerns
|
|
14
|
-
- Any constraints (backward compatibility, API stability, deadlines)
|
|
15
|
-
- Relevant design docs or requirements
|
|
16
|
-
|
|
17
|
-
If available, request the current implementation:
|
|
18
|
-
```bash
|
|
19
|
-
# For a specific file
|
|
20
|
-
cat <file_path>
|
|
21
|
-
|
|
22
|
-
# For recent changes
|
|
23
|
-
git diff HEAD~5 --stat
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Step 2: Analyze Current Complexity
|
|
27
|
-
For each target file or component:
|
|
28
|
-
1. **Identify complexity sources:**
|
|
29
|
-
- Deep nesting or long functions
|
|
30
|
-
- Duplicate or redundant code
|
|
31
|
-
- Unclear abstractions or leaky interfaces
|
|
32
|
-
- Tightly coupled components
|
|
33
|
-
- Over-engineering or premature optimization
|
|
34
|
-
- Magic numbers, hardcoded values, or scattered configuration
|
|
35
|
-
|
|
36
|
-
2. **Measure impact:**
|
|
37
|
-
- Lines of code that could be reduced
|
|
38
|
-
- Number of dependencies that could be removed
|
|
39
|
-
- Cognitive load for future maintainers
|
|
40
|
-
|
|
41
|
-
3. **Assess scalability blockers:**
|
|
42
|
-
- Single points of failure
|
|
43
|
-
- Synchronous operations that should be async
|
|
44
|
-
- Missing caching or memoization opportunities
|
|
45
|
-
- Inefficient data structures or algorithms
|
|
46
|
-
|
|
47
|
-
## Step 3: Apply Readability Principles
|
|
48
|
-
|
|
49
|
-
**Core Philosophy: Good code reads like a good book — naturally, from left to right, top to bottom.**
|
|
50
|
-
|
|
51
|
-
When simplifying, prioritize readability over brevity. The goal is not to write the shortest code, but to write code that communicates intent clearly.
|
|
52
|
-
|
|
53
|
-
### ✅ DO: Embrace Readability
|
|
54
|
-
- **Linear flow:** Code should tell a story. A reader should understand the logic by reading top-to-bottom without jumping around.
|
|
55
|
-
- **Explicit over implicit:** Favor clear, explicit code over clever shortcuts that require mental decoding.
|
|
56
|
-
- **Meaningful names:** Variables, functions, and classes should describe their purpose without needing comments.
|
|
57
|
-
- **Consistent patterns:** Use the same patterns throughout the codebase so readers build familiarity.
|
|
58
|
-
- **Appropriate abstraction level:** Each function should operate at one level of abstraction.
|
|
59
|
-
- **White space and grouping:** Use blank lines to separate logical blocks, like paragraphs in prose.
|
|
60
|
-
|
|
61
|
-
### ❌ AVOID: Over-Optimization for Brevity
|
|
62
|
-
Reducing line count is NOT the goal. These patterns often harm readability:
|
|
63
|
-
|
|
64
|
-
| Anti-Pattern | Problem | Better Alternative |
|
|
65
|
-
|--------------|---------|--------------------|
|
|
66
|
-
| **Nested ternaries** | `a ? b ? c : d : e` is cryptic | Use explicit if/else blocks |
|
|
67
|
-
| **Chained one-liners** | `x.map().filter().reduce().flat()` is hard to debug | Break into named intermediate steps |
|
|
68
|
-
| **Clever bitwise tricks** | `n & 1` instead of `n % 2 === 1` obscures intent | Use readable arithmetic unless performance-critical |
|
|
69
|
-
| **Overly short variable names** | `const x = getData(); const y = x.filter(z => z.a);` | Use descriptive names like `users`, `activeUsers` |
|
|
70
|
-
| **Implicit returns everywhere** | Arrow functions without braces hide complexity | Add braces and explicit returns for complex logic |
|
|
71
|
-
| **Magic one-liners** | Regex or reduce expressions that "do everything" | Split into documented steps |
|
|
72
|
-
| **Premature DRY** | Forcing abstraction to avoid 2-3 lines of duplication | Some duplication is clearer than wrong abstraction |
|
|
73
|
-
|
|
74
|
-
### 📖 The "Reading Test"
|
|
75
|
-
For each simplification, ask:
|
|
76
|
-
1. Can a new team member understand this in under 30 seconds?
|
|
77
|
-
2. Does the code flow naturally without needing to jump to other files?
|
|
78
|
-
3. Are there any "wait, what does this do?" moments?
|
|
79
|
-
4. Would this code still be clear 6 months from now?
|
|
80
|
-
|
|
81
|
-
If the answer is "no" to any of these, the code needs more clarity, not more optimization.
|
|
82
|
-
|
|
83
|
-
## Step 4: Propose Simplifications
|
|
84
|
-
For each identified issue, suggest concrete improvements:
|
|
85
|
-
|
|
86
|
-
| Category | Pattern |
|
|
87
|
-
|----------|---------|
|
|
88
|
-
| **Extract** | Long functions → smaller, focused functions |
|
|
89
|
-
| **Consolidate** | Duplicate code → shared utilities or base classes |
|
|
90
|
-
| **Flatten** | Deep nesting → early returns, guard clauses |
|
|
91
|
-
| **Decouple** | Tight coupling → dependency injection, interfaces |
|
|
92
|
-
| **Remove** | Dead code, unused features, excessive abstractions |
|
|
93
|
-
| **Replace** | Complex logic → built-in language/library features |
|
|
94
|
-
| **Defer** | Premature optimization → measure-first approach |
|
|
95
|
-
|
|
96
|
-
## Step 5: Prioritize Changes
|
|
97
|
-
Rank suggestions by:
|
|
98
|
-
1. **High impact, low risk** — Do first
|
|
99
|
-
2. **High impact, higher risk** — Plan carefully
|
|
100
|
-
3. **Low impact, low risk** — Quick wins if time permits
|
|
101
|
-
4. **Low impact, high risk** — Skip or defer
|
|
102
|
-
|
|
103
|
-
For each change, specify:
|
|
104
|
-
- Before/after code snippets
|
|
105
|
-
- Risk level (breaking change? needs migration?)
|
|
106
|
-
- Testing requirements
|
|
107
|
-
- Estimated effort
|
|
108
|
-
|
|
109
|
-
## Step 6: Create Simplification Plan
|
|
110
|
-
Provide a structured action plan:
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
### Simplification Summary
|
|
114
|
-
- Total suggestions: [count]
|
|
115
|
-
- Estimated LOC reduction: [estimate]
|
|
116
|
-
- Complexity score before/after: [if measurable]
|
|
117
|
-
|
|
118
|
-
### Prioritized Actions
|
|
119
|
-
1. **[Component/Function Name]**
|
|
120
|
-
- Issue: ...
|
|
121
|
-
- Solution: ...
|
|
122
|
-
- Risk: Low/Medium/High
|
|
123
|
-
- Effort: S/M/L
|
|
124
|
-
|
|
125
|
-
2. ... (repeat)
|
|
126
|
-
|
|
127
|
-
### Recommended Order
|
|
128
|
-
1. [ ] [First change - safest, unlocks others]
|
|
129
|
-
2. [ ] [Second change]
|
|
130
|
-
3. [ ] ...
|
|
131
|
-
|
|
132
|
-
### Post-Simplification Checklist
|
|
133
|
-
- [ ] Run existing tests to verify no regressions
|
|
134
|
-
- [ ] Add tests for any new helper functions
|
|
135
|
-
- [ ] Update documentation if interfaces changed
|
|
136
|
-
- [ ] Review with team before merging larger refactors
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Step 7: Scalability Recommendations
|
|
140
|
-
Beyond immediate simplification, suggest patterns for future scalability:
|
|
141
|
-
- Modular architecture improvements
|
|
142
|
-
- Caching strategies
|
|
143
|
-
- Async/parallel processing opportunities
|
|
144
|
-
- Configuration externalization
|
|
145
|
-
- Feature flags for gradual rollouts
|
|
146
|
-
|
|
147
|
-
---
|
|
148
|
-
Let me know when you're ready to simplify your implementation.
|
|
7
|
+
1. **Gather Context** — If not already provided, ask for: target file(s) or component(s) to simplify, current pain points (hard to understand, maintain, or extend?), performance or scalability concerns, constraints (backward compatibility, API stability, deadlines), and relevant design docs or requirements.
|
|
8
|
+
2. **Analyze Current Complexity** — For each target: identify complexity sources (deep nesting, duplication, unclear abstractions, tight coupling, over-engineering, magic values), assess cognitive load for future maintainers, and identify scalability blockers (single points of failure, sync-where-async-needed, missing caching, inefficient algorithms).
|
|
9
|
+
3. **Propose Simplifications** — Prioritize readability over brevity — apply the 30-second test: can a new team member understand each change quickly? For each issue, suggest concrete improvements (extract, consolidate, flatten, decouple, remove dead code, replace with built-ins). Provide before/after snippets.
|
|
10
|
+
4. **Prioritize & Plan** — Rank by impact vs risk: (1) high impact, low risk — do first, (2) high impact, higher risk — plan carefully, (3) low impact, low risk — quick wins if time permits, (4) low impact, high risk — skip or defer. For each change specify risk level, testing requirements, and effort. Produce a prioritized action plan with recommended execution order.
|
|
@@ -1,65 +1,10 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Update planning docs to reflect implementation progress.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Please help me reconcile the current implementation progress with our planning documentation.
|
|
8
|
-
|
|
9
|
-
## Step 1: Gather Context
|
|
10
|
-
Ask me for:
|
|
11
|
-
- Feature/branch name and brief status
|
|
12
|
-
- Tasks completed since last update
|
|
13
|
-
- Any new tasks discovered
|
|
14
|
-
- Current blockers or risks
|
|
15
|
-
- Relevant planning docs (e.g., `docs/ai/planning/feature-{name}.md`)
|
|
16
|
-
|
|
17
|
-
## Step 2: Review Planning Doc
|
|
18
|
-
If a planning doc exists:
|
|
19
|
-
- Summarize existing milestones and task breakdowns
|
|
20
|
-
- Note expected sequencing and dependencies
|
|
21
|
-
- Identify outstanding tasks in the plan
|
|
22
|
-
|
|
23
|
-
## Step 3: Reconcile Progress
|
|
24
|
-
For each planned task:
|
|
25
|
-
- Mark status (done / in progress / blocked / not started)
|
|
26
|
-
- Note actual work completed vs. planned scope
|
|
27
|
-
- Record blockers or changes in approach
|
|
28
|
-
- Identify tasks that were skipped or added
|
|
29
|
-
|
|
30
|
-
## Step 4: Update Task List
|
|
31
|
-
Help me produce an updated checklist such as:
|
|
32
|
-
```
|
|
33
|
-
### Current Status: [Feature Name]
|
|
34
|
-
|
|
35
|
-
#### Done
|
|
36
|
-
- [x] Task A - short note on completion or link to commit/pr
|
|
37
|
-
- [x] Task B
|
|
38
|
-
|
|
39
|
-
#### In Progress
|
|
40
|
-
- [ ] Task C - waiting on [dependency]
|
|
41
|
-
|
|
42
|
-
#### Blocked
|
|
43
|
-
- [ ] Task D - blocked by [issue/owner]
|
|
44
|
-
|
|
45
|
-
#### Newly Discovered Work
|
|
46
|
-
- [ ] Task E - reason discovered
|
|
47
|
-
- [ ] Task F - due by [date]
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Step 5: Next Steps & Priorities
|
|
51
|
-
- Suggest the next 2-3 actionable tasks
|
|
52
|
-
- Highlight risky areas needing attention
|
|
53
|
-
- Recommend coordination (design changes, stakeholder sync, etc.)
|
|
54
|
-
- List documentation updates needed
|
|
55
|
-
|
|
56
|
-
## Step 6: Summary for Planning Doc
|
|
57
|
-
Prepare a summary paragraph to copy into the planning doc, covering:
|
|
58
|
-
- Current state and progress
|
|
59
|
-
- Major risks/blockers
|
|
60
|
-
- Upcoming focus items
|
|
61
|
-
- Any changes to scope or timeline
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
Let me know when you're ready to begin the planning update.
|
|
5
|
+
Help me reconcile current implementation progress with the planning documentation.
|
|
65
6
|
|
|
7
|
+
1. **Gather Context** — If not already provided, ask for: feature/branch name and brief status, tasks completed since last update, new tasks discovered, current blockers or risks, and planning doc path (default `docs/ai/planning/feature-{name}.md`).
|
|
8
|
+
2. **Review & Reconcile** — Summarize existing milestones, task breakdowns, and dependencies from the planning doc. For each planned task: mark status (done / in progress / blocked / not started), note scope changes, record blockers, identify skipped or added tasks.
|
|
9
|
+
3. **Produce Updated Task List** — Generate an updated checklist grouped by: Done, In Progress, Blocked, Newly Discovered Work — with short notes per task.
|
|
10
|
+
4. **Next Steps & Summary** — Suggest the next 2-3 actionable tasks and highlight risky areas. Prepare a summary paragraph for the planning doc covering: current state, major risks/blockers, upcoming focus, and any scope/timeline changes.
|
|
@@ -4,45 +4,9 @@ description: Add tests for a new feature.
|
|
|
4
4
|
|
|
5
5
|
Review `docs/ai/testing/feature-{name}.md` and ensure it mirrors the base template before writing tests.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
- Any flaky or slow tests to avoid
|
|
14
|
-
|
|
15
|
-
## Step 2: Analyze Testing Template
|
|
16
|
-
- Identify required sections from `docs/ai/testing/feature-{name}.md` (unit, integration, manual verification, coverage targets)
|
|
17
|
-
- Confirm success criteria and edge cases from requirements & design docs
|
|
18
|
-
- Note any mocks/stubs or fixtures already available
|
|
19
|
-
|
|
20
|
-
## Step 3: Unit Tests (Aim for 100% coverage)
|
|
21
|
-
For each module/function:
|
|
22
|
-
1. List behavior scenarios (happy path, edge cases, error handling)
|
|
23
|
-
2. Generate concrete test cases with assertions and inputs
|
|
24
|
-
3. Reference existing utilities/mocks to accelerate implementation
|
|
25
|
-
4. Provide pseudocode or actual test snippets
|
|
26
|
-
5. Highlight potential missing branches preventing full coverage
|
|
27
|
-
|
|
28
|
-
## Step 4: Integration Tests
|
|
29
|
-
1. Identify critical flows that span multiple components/services
|
|
30
|
-
2. Define setup/teardown steps (databases, APIs, queues)
|
|
31
|
-
3. Outline test cases validating interaction boundaries, data contracts, and failure modes
|
|
32
|
-
4. Suggest instrumentation/logging to debug failures
|
|
33
|
-
|
|
34
|
-
## Step 5: Coverage Strategy
|
|
35
|
-
- Recommend tooling commands (e.g., `npm run test -- --coverage`)
|
|
36
|
-
- Call out files/functions that still need coverage and why
|
|
37
|
-
- Suggest additional tests if coverage <100%
|
|
38
|
-
|
|
39
|
-
## Step 6: Manual & Exploratory Testing
|
|
40
|
-
- Propose manual test checklist covering UX, accessibility, and error handling
|
|
41
|
-
- Identify exploratory scenarios or chaos/failure injection tests if relevant
|
|
42
|
-
|
|
43
|
-
## Step 7: Update Documentation & TODOs
|
|
44
|
-
- Summarize which tests were added or still missing
|
|
45
|
-
- Update `docs/ai/testing/feature-{name}.md` sections with links to test files and results
|
|
46
|
-
- Flag follow-up tasks for deferred tests (with owners/dates)
|
|
47
|
-
|
|
48
|
-
Let me know when you have the latest code changes ready; we'll write tests together until we hit 100% coverage.
|
|
7
|
+
1. **Gather Context** — If not already provided, ask for: feature name/branch, summary of changes (link to design & requirements docs), target environment, existing test suites, and any flaky/slow tests to avoid.
|
|
8
|
+
2. **Analyze Testing Template** — Identify required sections from `docs/ai/testing/feature-{name}.md`. Confirm success criteria and edge cases from requirements & design docs. Note available mocks/stubs/fixtures.
|
|
9
|
+
3. **Unit Tests (aim for 100% coverage)** — For each module/function: list behavior scenarios (happy path, edge cases, error handling), generate test cases with assertions using existing utilities/mocks, and highlight missing branches preventing full coverage.
|
|
10
|
+
4. **Integration Tests** — Identify critical cross-component flows. Define setup/teardown steps and test cases for interaction boundaries, data contracts, and failure modes.
|
|
11
|
+
5. **Coverage Strategy** — Recommend coverage tooling commands. Call out files/functions still needing coverage and suggest additional tests if <100%.
|
|
12
|
+
6. **Update Documentation** — Summarize tests added or still missing. Update `docs/ai/testing/feature-{name}.md` with links to test files and results. Flag deferred tests as follow-up tasks.
|
|
@@ -1,50 +1,12 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Document a code entry point in knowledge docs.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# Knowledge Capture Assistant
|
|
6
|
-
|
|
7
5
|
Guide me through creating a structured understanding of a code entry point and saving it to the knowledge docs.
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
## Step 2: Validate Entry Point
|
|
16
|
-
- Determine entry point type and confirm it exists
|
|
17
|
-
- Surface ambiguity (multiple matches) and ask for clarification
|
|
18
|
-
- If not found, suggest likely alternatives or spelling fixes
|
|
19
|
-
|
|
20
|
-
## Step 3: Collect Source Context
|
|
21
|
-
- Read the primary file/module and summarize purpose, exports, key patterns
|
|
22
|
-
- For folders: list structure, highlight key modules
|
|
23
|
-
- For functions/APIs: capture signature, parameters, return values, error handling
|
|
24
|
-
- Extract essential snippets (avoid large dumps)
|
|
25
|
-
|
|
26
|
-
## Step 4: Analyze Dependencies
|
|
27
|
-
- Build a dependency view up to depth 3
|
|
28
|
-
- Track visited nodes to avoid loops
|
|
29
|
-
- Categorize dependencies (imports, function calls, services, external packages)
|
|
30
|
-
- Note important external systems or generated code that should be excluded
|
|
31
|
-
|
|
32
|
-
## Step 5: Synthesize Explanation
|
|
33
|
-
- Draft an overview (purpose, language, high-level behavior)
|
|
34
|
-
- Detail core logic, key components, execution flow, patterns
|
|
35
|
-
- Highlight error handling, performance, security considerations
|
|
36
|
-
- Identify potential improvements or risks discovered during analysis
|
|
37
|
-
|
|
38
|
-
## Step 6: Create Documentation
|
|
39
|
-
- Normalize entry point name to kebab-case (`calculateTotalPrice` → `calculate-total-price`)
|
|
40
|
-
- Create `docs/ai/implementation/knowledge-{name}.md` using the headings implied in Step 5 (Overview, Implementation Details, Dependencies, Visual Diagrams, Additional Insights, Metadata, Next Steps)
|
|
41
|
-
- Populate sections with findings, diagrams, and metadata (analysis date, depth, files touched)
|
|
42
|
-
- Include mermaid diagrams when they clarify flows or relationships
|
|
43
|
-
|
|
44
|
-
## Step 7: Review & Next Actions
|
|
45
|
-
- Summarize key insights and open questions for follow-up
|
|
46
|
-
- Suggest related areas for deeper dives or refactors
|
|
47
|
-
- Confirm the knowledge file path and remind to commit it
|
|
48
|
-
- Encourage running `/capture-knowledge` again for related entry points if needed
|
|
49
|
-
|
|
50
|
-
Let me know the entry point and goals when you’re ready to begin the knowledge capture.
|
|
7
|
+
1. **Gather & Validate Entry Point** — If not already provided, ask for: entry point (file, folder, function, API), why it matters (feature, bug, investigation), and desired depth or focus areas. Confirm the entry point exists; if ambiguous or not found, clarify or suggest alternatives.
|
|
8
|
+
2. **Collect Source Context** — Read the primary file/module and summarize purpose, exports, key patterns. For folders: list structure, highlight key modules. For functions/APIs: capture signature, parameters, return values, error handling. Extract essential snippets (avoid large dumps).
|
|
9
|
+
3. **Analyze Dependencies** — Build a dependency view up to depth 3, tracking visited nodes to avoid loops. Categorize: imports, function calls, services, external packages. Note external systems or generated code to exclude.
|
|
10
|
+
4. **Synthesize Explanation** — Draft overview (purpose, language, high-level behavior). Detail core logic, execution flow, key patterns. Highlight error handling, performance, security considerations. Identify potential improvements or risks.
|
|
11
|
+
5. **Create Documentation** — Normalize name to kebab-case (`calculateTotalPrice` → `calculate-total-price`). Create `docs/ai/implementation/knowledge-{name}.md` with sections: Overview, Implementation Details, Dependencies, Visual Diagrams, Additional Insights, Metadata, Next Steps. Include mermaid diagrams when they clarify flows or relationships. Add metadata (analysis date, depth, files touched).
|
|
12
|
+
6. **Review & Next Actions** — Summarize key insights and open questions. Suggest related areas for deeper dives. Confirm file path and remind to commit.
|