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,630 @@
1
+ ---
2
+ description: Generate a Feature Spec document from product spec behavior
3
+ allowed-tools: Bash(cp:*), Bash(mkdir:*), Bash(find:*), Bash(grep:*), Bash(cat:*), Bash(ls:*), Read, Write, Edit
4
+ argument-hint: [feature-name]
5
+ ---
6
+
7
+ <role>
8
+ You generate feature specs. Transform product spec behaviors into implementable specifications. Adapt sections based on platform type from product spec.
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
+ If missing:
22
+
23
+ ```
24
+ No product spec at docs/product-spec.md
25
+ Run /product-spec first.
26
+ ```
27
+
28
+ Stop.
29
+
30
+ ```bash
31
+ mkdir -p docs/feature-specs
32
+ ```
33
+
34
+ </step_1_verify>
35
+
36
+ <step_2_read_product_spec>
37
+ Read docs/product-spec.md.
38
+
39
+ Extract:
40
+
41
+ ```yaml
42
+ platform: # from meta.platform
43
+ behaviors: # all behaviors
44
+ entities: # all entities
45
+ views: # if defined
46
+ integrations: # if defined
47
+ ```
48
+
49
+ </step_2_read_product_spec>
50
+
51
+ <step_3_find_feature>
52
+ Search for $ARGUMENTS in:
53
+
54
+ 1. `behaviors[].name`
55
+ 2. `views[].name` (if exists)
56
+ 3. `entities[].name`
57
+
58
+ If not found:
59
+
60
+ ```
61
+ Feature "{$ARGUMENTS}" not found in product spec.
62
+
63
+ Available behaviors:
64
+ {list behavior names}
65
+
66
+ Run /recommend-features to see prioritized list.
67
+ ```
68
+
69
+ Stop.
70
+
71
+ Extract related content for this feature:
72
+
73
+ ```yaml
74
+ behavior: # matched behavior definition
75
+ entities: # entities involved
76
+ views: # views if any
77
+ permissions: # if defined
78
+ errors: # error cases
79
+ integrations: # if uses external services
80
+ ```
81
+
82
+ </step_3_find_feature>
83
+
84
+ <step_4_detect_interfaces>
85
+ Determine interface types from `meta.platform`:
86
+
87
+ ```yaml
88
+ web: [api, ui]
89
+ mobile: [api, ui]
90
+ desktop: [api, ui]
91
+ cli: [commands]
92
+ api: [api]
93
+ library: [public_api]
94
+ sdk: [public_api]
95
+ service: [api, events, jobs]
96
+ worker: [jobs, events]
97
+ mcp: [tools, resources]
98
+ embedded: [hardware, protocols]
99
+ smartcontract: [contract_functions, contract_events, storage]
100
+ solidity: [contract_functions, contract_events, storage]
101
+ solana: [instructions, accounts, events]
102
+ web3: [contract_functions, contract_events, storage]
103
+ blockchain: [contract_functions, contract_events, storage]
104
+ ```
105
+
106
+ If platform not specified, infer from:
107
+
108
+ - Has `views` section → include ui
109
+ - Has HTTP behaviors → include api
110
+ - Has CLI behaviors → include commands
111
+ - Has async behaviors → include jobs/events
112
+ - Has `contracts` section → include contract interfaces
113
+ - Has `.sol` files in codebase → include contract interfaces
114
+ </step_4_detect_interfaces>
115
+
116
+ <step_5_analyze_codebase>
117
+
118
+ ```bash
119
+ ls package.json tsconfig.json pyproject.toml Cargo.toml go.mod hardhat.config.js foundry.toml anchor.toml 2>/dev/null
120
+ ```
121
+
122
+ ```bash
123
+ find . -type f \( -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.sol" -o -name "*.move" \) 2>/dev/null | grep -v node_modules | head -20
124
+ ```
125
+
126
+ ```bash
127
+ grep -ril "{$ARGUMENTS}" src/ app/ lib/ contracts/ programs/ 2>/dev/null | head -5
128
+ ```
129
+
130
+ If `.sol` files found → set `interfaces += [contract_functions, contract_events, storage]`
131
+ If `programs/` or `anchor.toml` found → set `interfaces += [instructions, accounts, events]`
132
+ </step_5_analyze_codebase>
133
+
134
+ <step_6_check_template>
135
+
136
+ ```bash
137
+ cat .claude/templates/feature-spec.md 2>/dev/null || echo "NO_TEMPLATE"
138
+ ```
139
+
140
+ If template exists, use its structure with platform adaptations.
141
+ </step_6_check_template>
142
+
143
+ <spec_sections>
144
+ Include sections based on detected interfaces:
145
+
146
+ ## Meta (always)
147
+
148
+ ```yaml
149
+ id: F-{number}
150
+ status: draft
151
+ version: "0.1"
152
+ created: { today }
153
+ product_spec: "{behavior_name}"
154
+ phase: { phase }
155
+ platform: { platform }
156
+ interfaces: [{ detected interfaces }]
157
+ ```
158
+
159
+ ## Overview (always)
160
+
161
+ ```yaml
162
+ purpose: { one sentence }
163
+ success_criteria:
164
+ - { measurable outcome }
165
+ ```
166
+
167
+ ## Data Model (if has entities)
168
+
169
+ ### {EntityName}
170
+
171
+ ```yaml
172
+ attributes:
173
+ { field }:
174
+ type: { type }
175
+ required: { bool }
176
+ constraints: { rules }
177
+
178
+ relations:
179
+ { name }:
180
+ type: { relation_type }
181
+ target: { Entity }
182
+
183
+ examples:
184
+ typical: { value }
185
+ edge: { value }
186
+ ```
187
+
188
+ If has lifecycle:
189
+
190
+ ```yaml
191
+ states:
192
+ { state }:
193
+ transitions:
194
+ - to: { next }
195
+ trigger: { action }
196
+ ```
197
+
198
+ ---
199
+
200
+ ## API (if api in interfaces)
201
+
202
+ ### {METHOD} {/path}
203
+
204
+ ```yaml
205
+ purpose: { description }
206
+ auth: { required|optional|public }
207
+
208
+ request:
209
+ body: {}
210
+
211
+ response:
212
+ success:
213
+ status: { code }
214
+ body: {}
215
+ errors:
216
+ - code: { ERROR_CODE }
217
+ when: { condition }
218
+ message: { text }
219
+ ```
220
+
221
+ ---
222
+
223
+ ## CLI (if commands in interfaces)
224
+
225
+ ### {command}
226
+
227
+ ```yaml
228
+ usage: {program} {command} [options] <args>
229
+
230
+ arguments:
231
+ {arg}:
232
+ required: {bool}
233
+ description: {text}
234
+
235
+ options:
236
+ --{flag}:
237
+ short: -{f}
238
+ type: {type}
239
+ default: {value}
240
+
241
+ output:
242
+ success: {format}
243
+ error: {format}
244
+ exit_codes:
245
+ 0: success
246
+ 1: {error}
247
+
248
+ examples:
249
+ - cmd: {example}
250
+ desc: {what it does}
251
+ ```
252
+
253
+ ---
254
+
255
+ ## Public API (if public_api in interfaces)
256
+
257
+ ### {function_name}
258
+
259
+ ```yaml
260
+ signature: { full signature }
261
+
262
+ parameters:
263
+ { param }:
264
+ type: { type }
265
+ description: { text }
266
+
267
+ returns:
268
+ type: { type }
269
+ description: { text }
270
+
271
+ throws:
272
+ - { Error }: { when }
273
+
274
+ example: |
275
+ {code}
276
+ ```
277
+
278
+ ### {ClassName}
279
+
280
+ ```yaml
281
+ purpose: { description }
282
+
283
+ constructor:
284
+ params: {}
285
+
286
+ methods:
287
+ { method }: { signature }
288
+
289
+ properties:
290
+ { prop }: { type }
291
+ ```
292
+
293
+ ---
294
+
295
+ ## MCP (if tools/resources in interfaces)
296
+
297
+ ### Tool: {name}
298
+
299
+ ```yaml
300
+ description: { what it does }
301
+
302
+ parameters:
303
+ { param }:
304
+ type: { type }
305
+ required: { bool }
306
+
307
+ returns: { description }
308
+ ```
309
+
310
+ ### Resource: {uri}
311
+
312
+ ```yaml
313
+ uri_template: { template }
314
+ mime_type: { type }
315
+ ```
316
+
317
+ ---
318
+
319
+ ## UI (if ui in interfaces)
320
+
321
+ ### {ViewName}
322
+
323
+ ```yaml
324
+ route: { path }
325
+ layout: { type }
326
+
327
+ states:
328
+ loading: { shows }
329
+ empty: { shows }
330
+ error: { shows }
331
+ success: { shows }
332
+
333
+ flow: 1. {step}
334
+ ```
335
+
336
+ ---
337
+
338
+ ## Events (if events in interfaces)
339
+
340
+ ### {event_name}
341
+
342
+ ```yaml
343
+ trigger: { when }
344
+ payload:
345
+ { field }: { type }
346
+ subscribers: [{ who }]
347
+ ```
348
+
349
+ ---
350
+
351
+ ## Jobs (if jobs in interfaces)
352
+
353
+ ### {job_name}
354
+
355
+ ```yaml
356
+ trigger: { schedule|event|manual }
357
+ schedule: { cron }
358
+ input: {}
359
+ output: {}
360
+ timeout: { duration }
361
+ retry: { strategy }
362
+ ```
363
+
364
+ ---
365
+
366
+ ## Hardware (if hardware in interfaces)
367
+
368
+ ### {interface_name}
369
+
370
+ ```yaml
371
+ protocol: { type }
372
+ pins: [{ list }]
373
+ timing: { constraints }
374
+ commands:
375
+ { cmd }: { description }
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Contract (if contract_functions in interfaces)
381
+
382
+ ### {ContractName}
383
+
384
+ ```yaml
385
+ purpose: { description }
386
+ inherits: [{ parent contracts }]
387
+ ```
388
+
389
+ ### State
390
+
391
+ ```yaml
392
+ { variable }:
393
+ type: { solidity type }
394
+ visibility: { public|private|internal }
395
+ description: { purpose }
396
+ ```
397
+
398
+ ### Functions
399
+
400
+ #### {function_name}
401
+
402
+ ```yaml
403
+ visibility: { external|public|internal|private }
404
+ mutability: { view|pure|payable|nonpayable }
405
+ modifiers: [{ modifier }]
406
+
407
+ parameters:
408
+ { param }:
409
+ type: { solidity type }
410
+ description: { text }
411
+
412
+ returns:
413
+ { name }: { type }
414
+
415
+ requires:
416
+ - { condition }: { revert message }
417
+
418
+ emits:
419
+ - { EventName }
420
+
421
+ gas_estimate: { approximate }
422
+ ```
423
+
424
+ ### Events
425
+
426
+ ```yaml
427
+ { EventName }:
428
+ params:
429
+ { param }:
430
+ type: { type }
431
+ indexed: { bool }
432
+ emitted_when: { condition }
433
+ ```
434
+
435
+ ### Modifiers
436
+
437
+ ```yaml
438
+ { modifier_name }:
439
+ purpose: { description }
440
+ requires: [{ conditions }]
441
+ ```
442
+
443
+ ### Access Control
444
+
445
+ ```yaml
446
+ roles:
447
+ { ROLE_NAME }:
448
+ can: [{ functions }]
449
+ granted_by: { who }
450
+ ```
451
+
452
+ ### Upgradability (if applicable)
453
+
454
+ ```yaml
455
+ pattern: { transparent|uups|beacon|diamond }
456
+ storage_layout: { considerations }
457
+ ```
458
+
459
+ ---
460
+
461
+ ## Solana Program (if instructions in interfaces)
462
+
463
+ ### {ProgramName}
464
+
465
+ ```yaml
466
+ program_id: { pubkey or TBD }
467
+ ```
468
+
469
+ ### Accounts
470
+
471
+ ```yaml
472
+ { AccountName }:
473
+ seeds: [{ seed derivation }]
474
+ space: { bytes }
475
+ fields:
476
+ { field }:
477
+ type: { borsh type }
478
+ offset: { bytes }
479
+ ```
480
+
481
+ ### Instructions
482
+
483
+ #### {instruction_name}
484
+
485
+ ```yaml
486
+ discriminator: { 8 bytes }
487
+
488
+ accounts:
489
+ { account }:
490
+ is_mut: { bool }
491
+ is_signer: { bool }
492
+ description: { text }
493
+
494
+ args:
495
+ { arg }:
496
+ type: { borsh type }
497
+
498
+ logic: { description }
499
+
500
+ emits:
501
+ - { event }
502
+ ```
503
+
504
+ ### Events
505
+
506
+ ```yaml
507
+ { EventName }:
508
+ fields:
509
+ { field }: { type }
510
+ ```
511
+
512
+ ---
513
+
514
+ ## Business Logic (always)
515
+
516
+ ### Rules
517
+
518
+ ```yaml
519
+ - rule: { name }
520
+ when: { condition }
521
+ then: { action }
522
+ ```
523
+
524
+ ### Validations
525
+
526
+ ```yaml
527
+ - field: { name }
528
+ rules: [{ validation }]
529
+ message: { error }
530
+ ```
531
+
532
+ ### Permissions (if defined)
533
+
534
+ ```yaml
535
+ { action }: { who }
536
+ ```
537
+
538
+ ---
539
+
540
+ ## Integrations (if has external services)
541
+
542
+ ```yaml
543
+ - service: { name }
544
+ operation: { what }
545
+ fallback: { if fails }
546
+ ```
547
+
548
+ ---
549
+
550
+ ## Test Scenarios (always)
551
+
552
+ ### Unit
553
+
554
+ ```yaml
555
+ - scenario: { description }
556
+ given: { setup }
557
+ when: { action }
558
+ then: { result }
559
+ ```
560
+
561
+ ### Edge Cases
562
+
563
+ ```yaml
564
+ - case: { description }
565
+ input: { value }
566
+ expected: { handling }
567
+ ```
568
+
569
+ ---
570
+
571
+ ## Dependencies (always)
572
+
573
+ ```yaml
574
+ requires:
575
+ - { feature }: { status }
576
+ enables:
577
+ - { feature }
578
+ ```
579
+
580
+ ## Open Questions
581
+
582
+ - [ ] {question}
583
+ </spec_sections>
584
+
585
+ <step_7_write>
586
+ Write to: `docs/feature-specs/{$ARGUMENTS}.md`
587
+
588
+ Include only sections for detected interfaces.
589
+ Use kebab-case filename.
590
+ </step_7_write>
591
+
592
+ <step_8_output>
593
+
594
+ ```markdown
595
+ ## Feature Spec Generated
596
+
597
+ **File:** `docs/feature-specs/{name}.md`
598
+ **Platform:** {platform}
599
+ **Interfaces:** {list}
600
+
601
+ ### Summary
602
+
603
+ - Behavior: {name}
604
+ - Entities: {count}
605
+ - {interface_type}: {count} (e.g., "Endpoints: 3" or "Commands: 2" or "Functions: 5")
606
+
607
+ ### Dependencies
608
+
609
+ - ✅ {specced}
610
+ - ❌ {missing} → `/feature-spec {name}`
611
+ ```
612
+
613
+ </step_8_output>
614
+
615
+ <update_mode>
616
+ If file exists at `docs/feature-specs/{$ARGUMENTS}.md`:
617
+
618
+ Read existing. Apply targeted changes. Update version.
619
+
620
+ ```markdown
621
+ ## Feature Spec Updated
622
+
623
+ **Version:** {old} → {new}
624
+
625
+ ### Changes
626
+
627
+ - {change}
628
+ ```
629
+
630
+ </update_mode>
@@ -0,0 +1,13 @@
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"