devlyn-cli 0.1.5 → 0.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.md +21 -0
- package/README.md +7 -3
- package/bin/devlyn.js +24 -0
- package/config/commands/devlyn.clean.md +285 -0
- package/config/commands/devlyn.design-ui.md +4 -0
- package/config/commands/devlyn.discover-product.md +9 -1
- package/config/commands/devlyn.resolve.md +32 -1
- package/config/commands/devlyn.review.md +25 -0
- package/config/commands/devlyn.team-resolve.md +2 -2
- package/config/commands/devlyn.update-docs.md +463 -0
- package/config/skills/code-health-standards/SKILL.md +74 -0
- package/config/skills/code-review-standards/SKILL.md +0 -10
- package/config/skills/root-cause-analysis/SKILL.md +0 -8
- package/config/skills/workflow-routing/SKILL.md +73 -0
- package/package.json +2 -2
- package/config/commands/devlyn.handoff.md +0 -13
package/CLAUDE.md
CHANGED
|
@@ -39,12 +39,33 @@ The full design-to-implementation pipeline:
|
|
|
39
39
|
|
|
40
40
|
For complex features, use the Plan agent to design the approach before implementation.
|
|
41
41
|
|
|
42
|
+
## Documentation Workflow
|
|
43
|
+
|
|
44
|
+
- **Sync docs with codebase**: Use `/devlyn.update-docs` to clean up stale content, update outdated info, and generate missing docs
|
|
45
|
+
- **Focused doc update**: Use `/devlyn.update-docs [area]` for targeted updates (e.g., "API reference", "getting-started")
|
|
46
|
+
- Preserves all forward-looking content: roadmaps, future plans, visions, open questions
|
|
47
|
+
- If no docs exist, proposes a tailored docs structure and generates initial content
|
|
48
|
+
|
|
42
49
|
## Debugging Workflow
|
|
43
50
|
|
|
44
51
|
- **Simple bugs**: Use `/devlyn.resolve` for systematic bug fixing with test-driven validation
|
|
45
52
|
- **Complex bugs**: Use `/devlyn.team-resolve` for multi-perspective investigation with a full agent team
|
|
46
53
|
- **Post-fix review**: Use `/devlyn.team-review` for thorough multi-reviewer validation
|
|
47
54
|
|
|
55
|
+
## Maintenance Workflow
|
|
56
|
+
|
|
57
|
+
- **Codebase cleanup**: Use `/devlyn.clean` to detect and remove dead code, unused dependencies, complexity hotspots, and tech debt
|
|
58
|
+
- **Focused cleanup**: Use `/devlyn.clean [category]` for targeted sweeps (dead code, deps, tests, complexity, hygiene)
|
|
59
|
+
- **Periodic maintenance sequence**: `/devlyn.clean` → `/devlyn.update-docs` → `/devlyn.review`
|
|
60
|
+
|
|
61
|
+
## Context Window Management
|
|
62
|
+
|
|
63
|
+
When a conversation approaches context limits (50k+ tokens):
|
|
64
|
+
1. Check usage with `/context`
|
|
65
|
+
2. Create a HANDOFF.md summarizing: what was attempted, what succeeded, what failed, and next steps
|
|
66
|
+
3. Start a new session with `/clear`
|
|
67
|
+
4. Load context: `@HANDOFF.md Read this file and continue the work`
|
|
68
|
+
|
|
48
69
|
## Communication Style
|
|
49
70
|
|
|
50
71
|
- Lead with **objective data** (popularity, benchmarks, community adoption) before personal opinions
|
package/README.md
CHANGED
|
@@ -48,8 +48,8 @@ npx devlyn-cli list
|
|
|
48
48
|
```
|
|
49
49
|
your-project/
|
|
50
50
|
├── .claude/
|
|
51
|
-
│ ├── commands/ #
|
|
52
|
-
│ ├── skills/ #
|
|
51
|
+
│ ├── commands/ # 14 slash commands
|
|
52
|
+
│ ├── skills/ # 5 core skills + optional addons
|
|
53
53
|
│ ├── templates/ # Document templates
|
|
54
54
|
│ └── commit-conventions.md # Commit message standards
|
|
55
55
|
└── CLAUDE.md # Project-level instructions
|
|
@@ -71,8 +71,10 @@ Slash commands are invoked directly in Claude Code conversations (e.g., `/devlyn
|
|
|
71
71
|
| `/devlyn.product-spec` | Generate or incrementally update product spec documents |
|
|
72
72
|
| `/devlyn.discover-product` | Scan a codebase to generate feature-oriented product documentation |
|
|
73
73
|
| `/devlyn.recommend-features` | Prioritize top 5 features to build next based on value and readiness |
|
|
74
|
+
| `/devlyn.team-design-ui` | Team-based design exploration — spawns creative director, product designer, visual designer, interaction designer, accessibility designer |
|
|
74
75
|
| `/devlyn.design-system` | Design system reference and guidance |
|
|
75
|
-
| `/devlyn.
|
|
76
|
+
| `/devlyn.update-docs` | Sync all project docs with current codebase — cleans stale content, preserves roadmaps, generates missing docs |
|
|
77
|
+
| `/devlyn.clean` | Detect and remove dead code, unused dependencies, complexity hotspots, and tech debt |
|
|
76
78
|
|
|
77
79
|
## Skills
|
|
78
80
|
|
|
@@ -83,6 +85,8 @@ Skills are triggered automatically based on conversation context.
|
|
|
83
85
|
| `root-cause-analysis` | 5 Whys methodology, evidence standards, and no-workaround rules for debugging |
|
|
84
86
|
| `code-review-standards` | Severity framework, quality bar, and approval criteria for code reviews |
|
|
85
87
|
| `ui-implementation-standards` | Design system fidelity, accessibility, animation quality, and responsive standards for UI work |
|
|
88
|
+
| `code-health-standards` | Dead code prevention, dependency discipline, complexity thresholds, and production hygiene |
|
|
89
|
+
| `workflow-routing` | SDLC phase map — guides you to the right command for your current task |
|
|
86
90
|
|
|
87
91
|
## Templates
|
|
88
92
|
|
package/bin/devlyn.js
CHANGED
|
@@ -9,6 +9,11 @@ const CONFIG_SOURCE = path.join(__dirname, '..', 'config');
|
|
|
9
9
|
const OPTIONAL_SKILLS_SOURCE = path.join(__dirname, '..', 'optional-skills');
|
|
10
10
|
const PKG = require('../package.json');
|
|
11
11
|
|
|
12
|
+
// Files removed in previous versions that should be cleaned up on upgrade
|
|
13
|
+
const DEPRECATED_FILES = [
|
|
14
|
+
'commands/devlyn.handoff.md', // removed in v0.2.0
|
|
15
|
+
];
|
|
16
|
+
|
|
12
17
|
function getTargetDir() {
|
|
13
18
|
try {
|
|
14
19
|
return path.join(process.cwd(), '.claude');
|
|
@@ -170,6 +175,19 @@ function listContents() {
|
|
|
170
175
|
log('');
|
|
171
176
|
}
|
|
172
177
|
|
|
178
|
+
function cleanupDeprecated(targetDir) {
|
|
179
|
+
let removed = 0;
|
|
180
|
+
for (const relPath of DEPRECATED_FILES) {
|
|
181
|
+
const fullPath = path.join(targetDir, relPath);
|
|
182
|
+
if (fs.existsSync(fullPath)) {
|
|
183
|
+
fs.unlinkSync(fullPath);
|
|
184
|
+
log(` ✕ ${relPath} (deprecated)`, 'dim');
|
|
185
|
+
removed++;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return removed;
|
|
189
|
+
}
|
|
190
|
+
|
|
173
191
|
function copyRecursive(src, dest, baseDir) {
|
|
174
192
|
const stats = fs.statSync(src);
|
|
175
193
|
|
|
@@ -329,6 +347,12 @@ async function init(skipPrompts = false) {
|
|
|
329
347
|
log('\n📁 Installing core config to .claude/', 'green');
|
|
330
348
|
copyRecursive(CONFIG_SOURCE, targetDir, targetDir);
|
|
331
349
|
|
|
350
|
+
// Remove deprecated files from previous versions
|
|
351
|
+
const removed = cleanupDeprecated(targetDir);
|
|
352
|
+
if (removed > 0) {
|
|
353
|
+
log(`\n🧹 Cleaned up ${removed} deprecated file${removed > 1 ? 's' : ''}`, 'yellow');
|
|
354
|
+
}
|
|
355
|
+
|
|
332
356
|
// Copy CLAUDE.md to project root
|
|
333
357
|
const claudeMdSrc = path.join(__dirname, '..', 'CLAUDE.md');
|
|
334
358
|
const claudeMdDest = path.join(process.cwd(), 'CLAUDE.md');
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Detect and remove dead code, unused dependencies, complexity hotspots, and tech debt. Keeps your codebase lean and maintainable.
|
|
3
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash(ls:*), Bash(test:*), Bash(git log:*), Bash(git blame:*), Bash(wc:*), Bash(npm:*), Bash(npx:*), Bash(pnpm:*), Bash(yarn:*), Bash(cargo:*), Bash(pip:*), Bash(go:*), Bash(node -e:*), Bash(python -c:*)
|
|
4
|
+
argument-hint: [focus area, or empty for full scan]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<role>
|
|
8
|
+
You are a Codebase Health Engineer. Your job is to find and safely remove dead weight from a codebase — unused code, stale dependencies, orphan files, complexity hotspots, and test gaps. You care about maintainability as much as functionality.
|
|
9
|
+
|
|
10
|
+
Your operating principle: every line of code is a liability. Code that serves no purpose increases build times, confuses contributors, and hides real bugs. Remove it with confidence, preserve it with evidence.
|
|
11
|
+
</role>
|
|
12
|
+
|
|
13
|
+
<user_input>
|
|
14
|
+
$ARGUMENTS
|
|
15
|
+
</user_input>
|
|
16
|
+
|
|
17
|
+
<escalation>
|
|
18
|
+
If the cleanup reveals deeply intertwined architectural debt — circular dependencies, god objects woven into multiple systems, or patterns that can't be safely removed without redesigning interfaces — escalate to `/devlyn.team-resolve` with your findings so a multi-perspective team can plan the refactor.
|
|
19
|
+
</escalation>
|
|
20
|
+
|
|
21
|
+
<process>
|
|
22
|
+
|
|
23
|
+
## Phase 1: CODEBASE UNDERSTANDING
|
|
24
|
+
|
|
25
|
+
Before analyzing anything, understand the project's shape.
|
|
26
|
+
|
|
27
|
+
1. Read project metadata in parallel:
|
|
28
|
+
- package.json / Cargo.toml / pyproject.toml / go.mod (whatever applies)
|
|
29
|
+
- README.md, CLAUDE.md
|
|
30
|
+
- Linter and build configs (tsconfig.json, .eslintrc, biome.json, etc.)
|
|
31
|
+
|
|
32
|
+
2. Scan the project structure:
|
|
33
|
+
- List top-level directories
|
|
34
|
+
- Identify the tech stack, framework, entry points
|
|
35
|
+
- Check for monorepo structure (workspaces, packages/)
|
|
36
|
+
|
|
37
|
+
3. Check recent git activity:
|
|
38
|
+
- `git log --oneline -20` for recent changes
|
|
39
|
+
- Identify actively maintained vs. stale areas
|
|
40
|
+
|
|
41
|
+
## Phase 2: ANALYSIS
|
|
42
|
+
|
|
43
|
+
Run these 5 analysis categories. Use parallel tool calls — each category is independent.
|
|
44
|
+
|
|
45
|
+
### Category 1: Dead Code Detection
|
|
46
|
+
|
|
47
|
+
Find code that is never executed or referenced.
|
|
48
|
+
|
|
49
|
+
**What to scan:**
|
|
50
|
+
- Exported functions/classes never imported elsewhere
|
|
51
|
+
- Files with zero inbound imports (orphan files)
|
|
52
|
+
- Unused variables and parameters (beyond what linters catch)
|
|
53
|
+
- Feature flags or config branches that are permanently off
|
|
54
|
+
- Commented-out code blocks (more than 3 lines)
|
|
55
|
+
- Dead routes: route definitions pointing to removed handlers
|
|
56
|
+
- Unused CSS classes or styled components (in UI projects)
|
|
57
|
+
|
|
58
|
+
**How to verify:**
|
|
59
|
+
- Use Grep to search for import/require/usage of each suspect
|
|
60
|
+
- Check if "unused" code is actually used dynamically (string interpolation, dynamic imports, reflection)
|
|
61
|
+
- Verify test files before flagging — test helpers may appear unused but are needed
|
|
62
|
+
|
|
63
|
+
### Category 2: Dependency Hygiene
|
|
64
|
+
|
|
65
|
+
Find dependency bloat and version issues.
|
|
66
|
+
|
|
67
|
+
**What to scan:**
|
|
68
|
+
- Installed packages never imported in source code
|
|
69
|
+
- Duplicate packages serving the same purpose (e.g., both lodash and underscore)
|
|
70
|
+
- devDependencies used in production code (or vice versa)
|
|
71
|
+
- Pinned versions with known security issues (if lockfile available)
|
|
72
|
+
- Dependencies that could be replaced by built-in language features
|
|
73
|
+
|
|
74
|
+
**How to verify:**
|
|
75
|
+
- Search all source files for each dependency's import/require
|
|
76
|
+
- Check indirect usage (peer dependencies, plugins, config references)
|
|
77
|
+
- Verify build tool plugins (webpack, vite, etc.) that may reference deps implicitly
|
|
78
|
+
|
|
79
|
+
### Category 3: Test Health
|
|
80
|
+
|
|
81
|
+
Find gaps, obsolete tests, and tests that don't actually test anything.
|
|
82
|
+
|
|
83
|
+
**What to scan:**
|
|
84
|
+
- Test files for components/modules that no longer exist
|
|
85
|
+
- Tests with no assertions (empty test bodies, missing expect/assert)
|
|
86
|
+
- Skipped tests (`.skip`, `xit`, `xdescribe`, `@pytest.mark.skip`) without explanation
|
|
87
|
+
- Snapshot tests with stale snapshots
|
|
88
|
+
- Test coverage gaps: source files with zero corresponding test files
|
|
89
|
+
|
|
90
|
+
**How to verify:**
|
|
91
|
+
- Cross-reference test file names with source file names
|
|
92
|
+
- Read test bodies to check for meaningful assertions
|
|
93
|
+
- Check if skipped tests reference issues that are now resolved
|
|
94
|
+
|
|
95
|
+
### Category 4: Complexity Hotspots
|
|
96
|
+
|
|
97
|
+
Find code that's disproportionately hard to maintain.
|
|
98
|
+
|
|
99
|
+
**What to scan:**
|
|
100
|
+
- Functions longer than 50 lines
|
|
101
|
+
- Files longer than 500 lines
|
|
102
|
+
- Nesting deeper than 4 levels
|
|
103
|
+
- Functions with more than 5 parameters
|
|
104
|
+
- God objects/files that accumulate unrelated responsibilities
|
|
105
|
+
- Circular dependencies between modules
|
|
106
|
+
|
|
107
|
+
**How to measure:**
|
|
108
|
+
- `wc -l` on suspect files
|
|
109
|
+
- Read and count nesting levels
|
|
110
|
+
- Trace import chains for circularity
|
|
111
|
+
|
|
112
|
+
### Category 5: Code Hygiene
|
|
113
|
+
|
|
114
|
+
Find patterns that degrade codebase quality over time.
|
|
115
|
+
|
|
116
|
+
**What to scan:**
|
|
117
|
+
- Console.log/print statements in production code (not in designated logger)
|
|
118
|
+
- TODO/FIXME/HACK comments older than 90 days (check with git blame)
|
|
119
|
+
- Hardcoded values that should be constants or config (magic numbers, URLs, keys)
|
|
120
|
+
- Inconsistent naming patterns (camelCase mixed with snake_case)
|
|
121
|
+
- Duplicate code blocks (3+ lines repeated in 2+ places)
|
|
122
|
+
- Empty catch blocks or swallowed errors
|
|
123
|
+
- Type `any` overuse (TypeScript projects)
|
|
124
|
+
|
|
125
|
+
## Phase 3: PRIORITIZE
|
|
126
|
+
|
|
127
|
+
Score each finding:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
| Priority | Criteria | Action |
|
|
131
|
+
|----------|----------|--------|
|
|
132
|
+
| P0 — Remove now | Zero risk, clearly dead (orphan file, unused export with no dynamic usage) | Auto-fix |
|
|
133
|
+
| P1 — Remove with care | Likely dead but verify (unused dep, stale test) | Fix after user confirms |
|
|
134
|
+
| P2 — Refactor | Alive but unhealthy (complexity, duplication, hygiene) | Plan the refactor |
|
|
135
|
+
| P3 — Flag | Ambiguous — might be used in ways not visible in code | Report to user |
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Phase 4: PRESENT PLAN
|
|
139
|
+
|
|
140
|
+
Present findings to the user for approval before making changes.
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
## Codebase Health Report
|
|
144
|
+
|
|
145
|
+
### Summary
|
|
146
|
+
- Scanned: {N} files across {M} directories
|
|
147
|
+
- Found: {X} issues ({P0} auto-fixable, {P1} to confirm, {P2} to refactor, {P3} flagged)
|
|
148
|
+
|
|
149
|
+
### P0 — Safe to Remove (auto-fix)
|
|
150
|
+
- `src/utils/oldHelper.ts` — Orphan file, zero imports anywhere
|
|
151
|
+
- `package.json` — Remove `left-pad` (never imported)
|
|
152
|
+
|
|
153
|
+
### P1 — Remove with Confirmation
|
|
154
|
+
- `src/components/LegacyWidget.tsx` — No imports found, but has a default export (could be dynamic import)
|
|
155
|
+
- `tests/api.old.test.ts` — Tests removed API endpoints
|
|
156
|
+
|
|
157
|
+
### P2 — Refactor Candidates
|
|
158
|
+
- `src/services/userService.ts` (287 lines) — Split into auth, profile, preferences
|
|
159
|
+
- `src/utils/helpers.ts:45-98` — Duplicated in `src/lib/shared.ts:12-65`
|
|
160
|
+
|
|
161
|
+
### P3 — Flagged for Review
|
|
162
|
+
- `src/config/featureFlags.ts` — Contains 3 flags set to `false` since [date]
|
|
163
|
+
|
|
164
|
+
### Estimated Impact
|
|
165
|
+
- Lines removed: ~{N}
|
|
166
|
+
- Dependencies removed: {N}
|
|
167
|
+
- Files deleted: {N}
|
|
168
|
+
- Complexity reduced: {description}
|
|
169
|
+
|
|
170
|
+
Approve this plan to proceed? (You can exclude specific items.)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Wait for explicit user approval. If the user excludes items, respect that.
|
|
174
|
+
|
|
175
|
+
## Phase 5: APPLY FIXES
|
|
176
|
+
|
|
177
|
+
Execute the approved changes in this order:
|
|
178
|
+
|
|
179
|
+
1. **Delete orphan files** — safest, no cascading effects
|
|
180
|
+
2. **Remove dead exports/functions** — verify no dynamic usage first
|
|
181
|
+
3. **Remove unused dependencies** — update package.json/lockfile
|
|
182
|
+
4. **Delete stale tests** — clean up test suite
|
|
183
|
+
5. **Apply hygiene fixes** — remove console.logs, resolve TODOs, clean comments
|
|
184
|
+
6. **Refactor complexity** — only if user approved P2 items
|
|
185
|
+
|
|
186
|
+
For each change:
|
|
187
|
+
- Use Edit for targeted removals (prefer over full rewrites)
|
|
188
|
+
- Run linter after changes to catch cascade issues
|
|
189
|
+
- If removing a dependency, verify the project still builds
|
|
190
|
+
|
|
191
|
+
## Phase 6: VERIFY & REPORT
|
|
192
|
+
|
|
193
|
+
After all changes:
|
|
194
|
+
|
|
195
|
+
1. Run the linter — fix any new issues introduced
|
|
196
|
+
2. Run the test suite — everything should still pass
|
|
197
|
+
3. If anything breaks, revert that specific change and report it
|
|
198
|
+
|
|
199
|
+
Present the final summary:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
## Cleanup Complete
|
|
203
|
+
|
|
204
|
+
### Changes Applied
|
|
205
|
+
- **Removed**: {N} dead files, {N} unused functions, {N} stale deps
|
|
206
|
+
- **Cleaned**: {N} console.logs, {N} resolved TODOs, {N} commented blocks
|
|
207
|
+
- **Refactored**: {N} complexity hotspots (if applicable)
|
|
208
|
+
|
|
209
|
+
### Verification
|
|
210
|
+
- Lint: [PASS / FAIL with details]
|
|
211
|
+
- Tests: [PASS / FAIL with details]
|
|
212
|
+
- Build: [PASS / FAIL if applicable]
|
|
213
|
+
|
|
214
|
+
### Lines of Code
|
|
215
|
+
- Before: {N}
|
|
216
|
+
- After: {N}
|
|
217
|
+
- Removed: {N} ({percentage}%)
|
|
218
|
+
|
|
219
|
+
### Deferred Items
|
|
220
|
+
- {items the user excluded or that couldn't be safely removed}
|
|
221
|
+
|
|
222
|
+
### Recommendations
|
|
223
|
+
- {Any follow-up actions needed}
|
|
224
|
+
- Schedule: run `/devlyn.clean` periodically to prevent debt accumulation
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
</process>
|
|
228
|
+
|
|
229
|
+
<focus_area>
|
|
230
|
+
|
|
231
|
+
## Handling Focus Area Arguments
|
|
232
|
+
|
|
233
|
+
If the user provides a focus area (e.g., `/devlyn.clean dependencies` or `/devlyn.clean tests`):
|
|
234
|
+
|
|
235
|
+
1. Still run Phase 1 (codebase understanding) at reduced depth
|
|
236
|
+
2. In Phase 2, only run the relevant analysis category:
|
|
237
|
+
- `dead code` or `unused` → Category 1
|
|
238
|
+
- `dependencies` or `deps` → Category 2
|
|
239
|
+
- `tests` or `test health` → Category 3
|
|
240
|
+
- `complexity` or `hotspots` → Category 4
|
|
241
|
+
- `hygiene` or `lint` → Category 5
|
|
242
|
+
3. Present a focused plan and execute
|
|
243
|
+
|
|
244
|
+
This enables quick, targeted cleanups without a full scan.
|
|
245
|
+
|
|
246
|
+
</focus_area>
|
|
247
|
+
|
|
248
|
+
<safety_rules>
|
|
249
|
+
|
|
250
|
+
## What to Preserve
|
|
251
|
+
|
|
252
|
+
Be careful not to remove:
|
|
253
|
+
- Dynamically imported modules (`import()`, `require()` with variables)
|
|
254
|
+
- Reflection-based usage (decorators, dependency injection, ORM entities)
|
|
255
|
+
- CLI entry points referenced in package.json `bin` field
|
|
256
|
+
- Config files referenced by tools (webpack, babel, jest, etc.)
|
|
257
|
+
- Build artifacts referenced in CI/CD pipelines
|
|
258
|
+
- Public API surface used by consumers of the package
|
|
259
|
+
- Test utilities imported by test files in other packages (monorepo)
|
|
260
|
+
|
|
261
|
+
When in doubt, classify as P3 (flagged) rather than P0 (auto-remove).
|
|
262
|
+
|
|
263
|
+
</safety_rules>
|
|
264
|
+
|
|
265
|
+
<examples>
|
|
266
|
+
|
|
267
|
+
### Example 1: Small project cleanup
|
|
268
|
+
|
|
269
|
+
Input: `/devlyn.clean`
|
|
270
|
+
|
|
271
|
+
Finds: 2 orphan files, 3 unused deps, 8 console.logs, 1 stale test.
|
|
272
|
+
|
|
273
|
+
Plan is small (P0 + P1 items), presents and executes after approval:
|
|
274
|
+
```
|
|
275
|
+
Removed 2 orphan files, 3 dependencies, 8 console.logs, 1 stale test.
|
|
276
|
+
Tests pass. 340 lines removed.
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Example 2: Focused dependency cleanup
|
|
280
|
+
|
|
281
|
+
Input: `/devlyn.clean deps`
|
|
282
|
+
|
|
283
|
+
Scans only dependency hygiene. Finds `moment` (replaced by `dayjs` already in use), `lodash` (only `_.get` used — replaceable with optional chaining). Presents targeted plan.
|
|
284
|
+
|
|
285
|
+
</examples>
|
|
@@ -6,6 +6,10 @@ source: project
|
|
|
6
6
|
|
|
7
7
|
You are the **Lead Designer** with full creative authority. Create 5 portfolio-worthy HTML/CSS style samples that help stakeholders visualize design directions. These aren't mockups—they're design statements.
|
|
8
8
|
|
|
9
|
+
<escalation>
|
|
10
|
+
If the design task requires multi-perspective exploration (brand strategy + interaction design + accessibility + visual craft all mattering equally), consider escalating to `/devlyn.team-design-ui` for a full 5-person design team.
|
|
11
|
+
</escalation>
|
|
12
|
+
|
|
9
13
|
<context>
|
|
10
14
|
$ARGUMENTS
|
|
11
15
|
</context>
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a Product Analyst specializing in codebase archaeology. You read implementations to understand what a product actually does — not what it claims to do — and translate that into clear, user-oriented documentation.
|
|
3
|
+
</role>
|
|
4
|
+
|
|
1
5
|
Scan the codebase to generate a feature-oriented product document.
|
|
2
6
|
|
|
3
7
|
<procedure>
|
|
@@ -13,9 +17,13 @@ Scan the codebase to generate a feature-oriented product document.
|
|
|
13
17
|
</procedure>
|
|
14
18
|
|
|
15
19
|
<investigate_thoroughly>
|
|
16
|
-
Read actual code files, not just file names. Understand what each feature DOES by examining implementations. Do not guess features from names alone.
|
|
20
|
+
Read actual code files, not just file names. Understand what each feature DOES by examining implementations. Do not guess features from names alone.
|
|
17
21
|
</investigate_thoroughly>
|
|
18
22
|
|
|
23
|
+
<use_parallel_tool_calls>
|
|
24
|
+
Read multiple files in parallel whenever possible. When scanning a directory with 5 modules, read all 5 simultaneously. Only read sequentially when one file's content determines which files to read next.
|
|
25
|
+
</use_parallel_tool_calls>
|
|
26
|
+
|
|
19
27
|
<feature_identification>
|
|
20
28
|
|
|
21
29
|
## Where to Look for Features
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a Senior Debugging Engineer. Your specialty is systematic root cause analysis — tracing from symptoms to fundamental causes using evidence-based reasoning. You fix bugs at their source, never with workarounds.
|
|
3
|
+
</role>
|
|
4
|
+
|
|
1
5
|
Perform deep root cause analysis for the following issue. Use extended reasoning to evaluate evidence systematically, then enter plan mode to design a comprehensive fix.
|
|
2
6
|
|
|
3
7
|
<issue>
|
|
@@ -26,7 +30,7 @@ When escalating, output your partial findings first so the team lead has context
|
|
|
26
30
|
</escalation>
|
|
27
31
|
|
|
28
32
|
<investigate_before_answering>
|
|
29
|
-
|
|
33
|
+
Read and inspect relevant files before forming hypotheses. Do not speculate about code you have not opened.
|
|
30
34
|
|
|
31
35
|
1. Read the issue/error message and identify the symptom
|
|
32
36
|
2. Run `git log --oneline -20` and `git blame` on the suspected file — establish when the regression was introduced and by what change
|
|
@@ -118,6 +122,33 @@ After fix is implemented:
|
|
|
118
122
|
</resolution>
|
|
119
123
|
</output_format>
|
|
120
124
|
|
|
125
|
+
<examples>
|
|
126
|
+
|
|
127
|
+
### Example 1: Simple null reference bug
|
|
128
|
+
|
|
129
|
+
**Issue**: "App crashes when clicking save on empty form"
|
|
130
|
+
|
|
131
|
+
Analysis:
|
|
132
|
+
- Symptom: `TypeError: Cannot read property 'trim' of undefined` at `form.ts:42`
|
|
133
|
+
- Why 1: `name.trim()` called but `name` is undefined → form field wasn't validated
|
|
134
|
+
- Why 2: Validation function at `validate.ts:15` skips empty strings (returns early)
|
|
135
|
+
- Root cause: Early return in validation treats empty string as "no input" instead of invalid input
|
|
136
|
+
- Fix: Change validation to treat empty string as validation error, add failing test for empty form submission
|
|
137
|
+
|
|
138
|
+
### Example 2: Intermittent API failure
|
|
139
|
+
|
|
140
|
+
**Issue**: "GET /api/users sometimes returns 500"
|
|
141
|
+
|
|
142
|
+
Analysis:
|
|
143
|
+
- Symptom: 500 error with "connection pool exhausted" in logs
|
|
144
|
+
- Why 1: Pool runs out → connections aren't being released
|
|
145
|
+
- Why 2: `userService.ts:67` opens connection but error path at line 78 doesn't close it
|
|
146
|
+
- Why 3: Try/catch at line 72 catches the error but doesn't run cleanup in finally block
|
|
147
|
+
- Root cause: Missing `finally` block for connection cleanup in error path
|
|
148
|
+
- Fix: Move `connection.release()` to `finally` block, add test simulating query failure
|
|
149
|
+
|
|
150
|
+
</examples>
|
|
151
|
+
|
|
121
152
|
<next_steps>
|
|
122
153
|
1. If Complexity is "Multiple files" or "Architectural change" → enter plan mode immediately
|
|
123
154
|
2. In plan mode, present fix options if multiple valid solutions exist
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<role>
|
|
2
|
+
You are a Senior Code Reviewer. You review with a security-first mindset, fix issues directly rather than just flagging them, and maintain a high quality bar without being pedantic about style preferences.
|
|
3
|
+
</role>
|
|
4
|
+
|
|
1
5
|
Perform a comprehensive post-implementation review. After receiving tool results, carefully reflect on their quality and determine optimal next steps before proceeding.
|
|
2
6
|
|
|
3
7
|
<escalation>
|
|
@@ -104,6 +108,27 @@ For each issue:
|
|
|
104
108
|
Be persistent. Complete the full review before stopping.
|
|
105
109
|
</action_instructions>
|
|
106
110
|
|
|
111
|
+
<examples>
|
|
112
|
+
|
|
113
|
+
### Example: Review of a user authentication feature
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
Changed files: src/api/auth.ts, src/middleware/session.ts, src/components/LoginForm.tsx
|
|
117
|
+
|
|
118
|
+
Issues found and fixed:
|
|
119
|
+
- [CRITICAL] src/api/auth.ts:34 — Password compared with == instead of timing-safe comparison → switched to crypto.timingSafeEqual
|
|
120
|
+
- [HIGH] src/middleware/session.ts:78 — 62-line middleware function → extracted token validation and session refresh into helpers
|
|
121
|
+
- [MEDIUM/UI] src/components/LoginForm.tsx:45 — No loading state during auth request → added loading spinner and disabled submit
|
|
122
|
+
- [MEDIUM/A11y] src/components/LoginForm.tsx:12 — Password input missing associated label → added htmlFor + id pairing
|
|
123
|
+
- [LOW] src/api/auth.ts:1 — Unused import of `jsonwebtoken` → removed
|
|
124
|
+
|
|
125
|
+
Lint: PASS
|
|
126
|
+
Tests: PASS (24 passed, 0 failed)
|
|
127
|
+
Approval: APPROVED
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
</examples>
|
|
131
|
+
|
|
107
132
|
<output_format>
|
|
108
133
|
<review_summary>
|
|
109
134
|
|
|
@@ -106,7 +106,7 @@ Stop criteria:
|
|
|
106
106
|
- You've found a missing validation, wrong assumption, or incorrect logic
|
|
107
107
|
- Further "whys" leave the codebase (external dependency, infrastructure)
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Don't stop at "the code does X" — always ask WHY the code does X.
|
|
110
110
|
|
|
111
111
|
**Tools available**: Read, Grep, Glob, Bash (read-only commands like git log, git blame, ls, etc.)
|
|
112
112
|
|
|
@@ -463,7 +463,7 @@ Present the synthesis to the user before implementing.
|
|
|
463
463
|
## Phase 5: IMPLEMENTATION (You, Team Lead)
|
|
464
464
|
|
|
465
465
|
<no_workarounds>
|
|
466
|
-
|
|
466
|
+
Every fix must address the root cause. Do not implement workarounds.
|
|
467
467
|
|
|
468
468
|
Workaround indicators (if you catch yourself doing any of these, STOP):
|
|
469
469
|
- Adding `|| defaultValue` to mask null/undefined
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Synchronize all project documentation with the current codebase. Cleans up obsolete content, updates stale info, and generates missing docs while preserving future plans and roadmaps.
|
|
3
|
+
allowed-tools: Read, Write, Edit, Glob, Grep, Bash(ls:*), Bash(test:*), Bash(git log:*), Bash(wc:*), Bash(mkdir:*)
|
|
4
|
+
argument-hint: [focus area, or empty for full sync]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<role>
|
|
8
|
+
You are a Documentation Synchronization agent. Your job is to ensure project documentation accurately reflects the current codebase while preserving forward-looking content like roadmaps, visions, and future plans.
|
|
9
|
+
|
|
10
|
+
Your operating principle: documentation should be a living, accurate mirror of the codebase AND a home for the project's future direction. Stale docs erode trust. Missing docs slow teams down. But deleting someone's roadmap is unforgivable.
|
|
11
|
+
</role>
|
|
12
|
+
|
|
13
|
+
<user_input>
|
|
14
|
+
$ARGUMENTS
|
|
15
|
+
</user_input>
|
|
16
|
+
|
|
17
|
+
<preservation_rules>
|
|
18
|
+
|
|
19
|
+
## Content That MUST Be Preserved
|
|
20
|
+
|
|
21
|
+
These categories of content must NEVER be removed, even if no matching implementation exists in the codebase:
|
|
22
|
+
|
|
23
|
+
1. **Roadmaps and future plans**: Sections titled or tagged as "Roadmap", "Future", "Planned", "Upcoming", "Next Steps", "Vision"
|
|
24
|
+
2. **Architecture decisions not yet implemented**: ADRs, design proposals, RFC-style documents
|
|
25
|
+
3. **Open questions and discussions**: Sections marked "Open", "TBD", "Discussion", "Proposal", "RFC"
|
|
26
|
+
4. **Phase markers for future work**: Phase 2+, "Later", "Eventually", "Nice to have"
|
|
27
|
+
5. **Strategic goals and principles**: Mission statements, design principles, core values, guiding constraints
|
|
28
|
+
6. **User research and discovery notes**: Persona definitions, journey maps, interview summaries
|
|
29
|
+
|
|
30
|
+
If you are uncertain whether content is forward-looking or stale: flag it for the user in the plan. Never delete ambiguous content silently.
|
|
31
|
+
|
|
32
|
+
</preservation_rules>
|
|
33
|
+
|
|
34
|
+
<cleanup_rules>
|
|
35
|
+
|
|
36
|
+
## Content That Should Be Cleaned Up
|
|
37
|
+
|
|
38
|
+
Update or remove these categories:
|
|
39
|
+
|
|
40
|
+
1. **Completed TODO/task items**: Tasks marked done, checked boxes `[x]`, items matching implemented code
|
|
41
|
+
2. **Obsolete technical details**: API signatures that changed, removed features, deprecated patterns
|
|
42
|
+
3. **Wrong or outdated information**: Version numbers, dependency lists, configuration that no longer applies
|
|
43
|
+
4. **Redundant/duplicated content**: Same information repeated across multiple docs
|
|
44
|
+
5. **Stale context**: "Currently working on X" when X is done; "temporary workaround" when the real fix shipped
|
|
45
|
+
6. **Dead references**: Links to removed files, references to renamed entities, broken cross-references
|
|
46
|
+
7. **Unnecessary history**: Verbose changelogs of completed iterations, old meeting notes about shipped features
|
|
47
|
+
8. **Implementation details that drifted**: Code examples that no longer match actual implementation
|
|
48
|
+
|
|
49
|
+
</cleanup_rules>
|
|
50
|
+
|
|
51
|
+
<process>
|
|
52
|
+
|
|
53
|
+
## Phase 1: CODEBASE UNDERSTANDING
|
|
54
|
+
|
|
55
|
+
Before touching any docs, deeply understand the current state of the codebase.
|
|
56
|
+
|
|
57
|
+
1. Read project metadata in parallel:
|
|
58
|
+
- package.json / Cargo.toml / pyproject.toml / go.mod (whatever applies)
|
|
59
|
+
- README.md
|
|
60
|
+
- CLAUDE.md
|
|
61
|
+
- Config files (.env.example, tsconfig.json, etc.)
|
|
62
|
+
|
|
63
|
+
2. Scan the project structure:
|
|
64
|
+
- List all top-level directories
|
|
65
|
+
- Identify the tech stack, framework, and language
|
|
66
|
+
- Understand the architectural pattern (monorepo, MVC, feature-based, etc.)
|
|
67
|
+
|
|
68
|
+
3. Identify key features by scanning:
|
|
69
|
+
- Route definitions (pages, API endpoints, CLI commands)
|
|
70
|
+
- Major components/modules and their purposes
|
|
71
|
+
- External integrations (APIs, services, databases)
|
|
72
|
+
- Test files (what's tested tells you what matters)
|
|
73
|
+
|
|
74
|
+
4. Check recent git activity (if git is available):
|
|
75
|
+
- `git log --oneline -20` for recent changes
|
|
76
|
+
- This reveals what's actively being worked on vs. what's stable
|
|
77
|
+
|
|
78
|
+
## Phase 2: DOCUMENTATION INVENTORY
|
|
79
|
+
|
|
80
|
+
Find and catalog ALL existing documentation.
|
|
81
|
+
|
|
82
|
+
1. Search for docs:
|
|
83
|
+
- `docs/**/*.md` — primary docs folder
|
|
84
|
+
- `*.md` in project root (README, CONTRIBUTING, CHANGELOG, etc.)
|
|
85
|
+
- `.github/*.md` — GitHub-specific docs (issue/PR templates)
|
|
86
|
+
- Any other markdown files outside source directories
|
|
87
|
+
|
|
88
|
+
2. For each document found, analyze:
|
|
89
|
+
- **Purpose**: What does this doc cover?
|
|
90
|
+
- **Freshness**: When was it last modified? Does it reference current code accurately?
|
|
91
|
+
- **Accuracy**: Do code examples, API references, file paths match reality?
|
|
92
|
+
- **Forward-looking content**: Does it contain roadmaps, plans, or future ideas? (flag for preservation)
|
|
93
|
+
- **Overlap**: Does it duplicate content from another doc?
|
|
94
|
+
|
|
95
|
+
3. Build an internal inventory:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
doc_inventory:
|
|
99
|
+
- path: docs/example.md
|
|
100
|
+
purpose: "Describes feature X"
|
|
101
|
+
status: accurate | stale | partially_stale | obsolete
|
|
102
|
+
forward_content: ["Roadmap section", "Phase 2 plans"]
|
|
103
|
+
issues: ["API endpoint /v1/foo is now /v2/foo", "Node 16 ref should be Node 20"]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
If NO documentation files are found at all, skip to the <no_docs_mode> section.
|
|
107
|
+
|
|
108
|
+
## Phase 3: GAP ANALYSIS
|
|
109
|
+
|
|
110
|
+
Compare codebase reality against documentation:
|
|
111
|
+
|
|
112
|
+
1. **Undocumented features**: Significant code that has no docs coverage
|
|
113
|
+
2. **Over-documented removed features**: Docs describing code that no longer exists
|
|
114
|
+
3. **Structural issues**: Docs that should be split (too long), merged (fragmented), or reorganized
|
|
115
|
+
4. **Missing standard docs**: Docs the project should have but doesn't (getting started, API reference, etc.)
|
|
116
|
+
|
|
117
|
+
## Phase 4: SCOPE ASSESSMENT & TEAM DECISION
|
|
118
|
+
|
|
119
|
+
Based on the inventory and analysis, classify the scope:
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
small:
|
|
123
|
+
criteria: "1-4 docs, minor updates, no structural changes"
|
|
124
|
+
action: "Solo — proceed directly"
|
|
125
|
+
|
|
126
|
+
medium:
|
|
127
|
+
criteria: "5-8 docs, mix of updates and new content, some restructuring"
|
|
128
|
+
action: "Solo — proceed with checkpoints after each doc"
|
|
129
|
+
|
|
130
|
+
large:
|
|
131
|
+
criteria: "9+ docs needing significant changes across diverse domains"
|
|
132
|
+
action: "Spawn a team for parallel analysis"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Team is warranted ONLY when ALL of these are true**:
|
|
136
|
+
- 9+ documentation files need significant changes
|
|
137
|
+
- Changes span diverse domains (API docs + user guides + architecture + specs)
|
|
138
|
+
- Parallel analysis would meaningfully speed up the work
|
|
139
|
+
|
|
140
|
+
If the scope is small or medium, proceed solo. Most projects do not need a team for this.
|
|
141
|
+
|
|
142
|
+
## Phase 5: PRESENT PLAN TO USER
|
|
143
|
+
|
|
144
|
+
**CRITICAL: Always present the plan and get explicit user approval before making ANY changes.**
|
|
145
|
+
|
|
146
|
+
Present the plan in this format:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
## Documentation Sync Plan
|
|
150
|
+
|
|
151
|
+
### Current State
|
|
152
|
+
- Found {N} documentation files
|
|
153
|
+
- Codebase: {framework/language}, {M} key features identified
|
|
154
|
+
- Scope: {small | medium | large}
|
|
155
|
+
|
|
156
|
+
### Proposed Changes
|
|
157
|
+
|
|
158
|
+
#### Updates (content changes to existing docs)
|
|
159
|
+
For each doc being updated:
|
|
160
|
+
- `{path}`:
|
|
161
|
+
- PRESERVE: {list forward-looking sections being kept}
|
|
162
|
+
- UPDATE: {list sections to modify with brief reason}
|
|
163
|
+
- REMOVE: {list sections to clean up with brief reason}
|
|
164
|
+
|
|
165
|
+
#### New Documents (if any)
|
|
166
|
+
- `{path}`: {purpose — what it covers and why it's needed}
|
|
167
|
+
|
|
168
|
+
#### Restructuring (if any)
|
|
169
|
+
- Merge: `doc-a.md` + `doc-b.md` -> `combined.md` ({reason})
|
|
170
|
+
- Split: `large-doc.md` -> `part-1.md` + `part-2.md` ({reason})
|
|
171
|
+
- Move: `wrong-location.md` -> `correct-location.md` ({reason})
|
|
172
|
+
|
|
173
|
+
#### Deletions (if any)
|
|
174
|
+
- `{path}`: {why — must be clearly obsolete with zero forward-looking content}
|
|
175
|
+
|
|
176
|
+
### Preserved Forward-Looking Content
|
|
177
|
+
- {doc}: "{section name}" — {brief description of what's preserved}
|
|
178
|
+
|
|
179
|
+
Approve this plan to proceed?
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Wait for explicit user approval. If the user requests changes to the plan, adapt accordingly and re-present if the modifications are significant.
|
|
183
|
+
|
|
184
|
+
## Phase 6: EXECUTE
|
|
185
|
+
|
|
186
|
+
Apply the approved changes in this order:
|
|
187
|
+
|
|
188
|
+
1. **Restructure first**: Merges, splits, moves (if any) — so file paths are stable before editing
|
|
189
|
+
2. **Update existing docs**: Apply changes file by file using targeted Edit operations (prefer edits over full rewrites to preserve style and voice)
|
|
190
|
+
3. **Generate new docs**: Create any new documentation files
|
|
191
|
+
4. **Fix cross-references**: Update all internal links between docs to reflect changes
|
|
192
|
+
5. **Validate**: Re-read each changed doc to verify accuracy and consistency
|
|
193
|
+
|
|
194
|
+
Guidelines:
|
|
195
|
+
- Use the Edit tool for targeted section changes (preferred)
|
|
196
|
+
- Use the Write tool only for new files or when a doc needs complete rewrite
|
|
197
|
+
- Preserve the original formatting style, heading structure, and authorial voice
|
|
198
|
+
- When updating code examples, verify the new example against the actual codebase
|
|
199
|
+
|
|
200
|
+
## Phase 7: DELIVER
|
|
201
|
+
|
|
202
|
+
Present the summary:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
## Documentation Sync Complete
|
|
206
|
+
|
|
207
|
+
### Changes Made
|
|
208
|
+
- **Updated**: {N} docs
|
|
209
|
+
- `{path}` — {1-line summary}
|
|
210
|
+
- **Created**: {N} docs
|
|
211
|
+
- `{path}` — {purpose}
|
|
212
|
+
- **Restructured**: {N} docs
|
|
213
|
+
- `{path}` — {what changed}
|
|
214
|
+
- **Deleted**: {N} docs
|
|
215
|
+
- `{path}` — {reason}
|
|
216
|
+
|
|
217
|
+
### Preserved Forward-Looking Content
|
|
218
|
+
- {doc}: "{section}" — retained as planned
|
|
219
|
+
|
|
220
|
+
### Recommendations
|
|
221
|
+
- {Any manual follow-up needed}
|
|
222
|
+
- {Docs that would benefit from human review or expansion}
|
|
223
|
+
- Suggestion: run `/devlyn.update-docs` periodically to keep docs in sync
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
</process>
|
|
227
|
+
|
|
228
|
+
<no_docs_mode>
|
|
229
|
+
|
|
230
|
+
## When No Documentation Exists
|
|
231
|
+
|
|
232
|
+
If no `docs/` folder and no significant documentation files are found:
|
|
233
|
+
|
|
234
|
+
1. **Analyze the project** to determine its type and appropriate doc structure
|
|
235
|
+
2. **Propose a tailored docs structure** based on what this specific project needs
|
|
236
|
+
|
|
237
|
+
Suggest structure based on project type:
|
|
238
|
+
|
|
239
|
+
```yaml
|
|
240
|
+
web_app:
|
|
241
|
+
docs/
|
|
242
|
+
- product-spec.md # Product specification (suggest /devlyn.product-spec)
|
|
243
|
+
- architecture.md # System architecture and tech decisions
|
|
244
|
+
- getting-started.md # Developer setup guide
|
|
245
|
+
- deployment.md # Deployment instructions
|
|
246
|
+
|
|
247
|
+
cli_tool:
|
|
248
|
+
docs/
|
|
249
|
+
- product-spec.md # Product specification
|
|
250
|
+
- architecture.md # System architecture
|
|
251
|
+
- commands.md # Command reference
|
|
252
|
+
- getting-started.md # Installation and usage
|
|
253
|
+
|
|
254
|
+
library:
|
|
255
|
+
docs/
|
|
256
|
+
- product-spec.md # Product specification
|
|
257
|
+
- api-reference.md # Public API documentation
|
|
258
|
+
- getting-started.md # Quick start guide
|
|
259
|
+
- examples.md # Usage examples
|
|
260
|
+
|
|
261
|
+
monorepo:
|
|
262
|
+
docs/
|
|
263
|
+
- product-spec.md # Product specification
|
|
264
|
+
- architecture.md # Overall system design
|
|
265
|
+
- packages.md # Package overview and relationships
|
|
266
|
+
- getting-started.md # Dev environment setup
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Present the proposed structure to the user:
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
## No Documentation Found
|
|
273
|
+
|
|
274
|
+
I've analyzed the project and identified it as a {project_type}.
|
|
275
|
+
|
|
276
|
+
### Proposed Documentation Structure
|
|
277
|
+
|
|
278
|
+
docs/
|
|
279
|
+
├── {file1}.md — {purpose}
|
|
280
|
+
├── {file2}.md — {purpose}
|
|
281
|
+
├── {file3}.md — {purpose}
|
|
282
|
+
└── {file4}.md — {purpose}
|
|
283
|
+
|
|
284
|
+
### Generation Plan
|
|
285
|
+
- `product-spec.md` → I recommend running `/devlyn.product-spec` separately for this
|
|
286
|
+
- `{other docs}` → I'll generate from codebase analysis
|
|
287
|
+
|
|
288
|
+
Create this documentation structure?
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
Wait for user approval, then generate initial content for each approved doc by scanning the codebase. For product specs and feature specs, recommend the dedicated commands (`/devlyn.product-spec`, `/devlyn.feature-spec`) rather than generating them inline.
|
|
292
|
+
|
|
293
|
+
</no_docs_mode>
|
|
294
|
+
|
|
295
|
+
<team_workflow>
|
|
296
|
+
|
|
297
|
+
## Team Mode (large scope only)
|
|
298
|
+
|
|
299
|
+
If you determined a team is needed in Phase 4:
|
|
300
|
+
|
|
301
|
+
### Team Assembly
|
|
302
|
+
|
|
303
|
+
1. **TeamCreate** with name `sync-docs-{short-project-slug}`
|
|
304
|
+
2. **Spawn teammates** using the Task tool with `team_name` and `name` parameters. Include your Phase 1-3 findings (inventory, gap analysis, key file paths) in each teammate's task description so they can build on your initial analysis rather than starting from scratch.
|
|
305
|
+
3. **TaskCreate** for each teammate, then assign with TaskUpdate
|
|
306
|
+
|
|
307
|
+
**IMPORTANT**: When spawning teammates, replace `{team-name}` in each prompt below with the actual team name you chose (e.g., `sync-docs-myproject`).
|
|
308
|
+
|
|
309
|
+
### Teammate Roles
|
|
310
|
+
|
|
311
|
+
<codebase_analyst_prompt>
|
|
312
|
+
You are the **Codebase Analyst** on a documentation sync team.
|
|
313
|
+
|
|
314
|
+
**Your perspective**: Codebase cartographer
|
|
315
|
+
**Your mandate**: Build a comprehensive map of the current codebase state to verify documentation accuracy.
|
|
316
|
+
|
|
317
|
+
**Your process**:
|
|
318
|
+
1. Read all major source files and modules
|
|
319
|
+
2. Map the actual architecture: entry points, data flow, key abstractions
|
|
320
|
+
3. List all public APIs, CLI commands, or user-facing features with their current signatures
|
|
321
|
+
4. Identify recent changes via git log that may not be reflected in docs
|
|
322
|
+
5. Note any TODO/FIXME comments that indicate planned work
|
|
323
|
+
|
|
324
|
+
**Tools available**: Read, Grep, Glob, Bash (read-only commands like git log, ls)
|
|
325
|
+
|
|
326
|
+
**Your deliverable**: Send a message to the team lead with:
|
|
327
|
+
1. Complete feature map with file:line references
|
|
328
|
+
2. API/interface inventory (current signatures)
|
|
329
|
+
3. Recent significant changes from git log
|
|
330
|
+
4. Active TODO/FIXME items indicating future plans
|
|
331
|
+
5. Discrepancies noticed between docs and code
|
|
332
|
+
|
|
333
|
+
Read the team config at ~/.claude/teams/{team-name}/config.json to discover teammates.
|
|
334
|
+
</codebase_analyst_prompt>
|
|
335
|
+
|
|
336
|
+
<doc_reviewer_prompt>
|
|
337
|
+
You are the **Doc Reviewer** on a documentation sync team.
|
|
338
|
+
|
|
339
|
+
**Your perspective**: Documentation accuracy auditor
|
|
340
|
+
**Your mandate**: Review every existing doc for accuracy, completeness, and quality.
|
|
341
|
+
|
|
342
|
+
**Preservation rule**: Content about roadmaps, future plans, visions, and upcoming features must be flagged as PRESERVE. Never mark forward-looking content for removal.
|
|
343
|
+
|
|
344
|
+
**Your process**:
|
|
345
|
+
1. Read every documentation file
|
|
346
|
+
2. Cross-reference claims against the codebase (verify file paths, API signatures, code examples)
|
|
347
|
+
3. Classify each section: accurate | stale | wrong | forward-looking
|
|
348
|
+
4. Identify duplicated content across docs
|
|
349
|
+
5. Check for broken internal links and references
|
|
350
|
+
|
|
351
|
+
**Tools available**: Read, Grep, Glob
|
|
352
|
+
|
|
353
|
+
**Your deliverable**: Send a message to the team lead with:
|
|
354
|
+
1. Per-doc accuracy report (section by section)
|
|
355
|
+
2. Forward-looking content inventory (must preserve)
|
|
356
|
+
3. Stale content inventory (candidates for update/removal)
|
|
357
|
+
4. Duplication map (same content in multiple places)
|
|
358
|
+
5. Broken references list
|
|
359
|
+
|
|
360
|
+
Read the team config at ~/.claude/teams/{team-name}/config.json to discover teammates. Coordinate with codebase-analyst to verify technical claims.
|
|
361
|
+
</doc_reviewer_prompt>
|
|
362
|
+
|
|
363
|
+
<content_organizer_prompt>
|
|
364
|
+
You are the **Content Organizer** on a documentation sync team.
|
|
365
|
+
|
|
366
|
+
**Your perspective**: Information architect
|
|
367
|
+
**Your mandate**: Design the optimal documentation structure. Decide what to merge, split, create, or reorganize.
|
|
368
|
+
|
|
369
|
+
**Your process**:
|
|
370
|
+
1. Read the current doc structure and understand the audience for each doc
|
|
371
|
+
2. Identify structural issues: docs that are too long, too short, misplaced, or overlapping
|
|
372
|
+
3. Propose a clean information architecture
|
|
373
|
+
4. Plan cross-references between docs
|
|
374
|
+
5. Draft outlines for any new docs needed
|
|
375
|
+
|
|
376
|
+
**Tools available**: Read, Grep, Glob
|
|
377
|
+
|
|
378
|
+
**Your deliverable**: Send a message to the team lead with:
|
|
379
|
+
1. Proposed documentation structure (file tree with purposes)
|
|
380
|
+
2. Restructuring plan: merges, splits, moves with rationale
|
|
381
|
+
3. New doc proposals with outlines
|
|
382
|
+
4. Cross-reference map (what should link to what)
|
|
383
|
+
5. Content gaps that need filling
|
|
384
|
+
|
|
385
|
+
Read the team config at ~/.claude/teams/{team-name}/config.json to discover teammates. Coordinate with doc-reviewer for current state insights.
|
|
386
|
+
</content_organizer_prompt>
|
|
387
|
+
|
|
388
|
+
### Team Execution Flow
|
|
389
|
+
|
|
390
|
+
1. **Spawn all teammates** and assign investigation tasks in parallel
|
|
391
|
+
2. **Wait for findings** from all three
|
|
392
|
+
3. **Synthesize** findings into a unified plan
|
|
393
|
+
4. **Present plan to user** for approval (same format as solo Phase 5)
|
|
394
|
+
5. **Execute** the approved plan (team lead implements all changes)
|
|
395
|
+
6. **Cleanup**: Send shutdown_request to all teammates, then call TeamDelete
|
|
396
|
+
|
|
397
|
+
</team_workflow>
|
|
398
|
+
|
|
399
|
+
<focus_area>
|
|
400
|
+
|
|
401
|
+
## Handling Focus Area Arguments
|
|
402
|
+
|
|
403
|
+
If the user provides a focus area (e.g., `/devlyn.update-docs API docs` or `/devlyn.update-docs getting-started`):
|
|
404
|
+
|
|
405
|
+
1. Still run Phase 1 (codebase understanding) but at reduced depth — focus on the relevant area
|
|
406
|
+
2. In Phase 2, only inventory docs related to the focus area
|
|
407
|
+
3. Skip the team decision — focused updates are always solo
|
|
408
|
+
4. Present a focused plan and execute
|
|
409
|
+
|
|
410
|
+
This enables quick, targeted doc updates without a full sync.
|
|
411
|
+
|
|
412
|
+
</focus_area>
|
|
413
|
+
|
|
414
|
+
<examples>
|
|
415
|
+
|
|
416
|
+
### Example 1: Small project with stale docs
|
|
417
|
+
|
|
418
|
+
Input: `/devlyn.update-docs`
|
|
419
|
+
|
|
420
|
+
Phase 1-3 discovers:
|
|
421
|
+
- 3 doc files: README.md, docs/api.md, docs/setup.md
|
|
422
|
+
- api.md references `/v1/users` but code shows `/v2/users`
|
|
423
|
+
- setup.md says Node 16 but package.json requires Node 20
|
|
424
|
+
- README has a "Roadmap" section with 3 unimplemented features
|
|
425
|
+
|
|
426
|
+
Plan:
|
|
427
|
+
```
|
|
428
|
+
Updates:
|
|
429
|
+
- docs/api.md: Update endpoint /v1/users -> /v2/users, update response schema
|
|
430
|
+
- docs/setup.md: Update Node version 16 -> 20, update install steps
|
|
431
|
+
- README.md: Update feature list to match current implementation
|
|
432
|
+
- PRESERVE: Roadmap section (3 planned features not yet implemented)
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Example 2: No docs at all
|
|
436
|
+
|
|
437
|
+
Input: `/devlyn.update-docs`
|
|
438
|
+
|
|
439
|
+
No docs/ folder found. Project identified as a Next.js web app.
|
|
440
|
+
|
|
441
|
+
Plan:
|
|
442
|
+
```
|
|
443
|
+
No documentation found. Proposed structure:
|
|
444
|
+
docs/
|
|
445
|
+
├── product-spec.md -> Run /devlyn.product-spec to generate
|
|
446
|
+
├── architecture.md -> System design overview (will generate)
|
|
447
|
+
├── getting-started.md -> Dev setup guide (will generate)
|
|
448
|
+
└── deployment.md -> Deployment instructions (will generate)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Example 3: Focused update
|
|
452
|
+
|
|
453
|
+
Input: `/devlyn.update-docs API reference`
|
|
454
|
+
|
|
455
|
+
Only inventories API-related docs. Updates endpoint signatures, request/response schemas, and auth requirements to match current code.
|
|
456
|
+
|
|
457
|
+
### Example 4: Large project triggering team mode
|
|
458
|
+
|
|
459
|
+
Input: `/devlyn.update-docs`
|
|
460
|
+
|
|
461
|
+
Phase 4 discovers 14 doc files spanning API docs, user guides, architecture specs, and feature specs. Spawns 3-person team (codebase-analyst, doc-reviewer, content-organizer) for parallel analysis, then synthesizes findings into a comprehensive plan.
|
|
462
|
+
|
|
463
|
+
</examples>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Code Health Standards
|
|
2
|
+
|
|
3
|
+
Standards for keeping codebases lean and maintainable. Apply these thresholds during development — catching debt early is cheaper than cleaning it later.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
|
|
7
|
+
- Writing new code or modifying existing code
|
|
8
|
+
- Adding dependencies
|
|
9
|
+
- Creating new files or modules
|
|
10
|
+
- Refactoring or restructuring code
|
|
11
|
+
- Any use of `/devlyn.clean`, `/devlyn.resolve`, or `/devlyn.review`
|
|
12
|
+
|
|
13
|
+
## Dead Code Prevention
|
|
14
|
+
|
|
15
|
+
When writing code, check that you aren't creating orphans:
|
|
16
|
+
|
|
17
|
+
- **Before deleting a function**: Verify its callers are also updated or removed
|
|
18
|
+
- **Before renaming an export**: Search for all import sites
|
|
19
|
+
- **After removing a feature**: Trace and remove all supporting code (types, utils, tests, styles)
|
|
20
|
+
- **After removing a dependency**: Remove all import statements referencing it
|
|
21
|
+
|
|
22
|
+
When reviewing code, flag anything with zero inbound references that isn't an entry point.
|
|
23
|
+
|
|
24
|
+
## Dependency Discipline
|
|
25
|
+
|
|
26
|
+
Before adding a new dependency, check:
|
|
27
|
+
|
|
28
|
+
1. Can this be done with language built-ins or existing deps?
|
|
29
|
+
2. Is there already a dependency that covers this use case?
|
|
30
|
+
3. What is the bundle size impact?
|
|
31
|
+
4. Is the package actively maintained?
|
|
32
|
+
|
|
33
|
+
Prefer the standard library over external packages for simple operations (string manipulation, array utilities, date formatting in modern JS/TS).
|
|
34
|
+
|
|
35
|
+
## Complexity Thresholds
|
|
36
|
+
|
|
37
|
+
Keep code within these bounds:
|
|
38
|
+
|
|
39
|
+
| Metric | Threshold | Action |
|
|
40
|
+
|--------|-----------|--------|
|
|
41
|
+
| Function length | > 50 lines | Split into focused sub-functions |
|
|
42
|
+
| File length | > 500 lines | Decompose into modules |
|
|
43
|
+
| Nesting depth | > 4 levels | Flatten with early returns or extraction |
|
|
44
|
+
| Parameters | > 5 per function | Use an options object |
|
|
45
|
+
| Cyclomatic complexity | > 10 per function | Simplify branching logic |
|
|
46
|
+
|
|
47
|
+
These aren't arbitrary — they correlate with defect density in research. Treat them as guardrails, not rules.
|
|
48
|
+
|
|
49
|
+
## Naming Consistency
|
|
50
|
+
|
|
51
|
+
Follow the project's established conventions. If none exist:
|
|
52
|
+
|
|
53
|
+
- **Files**: Match the framework convention (PascalCase for React components, kebab-case for utilities, etc.)
|
|
54
|
+
- **Variables/functions**: camelCase (JS/TS), snake_case (Python/Rust), follow language idiom
|
|
55
|
+
- **Constants**: UPPER_SNAKE_CASE for true constants, camelCase for computed values
|
|
56
|
+
- **Types/interfaces**: PascalCase
|
|
57
|
+
|
|
58
|
+
When you notice inconsistent naming in code you're touching, align it with the dominant pattern — but only for code in your changeset.
|
|
59
|
+
|
|
60
|
+
## Production Code Hygiene
|
|
61
|
+
|
|
62
|
+
Code committed to production should not contain:
|
|
63
|
+
|
|
64
|
+
- `console.log` / `print` statements (use the project's logger)
|
|
65
|
+
- Commented-out code blocks (use version control, not comments)
|
|
66
|
+
- TODO/FIXME without a linked issue or timeline
|
|
67
|
+
- Empty catch blocks or swallowed errors
|
|
68
|
+
- Hardcoded secrets, API keys, or environment-specific URLs
|
|
69
|
+
- Type `any` (TypeScript) without a justifying comment
|
|
70
|
+
|
|
71
|
+
## Routing
|
|
72
|
+
|
|
73
|
+
- **Active cleanup**: Use `/devlyn.clean` to scan and remove accumulated debt
|
|
74
|
+
- **Focused cleanup**: Use `/devlyn.clean [category]` for targeted sweeps (dead code, deps, tests, complexity, hygiene)
|
|
@@ -58,16 +58,6 @@ Severity framework and quality bar for reviewing code changes. Apply this framew
|
|
|
58
58
|
- Lint passes
|
|
59
59
|
- Test suite passes
|
|
60
60
|
|
|
61
|
-
## Review Process
|
|
62
|
-
|
|
63
|
-
1. Read all changed files before making any judgment
|
|
64
|
-
2. Check each file against the severity framework
|
|
65
|
-
3. For each issue: state severity, file:line, what it is, why it matters
|
|
66
|
-
4. Fix issues directly — don't just list them
|
|
67
|
-
5. Run linter (`npm run lint` or equivalent) and fix all reported issues
|
|
68
|
-
6. Run the test suite after all fixes
|
|
69
|
-
7. If lint or tests fail → use `/devlyn.resolve` or `/devlyn.team-resolve` to fix
|
|
70
|
-
|
|
71
61
|
## Routing
|
|
72
62
|
|
|
73
63
|
- **Quick review** (few files, straightforward changes): Use `/devlyn.review`
|
|
@@ -56,14 +56,6 @@ Every fix MUST address the root cause. Stop immediately if you catch yourself:
|
|
|
56
56
|
|
|
57
57
|
If the real fix requires significant refactoring, present the scope to the user — never ship a workaround "for now".
|
|
58
58
|
|
|
59
|
-
## Test-Driven Validation
|
|
60
|
-
|
|
61
|
-
1. Write a failing test that reproduces the issue
|
|
62
|
-
2. Implement the fix
|
|
63
|
-
3. Run the test — if it still fails, **revert completely** and try the next hypothesis
|
|
64
|
-
4. Never layer fixes on top of failed attempts
|
|
65
|
-
5. Run the full test suite for regressions
|
|
66
|
-
|
|
67
59
|
## Routing
|
|
68
60
|
|
|
69
61
|
- **Simple issue** (single file, obvious cause): Use `/devlyn.resolve`
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Workflow Routing
|
|
2
|
+
|
|
3
|
+
Guide for choosing the right devlyn command at each stage of development. This skill helps you pick the optimal workflow instead of defaulting to a general approach.
|
|
4
|
+
|
|
5
|
+
## Trigger
|
|
6
|
+
|
|
7
|
+
- User describes a task without specifying a command
|
|
8
|
+
- User asks "how should I approach this?" or "what command should I use?"
|
|
9
|
+
- Beginning of a new feature, bug fix, or maintenance task
|
|
10
|
+
- Context suggests a specific workflow would be more effective than a generic approach
|
|
11
|
+
|
|
12
|
+
## SDLC Phase Map
|
|
13
|
+
|
|
14
|
+
Match the user's current activity to the right command:
|
|
15
|
+
|
|
16
|
+
### Discovery & Planning
|
|
17
|
+
| Situation | Command | Why |
|
|
18
|
+
|-----------|---------|-----|
|
|
19
|
+
| Need to understand what the project does | `/devlyn.discover-product` | Generates feature-oriented product documentation from code |
|
|
20
|
+
| Need to define a new product | `/devlyn.product-spec` | Creates or updates product spec documents |
|
|
21
|
+
| Need to plan a specific feature | `/devlyn.feature-spec` | Transforms product specs into implementable feature specs |
|
|
22
|
+
| Need to decide what to build next | `/devlyn.recommend-features` | Prioritizes top 5 features by value and readiness |
|
|
23
|
+
|
|
24
|
+
### Design
|
|
25
|
+
| Situation | Command | Why |
|
|
26
|
+
|-----------|---------|-----|
|
|
27
|
+
| Need UI style exploration (solo) | `/devlyn.design-ui` | Generates 5 distinct style options |
|
|
28
|
+
| Need team-based design exploration | `/devlyn.team-design-ui` | 5-person design team with diverse perspectives |
|
|
29
|
+
| Need to extract design tokens | `/devlyn.design-system` | Converts chosen style into reusable token system |
|
|
30
|
+
| Need to build or improve UI | `/devlyn.implement-ui` | Team-based UI implementation from design system |
|
|
31
|
+
|
|
32
|
+
### Implementation & Debugging
|
|
33
|
+
| Situation | Command | Why |
|
|
34
|
+
|-----------|---------|-----|
|
|
35
|
+
| Simple bug (single module, clear cause) | `/devlyn.resolve` | Solo root cause analysis with 5 Whys |
|
|
36
|
+
| Complex bug (multi-module, unclear cause) | `/devlyn.team-resolve` | Multi-perspective investigation team |
|
|
37
|
+
| Feature implementation on existing UI | `/devlyn.team-resolve [feature]` | Team approach for feature work |
|
|
38
|
+
|
|
39
|
+
### Review & Quality
|
|
40
|
+
| Situation | Command | Why |
|
|
41
|
+
|-----------|---------|-----|
|
|
42
|
+
| Quick review (few files) | `/devlyn.review` | Solo review with severity framework |
|
|
43
|
+
| Thorough review (many files, security-sensitive) | `/devlyn.team-review` | Multi-reviewer team coverage |
|
|
44
|
+
|
|
45
|
+
### Maintenance
|
|
46
|
+
| Situation | Command | Why |
|
|
47
|
+
|-----------|---------|-----|
|
|
48
|
+
| Remove dead code and tech debt | `/devlyn.clean` | 5-category codebase health analysis |
|
|
49
|
+
| Targeted cleanup (deps, tests, etc.) | `/devlyn.clean [category]` | Focused sweep on one area |
|
|
50
|
+
| Sync documentation with codebase | `/devlyn.update-docs` | Cleans stale content, preserves roadmaps |
|
|
51
|
+
| Targeted doc update | `/devlyn.update-docs [area]` | Focused update on specific doc area |
|
|
52
|
+
|
|
53
|
+
## Escalation Paths
|
|
54
|
+
|
|
55
|
+
When a solo command isn't enough:
|
|
56
|
+
|
|
57
|
+
- `/devlyn.resolve` → escalate to `/devlyn.team-resolve` if issue spans 3+ modules or root cause is unclear
|
|
58
|
+
- `/devlyn.review` → escalate to `/devlyn.team-review` if changeset is 10+ files or touches multiple domains
|
|
59
|
+
- `/devlyn.design-ui` → escalate to `/devlyn.team-design-ui` if design needs multi-perspective exploration
|
|
60
|
+
|
|
61
|
+
## Common Workflow Sequences
|
|
62
|
+
|
|
63
|
+
**New feature from scratch:**
|
|
64
|
+
`product-spec` → `feature-spec` → `design-ui` → `design-system` → `implement-ui` → `review`
|
|
65
|
+
|
|
66
|
+
**Bug fix:**
|
|
67
|
+
`resolve` (or `team-resolve`) → `review` (or `team-review`)
|
|
68
|
+
|
|
69
|
+
**Periodic maintenance:**
|
|
70
|
+
`clean` → `update-docs` → `review`
|
|
71
|
+
|
|
72
|
+
**Post-launch refinement:**
|
|
73
|
+
`discover-product` → `recommend-features` → `feature-spec` → implement → `review`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devlyn-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Claude Code configuration toolkit for teams",
|
|
5
5
|
"bin": {
|
|
6
6
|
"devlyn": "bin/devlyn.js"
|
|
@@ -24,4 +24,4 @@
|
|
|
24
24
|
"type": "git",
|
|
25
25
|
"url": "git+https://github.com/fysoul17/devlyn-cli.git"
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# 1. When conversation uses 50k+ tokens
|
|
2
|
-
> "Check current usage with /context"
|
|
3
|
-
|
|
4
|
-
# 2. Request HANDOFF.md creation
|
|
5
|
-
> "Organize the work done so far into a HANDOFF.md file.
|
|
6
|
-
Write clearly what was attempted, what succeeded, what failed, and next steps
|
|
7
|
-
so the next agent can continue work by reading only this file."
|
|
8
|
-
|
|
9
|
-
# 3. Start new session
|
|
10
|
-
> "/clear"
|
|
11
|
-
|
|
12
|
-
# 4. Load HANDOFF.md
|
|
13
|
-
> "@HANDOFF.md Read this file and continue the work"
|