devlyn-cli 0.1.6 → 0.2.1
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 +36 -0
- package/README.md +4 -2
- 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/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
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
- Follow commit conventions in `.claude/commit-conventions.md`
|
|
7
7
|
- Follow design system in `docs/design-system.md` for UI/UX work if exist
|
|
8
8
|
|
|
9
|
+
## Error Handling Philosophy
|
|
10
|
+
|
|
11
|
+
**No silent fallbacks.** Handle errors explicitly and show the user what happened.
|
|
12
|
+
|
|
13
|
+
- **Default behavior**: When something fails, display a clear error state in the UI (error message, retry option, or actionable guidance). Do NOT silently fall back to default/placeholder data.
|
|
14
|
+
- **Fallbacks are the exception, not the rule.** Only use fallbacks when it is a widely accepted best practice (e.g., fallback fonts in CSS, CDN failover, graceful image loading with placeholder). If unsure, handle the error explicitly instead.
|
|
15
|
+
- **Never hide failures.** The user should always know when something went wrong. A visible error with a retry button is better UX than silently showing stale/default data.
|
|
16
|
+
- **Pattern**: `try { doThing() } catch (error) { showErrorUI(error) }` — NOT `try { doThing() } catch { return fallbackValue }`
|
|
17
|
+
|
|
9
18
|
## Investigation Workflow
|
|
10
19
|
|
|
11
20
|
When investigating bugs, analyzing features, or exploring code:
|
|
@@ -39,6 +48,19 @@ The full design-to-implementation pipeline:
|
|
|
39
48
|
|
|
40
49
|
For complex features, use the Plan agent to design the approach before implementation.
|
|
41
50
|
|
|
51
|
+
## Vibe Coding Workflow
|
|
52
|
+
|
|
53
|
+
The recommended sequence after writing code:
|
|
54
|
+
|
|
55
|
+
1. **Write code** (vibe coding)
|
|
56
|
+
2. `/simplify` → Quick cleanup pass (reuse, quality, efficiency)
|
|
57
|
+
3. `/devlyn.review` → Thorough solo review with security-first checklist
|
|
58
|
+
4. `/devlyn.team-review` → Multi-perspective team review (for important PRs)
|
|
59
|
+
5. `/devlyn.clean` → Periodic codebase-wide hygiene
|
|
60
|
+
6. `/devlyn.update-docs` → Keep docs in sync
|
|
61
|
+
|
|
62
|
+
Steps 4-6 are optional depending on the scope of changes. `/simplify` should always run before `/devlyn.review` to catch low-hanging fruit cheaply.
|
|
63
|
+
|
|
42
64
|
## Documentation Workflow
|
|
43
65
|
|
|
44
66
|
- **Sync docs with codebase**: Use `/devlyn.update-docs` to clean up stale content, update outdated info, and generate missing docs
|
|
@@ -52,6 +74,20 @@ For complex features, use the Plan agent to design the approach before implement
|
|
|
52
74
|
- **Complex bugs**: Use `/devlyn.team-resolve` for multi-perspective investigation with a full agent team
|
|
53
75
|
- **Post-fix review**: Use `/devlyn.team-review` for thorough multi-reviewer validation
|
|
54
76
|
|
|
77
|
+
## Maintenance Workflow
|
|
78
|
+
|
|
79
|
+
- **Codebase cleanup**: Use `/devlyn.clean` to detect and remove dead code, unused dependencies, complexity hotspots, and tech debt
|
|
80
|
+
- **Focused cleanup**: Use `/devlyn.clean [category]` for targeted sweeps (dead code, deps, tests, complexity, hygiene)
|
|
81
|
+
- **Periodic maintenance sequence**: `/devlyn.clean` → `/simplify` → `/devlyn.update-docs` → `/devlyn.review`
|
|
82
|
+
|
|
83
|
+
## Context Window Management
|
|
84
|
+
|
|
85
|
+
When a conversation approaches context limits (50k+ tokens):
|
|
86
|
+
1. Check usage with `/context`
|
|
87
|
+
2. Create a HANDOFF.md summarizing: what was attempted, what succeeded, what failed, and next steps
|
|
88
|
+
3. Start a new session with `/clear`
|
|
89
|
+
4. Load context: `@HANDOFF.md Read this file and continue the work`
|
|
90
|
+
|
|
55
91
|
## Communication Style
|
|
56
92
|
|
|
57
93
|
- Lead with **objective data** (popularity, benchmarks, community adoption) before personal opinions
|
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ npx devlyn-cli list
|
|
|
49
49
|
your-project/
|
|
50
50
|
├── .claude/
|
|
51
51
|
│ ├── commands/ # 14 slash commands
|
|
52
|
-
│ ├── skills/ #
|
|
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
|
|
@@ -74,7 +74,7 @@ Slash commands are invoked directly in Claude Code conversations (e.g., `/devlyn
|
|
|
74
74
|
| `/devlyn.team-design-ui` | Team-based design exploration — spawns creative director, product designer, visual designer, interaction designer, accessibility designer |
|
|
75
75
|
| `/devlyn.design-system` | Design system reference and guidance |
|
|
76
76
|
| `/devlyn.update-docs` | Sync all project docs with current codebase — cleans stale content, preserves roadmaps, generates missing docs |
|
|
77
|
-
| `/devlyn.
|
|
77
|
+
| `/devlyn.clean` | Detect and remove dead code, unused dependencies, complexity hotspots, and tech debt |
|
|
78
78
|
|
|
79
79
|
## Skills
|
|
80
80
|
|
|
@@ -85,6 +85,8 @@ Skills are triggered automatically based on conversation context.
|
|
|
85
85
|
| `root-cause-analysis` | 5 Whys methodology, evidence standards, and no-workaround rules for debugging |
|
|
86
86
|
| `code-review-standards` | Severity framework, quality bar, and approval criteria for code reviews |
|
|
87
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 |
|
|
88
90
|
|
|
89
91
|
## Templates
|
|
90
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,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.1
|
|
3
|
+
"version": "0.2.1",
|
|
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"
|