devlyn-cli 0.0.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.
@@ -0,0 +1,286 @@
1
+ ---
2
+ description: Recommend top 5 feature specs based on product spec and codebase
3
+ allowed-tools: Bash(find:*), Bash(grep:*), Bash(wc:*), Bash(cat:*), Bash(ls:*), Bash(head:*), Bash(tail:*), Read, Glob
4
+ argument-hint: [focus-area or "all"]
5
+ ---
6
+
7
+ <role>
8
+ You recommend which feature specs to generate next. Analyze product spec, existing specs, and codebase. Output top 5 prioritized by dependencies, value, and readiness.
9
+ </role>
10
+
11
+ <input>
12
+ $ARGUMENTS
13
+ </input>
14
+
15
+ <step_1_verify>
16
+
17
+ ```bash
18
+ test -f docs/product-spec.md && echo "OK" || echo "MISSING"
19
+ ```
20
+
21
+ ```bash
22
+ ls docs/feature-specs/*.md 2>/dev/null || echo "NONE"
23
+ ```
24
+
25
+ If product spec missing:
26
+
27
+ ```
28
+ No product spec at docs/product-spec.md
29
+ Run /product-spec first.
30
+ ```
31
+
32
+ Stop.
33
+ </step_1_verify>
34
+
35
+ <step_2_read_product_spec>
36
+ Read docs/product-spec.md.
37
+
38
+ Extract:
39
+
40
+ ```yaml
41
+ platform: # from meta.platform
42
+ behaviors: # all behavior definitions
43
+ entities: # all entity definitions
44
+ views: # if section exists
45
+ commands: # if CLI platform
46
+ tools: # if MCP platform
47
+ functions: # if library/SDK platform
48
+ contracts: # if Web3 - contract definitions
49
+ instructions: # if Solana - program instructions
50
+ integrations: # external services
51
+ phases: # phase assignments
52
+ ```
53
+
54
+ </step_2_read_product_spec>
55
+
56
+ <step_3_build_candidates>
57
+ Build candidate list from product spec sections that exist:
58
+
59
+ ```yaml
60
+ sources:
61
+ behaviors: # always - each behavior → candidate
62
+ views: # if exists - each view → candidate
63
+ commands: # if exists - each command → candidate
64
+ tools: # if exists - each tool → candidate
65
+ functions: # if exists - complex functions → candidate
66
+ integrations: # if has business logic → candidate
67
+ contracts: # if exists - each contract function → candidate
68
+ instructions: # if Solana - each instruction → candidate
69
+ ```
70
+
71
+ For each candidate:
72
+
73
+ ```yaml
74
+ name: string
75
+ type: behavior | view | command | tool | function | integration | contract | instruction
76
+ phase: number
77
+ entities: [string]
78
+ depends_on: [string]
79
+ ```
80
+
81
+ </step_3_build_candidates>
82
+
83
+ <step_4_check_existing_specs>
84
+
85
+ ```bash
86
+ for f in docs/feature-specs/*.md; do
87
+ [ -f "$f" ] && echo "$(basename "$f" .md)|$(grep -m1 '^status:' "$f" 2>/dev/null | cut -d: -f2 | xargs || echo 'draft')"
88
+ done
89
+ ```
90
+
91
+ Mark each candidate:
92
+
93
+ - `specced: true` if file exists
94
+ - `spec_status: draft|ready|in-progress|done`
95
+
96
+ Filter to unspecced candidates only.
97
+ </step_4_check_existing_specs>
98
+
99
+ <step_5_analyze_codebase>
100
+ Detect stack:
101
+
102
+ ```bash
103
+ ls package.json tsconfig.json pyproject.toml Cargo.toml go.mod CMakeLists.txt hardhat.config.js foundry.toml anchor.toml 2>/dev/null
104
+ ```
105
+
106
+ Find source files:
107
+
108
+ ```bash
109
+ find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.sol" -o -name "*.move" \) 2>/dev/null | grep -v node_modules | grep -v target | head -30
110
+ ```
111
+
112
+ For each unspecced candidate:
113
+
114
+ ```bash
115
+ grep -ril "{candidate_name}" src/ app/ lib/ cmd/ pkg/ contracts/ programs/ 2>/dev/null | head -3
116
+ ```
117
+
118
+ Set `implementation: none | partial | exists`
119
+ </step_5_analyze_codebase>
120
+
121
+ <step_6_score>
122
+ Score each unspecced candidate:
123
+
124
+ ```yaml
125
+ dependency: # 0-30
126
+ 30: no dependencies
127
+ 20: all dependencies have specs
128
+ 10: some dependencies missing specs
129
+ 0: blocked by unspecced dependency
130
+
131
+ value: # 0-25
132
+ 25: phase 1 AND core flow
133
+ 20: enables 2+ other features
134
+ 15: user/developer facing
135
+ 5: enhancement
136
+
137
+ readiness: # 0-20
138
+ 20: implementation exists
139
+ 15: partial implementation
140
+ 10: similar patterns exist
141
+ 5: greenfield
142
+
143
+ complexity: # 0-15 (simpler = higher)
144
+ 15: single entity, simple logic
145
+ 10: multiple entities, clear flow
146
+ 5: external integration
147
+ 0: complex state/transactions
148
+
149
+ urgency: # 0-10
150
+ 10: blocks other work
151
+ 5: natural next step
152
+ 2: can defer
153
+ ```
154
+
155
+ `total = dependency + value + readiness + complexity + urgency`
156
+ </step_6_score>
157
+
158
+ <step_7_filter>
159
+ If $ARGUMENTS provided and ≠ "all":
160
+
161
+ ```yaml
162
+ filters:
163
+ core: phase = 1
164
+ backend: type in [behavior, integration] AND NOT ui-only
165
+ frontend: type = view OR has ui component
166
+ api: behaviors with HTTP/RPC interface
167
+ cli: type = command
168
+ sdk: type = function
169
+ mcp: type = tool
170
+ auth: name contains auth|login|session|permission
171
+ contract: type = contract
172
+ onchain: type in [contract, instruction]
173
+ solana: type = instruction
174
+ { entity }: entities includes {entity}
175
+ { phase_N }: phase = N
176
+ ```
177
+
178
+ If no matches:
179
+
180
+ ```
181
+ No unspecced features match "{$ARGUMENTS}".
182
+
183
+ Available filters:
184
+ {list applicable filters with counts}
185
+
186
+ Try: /recommend-features all
187
+ ```
188
+
189
+ Stop.
190
+ </step_7_filter>
191
+
192
+ <step_8_output>
193
+ Sort by total score descending. Take top 5.
194
+
195
+ ```markdown
196
+ ## Feature Recommendations
197
+
198
+ **Product Spec:** v{version} · {platform} · {behavior_count} behaviors
199
+ **Existing Specs:** {count} ({done} done, {in_progress} in-progress)
200
+ **Focus:** {$ARGUMENTS or "all"}
201
+
202
+ ---
203
+
204
+ ### #1: {name}
205
+
206
+ **Score: {total}/100** · Phase {phase} · {type}
207
+
208
+ {One sentence why this ranks highest}
209
+
210
+ - Product Spec: `{section}.{name}`
211
+ - Entities: {list}
212
+ - Implementation: {status} {files if any}
213
+ - Dependencies: {✅ | ⏳ | ❌} {names}
214
+ ```
215
+
216
+ /feature-spec {name}
217
+
218
+ ```
219
+
220
+ ---
221
+
222
+ ### #2: {name}
223
+ **Score: {total}/100** · Phase {phase} · {type}
224
+
225
+ {reason}
226
+
227
+ - Product Spec: `{section}.{name}`
228
+ - Entities: {list}
229
+ - Implementation: {status}
230
+ - Dependencies: {status}
231
+
232
+ ```
233
+
234
+ /feature-spec {name}
235
+
236
+ ```
237
+
238
+ ---
239
+
240
+ ### #3: {name}
241
+ {same format}
242
+
243
+ ---
244
+
245
+ ### #4: {name}
246
+ {same format}
247
+
248
+ ---
249
+
250
+ ### #5: {name}
251
+ {same format}
252
+
253
+ ---
254
+
255
+ ## Dependency Order
256
+
257
+ {blocking relationships}
258
+
259
+ ## Deferred
260
+
261
+ | Feature | Blocked By |
262
+ |---------|------------|
263
+ | {name} | {dependency} |
264
+ ```
265
+
266
+ </step_8_output>
267
+
268
+ <all_specced>
269
+ If all candidates have specs:
270
+
271
+ ```markdown
272
+ ## All Features Specced
273
+
274
+ **Specs:** {count}
275
+
276
+ - Done: {n}
277
+ - In Progress: {n}
278
+ - Draft: {n}
279
+
280
+ Next:
281
+
282
+ 1. Review drafts
283
+ 2. Add features to product spec
284
+ ```
285
+
286
+ </all_specced>
@@ -0,0 +1,108 @@
1
+ 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
+
3
+ <issue>
4
+ $ARGUMENTS
5
+ </issue>
6
+
7
+ <default_to_plan_mode>
8
+ After completing root cause analysis, enter plan mode before implementing fixes. This ensures the user can review your understanding of the problem and approve your approach before changes are made.
9
+
10
+ Only skip plan mode if ALL conditions are true:
11
+ - Single-line or trivial change (typo, obvious syntax error)
12
+ - Exactly one correct solution with no alternatives
13
+ - Single file affected with no side effects
14
+
15
+ When in doubt, enter plan mode.
16
+ </default_to_plan_mode>
17
+
18
+ <investigate_before_answering>
19
+ ALWAYS read and inspect relevant files before forming hypotheses. Do not speculate about code you have not opened.
20
+
21
+ 1. Read relevant files and error logs
22
+ 2. Trace execution path from symptom to source
23
+ 3. Map the code paths involved:
24
+
25
+ ```
26
+ Entry: `file.ts:123` functionName()
27
+ → calls `other.ts:45` helperFunction()
28
+ → calls `service.ts:89` apiCall()
29
+ → potential issue here
30
+ ```
31
+
32
+ 4. Find related test files that cover this area
33
+ 5. Verify each assumption with actual code inspection
34
+
35
+ Evidence-based reasoning only. Every claim must reference specific file:line.
36
+ </investigate_before_answering>
37
+
38
+ <analysis_approach>
39
+ Apply the 5 Whys technique when root cause is not immediately obvious:
40
+ - Ask "why did this happen?" until you reach the fundamental cause
41
+ - Stop when you identify something actionable
42
+ - Document each "why" with supporting evidence
43
+
44
+ Generate 2-3 hypotheses with evidence:
45
+ 1. **[Hypothesis]** - Evidence: [what supports this]
46
+ 2. **[Hypothesis]** - Evidence: [what supports this]
47
+ </analysis_approach>
48
+
49
+ <test_driven_validation>
50
+ Before implementing the fix:
51
+
52
+ 1. **Write a failing test** that reproduces the bug
53
+ 2. **Implement fix** for most likely hypothesis
54
+ 3. **Run test** - if fails, revert and try next hypothesis
55
+ 4. **Iterate** until test passes
56
+ 5. **Run full test suite** to check for regressions
57
+
58
+ If fix doesn't work, revert completely before trying next approach. Never layer fixes on top of failed attempts.
59
+ </test_driven_validation>
60
+
61
+ <no_fallbacks_or_workarounds>
62
+ Implement a robust fix that addresses the actual root cause. Do not:
63
+ - Add defensive fallbacks that mask problems (e.g., `|| defaultValue`)
64
+ - Hard-code values for the specific failing case
65
+ - Suppress errors without resolving the cause
66
+ - Use optional chaining (?.) to bypass null when null is the bug
67
+
68
+ Instead:
69
+ - Fix the code path that produces incorrect state
70
+ - Ensure solution works for all valid inputs
71
+ - Follow codebase's existing patterns
72
+ - Escalate blockers rather than shipping fragile patches
73
+ </no_fallbacks_or_workarounds>
74
+
75
+ <use_parallel_tool_calls>
76
+ Read multiple potentially relevant files in parallel. If the issue might involve 3 modules, read all 3 simultaneously.
77
+ </use_parallel_tool_calls>
78
+
79
+ <output_format>
80
+ Present findings before entering plan mode:
81
+
82
+ <root_cause_analysis>
83
+ **Symptom**: [What the user observed]
84
+ **Code Path**: [Entry point → ... → issue location with file:line]
85
+ **Root Cause**: [Fundamental issue with specific file:line]
86
+ **Hypotheses Tested**: [Which hypotheses were validated/invalidated]
87
+ **Why it matters**: [Impact if unfixed]
88
+ **Complexity**: [Simple fix / Multiple files / Architectural change]
89
+ </root_cause_analysis>
90
+
91
+ After fix is implemented:
92
+
93
+ <resolution>
94
+ **Fix Applied**: [file:line - what changed and why]
95
+ **Test Added**: [test file - what it validates]
96
+ **Verification**:
97
+ - [ ] Failing test now passes
98
+ - [ ] No regressions in test suite
99
+ - [ ] Manual verification (if applicable)
100
+ </resolution>
101
+ </output_format>
102
+
103
+ <next_steps>
104
+ 1. If Complexity beyond "Simple fix" → enter plan mode immediately
105
+ 2. In plan mode, present fix options if multiple valid solutions exist
106
+ 3. Write failing test before implementing
107
+ 4. Only mark complete after full test suite passes
108
+ </next_steps>
@@ -0,0 +1,99 @@
1
+ Perform a comprehensive post-implementation review. After receiving tool results, carefully reflect on their quality and determine optimal next steps before proceeding.
2
+
3
+ <procedure>
4
+ 1. Run `git diff --name-only HEAD` to get all changed files
5
+ 2. Read all changed files in parallel (use parallel tool calls)
6
+ 3. Check each file against the review checklist below
7
+ 4. Fix issues directly—do not just suggest fixes
8
+ 5. Run test suite to verify changes don't break existing functionality
9
+ 6. If tests fail → use devlyn.resolve workflow to fix, then re-run tests
10
+ 7. Generate summary report with file:line references
11
+ 8. Block approval if any CRITICAL or HIGH issues remain unfixed OR tests fail
12
+ </procedure>
13
+
14
+ <investigate_before_fixing>
15
+ ALWAYS read files before proposing edits. Do not speculate about code you have not inspected. Verify assumptions by reading actual implementation. Give grounded, hallucination-free assessments.
16
+ </investigate_before_fixing>
17
+
18
+ <use_parallel_tool_calls>
19
+ Make all independent tool calls in parallel. When reviewing 5 files, run 5 read calls simultaneously. Only execute sequentially when edits depend on prior reads. Never guess parameters.
20
+ </use_parallel_tool_calls>
21
+
22
+ <review_checklist>
23
+
24
+ ## CRITICAL — Security (must fix, blocks approval)
25
+
26
+ Security vulnerabilities can cause data breaches and system compromise:
27
+
28
+ - Hardcoded credentials, API keys, tokens, secrets
29
+ - SQL injection (unsanitized queries)
30
+ - XSS (unescaped user input in HTML/JSX)
31
+ - Missing input validation at system boundaries
32
+ - Insecure dependencies (known CVEs)
33
+ - Path traversal (unsanitized file paths)
34
+
35
+ ## HIGH — Code Quality (must fix, blocks approval)
36
+
37
+ These issues cause bugs or significant maintenance burden:
38
+
39
+ - Functions > 50 lines → split
40
+ - Files > 800 lines → decompose
41
+ - Nesting > 4 levels → flatten or extract
42
+ - Missing error handling at boundaries
43
+ - `console.log` in production code → remove
44
+ - Unresolved TODO/FIXME → resolve or remove
45
+ - Missing JSDoc for public APIs
46
+
47
+ ## MEDIUM — Best Practices (fix or justify)
48
+
49
+ - Mutation where immutable patterns preferred
50
+ - Missing tests for new functionality
51
+ - Accessibility gaps (alt text, ARIA, keyboard nav)
52
+ - Inconsistent naming or structure
53
+ - Over-engineering: unnecessary abstractions, unused config, premature optimization
54
+
55
+ ## LOW — Cleanup (fix if quick)
56
+
57
+ - Unused imports/dependencies
58
+ - Unreferenced functions/variables
59
+ - Commented-out code
60
+ - Obsolete files
61
+
62
+ </review_checklist>
63
+
64
+ <action_instructions>
65
+ For each issue:
66
+
67
+ 1. State severity, file:line
68
+ 2. One sentence: what and why it matters
69
+ 3. Make the fix immediately
70
+ 4. Continue to next issue
71
+
72
+ Be persistent. Complete the full review before stopping.
73
+ </action_instructions>
74
+
75
+ <output_format>
76
+ <review_summary>
77
+
78
+ ### Review Complete
79
+
80
+ **Approval**: [BLOCKED / APPROVED]
81
+
82
+ - BLOCKED if any CRITICAL or HIGH issues remain unfixed OR tests fail
83
+
84
+ **Tests**: [PASS / FAIL]
85
+ - [test summary or failure details]
86
+
87
+ **Fixed**:
88
+ - [CRITICAL] file.ts:42 — Removed hardcoded API key
89
+ - [HIGH] utils.ts:156 — Split 80-line function
90
+
91
+ **Verified**:
92
+ - Authentication flow handles edge cases
93
+ - Input validation at API boundaries
94
+
95
+ **Deferred** (with justification):
96
+ - [MEDIUM] Missing tests — existing coverage adequate for hotfix
97
+
98
+ </review_summary>
99
+ </output_format>