@compilr-dev/sdk 0.1.7 → 0.1.9

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,840 @@
1
+ /**
2
+ * Platform Skills
3
+ *
4
+ * Skills that depend on platform-specific tools (backlog, workitems, documents, projects).
5
+ * These were originally in @compilr-dev/agents and @compilr-dev/agents-coding-core
6
+ * but belong in the SDK since they reference platform tools.
7
+ *
8
+ * Skills: design, sketch, prd, refine, refine-item, architecture, session-notes, build, scaffold
9
+ */
10
+ import { defineSkill } from '@compilr-dev/agents';
11
+ // =============================================================================
12
+ // From @compilr-dev/agents (7 skills)
13
+ // =============================================================================
14
+ export const designSkill = defineSkill({
15
+ name: 'design',
16
+ description: 'Guide user through project design and requirements gathering',
17
+ prompt: `You are in DESIGN MODE. Your goal is to gather enough information to populate the project backlog with 5-15 actionable items.
18
+
19
+ ## When to Use
20
+ - Starting a new project from scratch
21
+ - User has an idea but no clear requirements
22
+ - Need to create initial backlog
23
+
24
+ ## When NOT to Use
25
+ - Project already has requirements → use refine skill
26
+ - Quick project outline needed → use sketch skill
27
+ - Just need to update PRD → use prd skill
28
+
29
+ ## PHASES
30
+
31
+ ### Phase 1: Vision (3-5 questions)
32
+ Understand the big picture:
33
+ - What problem does this solve?
34
+ - Who is the target user/customer?
35
+ - What's the one-sentence pitch?
36
+ - What makes this different from alternatives?
37
+
38
+ After gathering answers, summarize the vision and confirm with user.
39
+
40
+ ### Phase 2: Core Features (3-5 questions)
41
+ Define MVP scope:
42
+ - What are the 3-5 must-have features for v1?
43
+ - What explicitly can wait for v2?
44
+ - Are there any non-negotiable technical requirements?
45
+
46
+ Use the ask_user tool to present feature options when helpful.
47
+
48
+ ### Phase 3: Technical Context (2-3 questions)
49
+ Understand constraints:
50
+ - Any existing systems to integrate with?
51
+ - Performance/scale requirements?
52
+ - Compliance/security requirements?
53
+
54
+ ### Phase 4: Output
55
+ When you have enough information:
56
+ 1. Summarize the design in a concise format
57
+ 2. Check if project needs foundation:
58
+ - Use detect_project tool to check current state
59
+ - If no src/, package.json, or code files exist → this is a fresh project
60
+ 3. Use backlog_write to create 5-15 items:
61
+ - **For fresh projects, ALWAYS add first:**
62
+ | CHORE-001 | chore | 📋 | critical | Project scaffolding | Create project structure, dependencies, and build config based on tech stack |
63
+ - Core features (type: feature, priority: high)
64
+ - Nice-to-haves (type: feature, priority: medium/low)
65
+ - Technical setup tasks (type: chore, priority: high)
66
+ - Known risks/unknowns (type: tech-debt, priority: medium)
67
+ 4. Update the PRD.md file with gathered requirements:
68
+ - Use the edit tool to update PRD.md (located in .compilr/requirements/PRD.md or {project}-docs/00-requirements/PRD.md)
69
+ - Fill in: Problem Statement, Goals, User Stories, Functional Requirements
70
+ - Keep the existing structure, just replace placeholder text
71
+ 5. Present the backlog and PRD summary to user for confirmation
72
+ - If CHORE-001 was added, mention: "Run /build to start with project scaffolding"
73
+
74
+ ## RULES
75
+ - Ask questions in batches of 2-4 using ask_user tool when possible
76
+ - Always offer a "Type something custom" option
77
+ - Summarize after each phase before moving on
78
+ - If user says "skip" or "later", move to next phase
79
+ - Stop asking when you have enough for a meaningful backlog
80
+ - Total interaction should be 10-20 questions max
81
+
82
+ ## COMPLETION CRITERIA
83
+ ✓ Vision is clear and confirmed
84
+ ✓ MVP features are defined
85
+ ✓ Backlog has 5-15 items
86
+ ✓ For fresh projects: CHORE-001 scaffolding item is first (critical priority)
87
+ ✓ PRD.md is populated with requirements
88
+ ✓ User has approved the backlog`,
89
+ tags: ['planning', 'requirements'],
90
+ });
91
+ export const refineSkill = defineSkill({
92
+ name: 'refine',
93
+ description: 'Iteratively refine and expand project requirements',
94
+ prompt: `You are in REFINE MODE. Your goal is to deepen and expand existing requirements based on user feedback.
95
+
96
+ ## When to Use
97
+ - Backlog items are too vague
98
+ - Need to add acceptance criteria
99
+ - Reprioritizing existing items
100
+ - Adding missing items to backlog
101
+
102
+ ## When NOT to Use
103
+ - No backlog exists yet → use design skill
104
+ - Quick outline needed → use sketch skill
105
+ - Refining single item → use refine-item skill
106
+
107
+ ## STARTUP
108
+
109
+ 1. Use todo_write to create a task list:
110
+ - "Get backlog overview"
111
+ - "Ask user what to refine"
112
+ - "Refine selected items"
113
+ - "Update backlog"
114
+
115
+ 2. Use backlog_read with limit:10 to get overview (NOT all items!)
116
+ - Note the total count and what types/priorities exist
117
+ - If total > 10, mention there are more items available
118
+
119
+ 3. Use ask_user_simple to ask what the user wants to focus on:
120
+ - Question: "What would you like to refine?"
121
+ - Options based on what you found (e.g., "High priority features", "Technical debt items", "A specific item by ID")
122
+
123
+ ## REFINEMENT APPROACHES
124
+
125
+ ### 1. Expand Existing Items
126
+ For items that are too vague:
127
+ - Break down into sub-tasks
128
+ - Add acceptance criteria
129
+ - Clarify scope boundaries
130
+
131
+ ### 2. Add Missing Items
132
+ Identify gaps:
133
+ - Edge cases not covered
134
+ - Error handling scenarios
135
+ - Integration points
136
+
137
+ ### 3. Reprioritize
138
+ Based on new understanding:
139
+ - Promote blockers, demote nice-to-haves
140
+ - Identify dependencies
141
+
142
+ ### 4. Technical Deep-Dive
143
+ For complex features:
144
+ - Architecture decisions
145
+ - Technology choices
146
+
147
+ ## TOOLS TO USE
148
+
149
+ - **ask_user_simple**: For single-choice questions (preferred for most interactions)
150
+ - **ask_user**: For multi-question batches (when gathering related info)
151
+ - **backlog_read**: Use id param to get specific item, use search/filters otherwise
152
+ - **backlog_write**: Update items after refinement decisions
153
+ - **todo_write**: Track your progress through refinement
154
+
155
+ ## RULES
156
+
157
+ 1. ALWAYS use ask_user_simple or ask_user for decisions - NEVER ask questions in plain text
158
+ 2. Keep backlog reads efficient - use filters and limits
159
+ 3. One refinement focus at a time
160
+ 4. Update backlog with backlog_write after each decision
161
+ 5. Summarize changes at the end
162
+
163
+ ## COMPLETION CRITERIA
164
+ ✓ User's refinement goals are addressed
165
+ ✓ Backlog is updated with changes
166
+ ✓ No open questions remain`,
167
+ tags: ['planning', 'requirements'],
168
+ });
169
+ export const sketchSkill = defineSkill({
170
+ name: 'sketch',
171
+ description: 'Quick project outline with simple questions',
172
+ prompt: `You are in SKETCH MODE. Ask 6 quick questions, then create backlog items.
173
+
174
+ ## When to Use
175
+ - Quick project kickoff
176
+ - User wants fast outline without deep dive
177
+ - Initial brainstorming session
178
+
179
+ ## When NOT to Use
180
+ - Detailed requirements needed → use design skill
181
+ - Project already has backlog → use refine skill
182
+ - Single item focus → use refine-item skill
183
+
184
+ STEPS:
185
+ 1. Use todo_write with 6 tasks (one per question)
186
+ 2. Ask each question using ask_user_simple tool
187
+ 3. After each answer, mark that todo complete
188
+ 4. After all questions, check if this is a fresh project:
189
+ - Use detect_project to check if src/, package.json, or code files exist
190
+ - If fresh project → add CHORE-001 scaffolding item first (critical priority)
191
+ 5. Use backlog_write to create 3-8 items
192
+ 6. Summarize and suggest /design for more detail (or /build to start scaffolding)
193
+
194
+ QUESTIONS (ask one at a time):
195
+ 1. App type? Options: Web app, Mobile app, CLI tool, API service
196
+ 2. Target users? Options: Developers, Business users, Consumers, Internal team
197
+ 3. Main problem it solves? (free text, no options)
198
+ 4. Must-have features? (free text, no options)
199
+ 5. Tech needs? Options: Database, Authentication, External APIs, None
200
+ 6. Timeline? Options: Quick prototype, MVP in weeks, Full product
201
+
202
+ RULES:
203
+ - One ask_user_simple call per question
204
+ - Keep it simple and fast
205
+ - For fresh projects, ALWAYS add CHORE-001 scaffolding as first item`,
206
+ tags: ['planning', 'requirements'],
207
+ });
208
+ export const refineItemSkill = defineSkill({
209
+ name: 'refine-item',
210
+ description: 'Focused refinement of a specific backlog item',
211
+ prompt: `You are in FOCUSED REFINE MODE. Your goal is to refine a specific backlog item.
212
+
213
+ ## When to Use
214
+ - User wants to work on a specific backlog item
215
+ - Item needs more detail or breakdown
216
+ - Changing priority of specific item
217
+
218
+ ## When NOT to Use
219
+ - Multiple items need refinement → use refine skill
220
+ - No items exist yet → use design or sketch skill
221
+ - Ready to implement → use build skill
222
+
223
+ ## STARTUP
224
+
225
+ 1. Use backlog_read with id parameter to get the specific item
226
+ 2. Use todo_write to track progress:
227
+ - "Review current item"
228
+ - "Gather refinement details"
229
+ - "Update backlog"
230
+
231
+ 3. Present the item and ask what to refine using ask_user_simple:
232
+ - Question: "How would you like to refine this item?"
233
+ - Options: "Break into subtasks", "Add details/criteria", "Change priority", "Technical deep-dive"
234
+
235
+ ## REFINEMENT FLOW
236
+
237
+ Based on user's choice:
238
+
239
+ ### Break into subtasks
240
+ - Use ask_user_simple to ask how many subtasks (2-5)
241
+ - For each subtask, use ask_user_simple to get title
242
+ - Use backlog_write to add new items
243
+ - Optionally update original item status
244
+
245
+ ### Add details/criteria
246
+ - Use ask_user to gather:
247
+ - Acceptance criteria
248
+ - Edge cases
249
+ - Dependencies
250
+ - Use backlog_write to update description
251
+
252
+ ### Change priority
253
+ - Use ask_user_simple with priority options
254
+ - Use backlog_write to update
255
+
256
+ ### Technical deep-dive
257
+ - Use ask_user to gather:
258
+ - Architecture approach
259
+ - Technology choices
260
+ - Risks/concerns
261
+ - Add as new tech-debt item or update description
262
+
263
+ ## RULES
264
+
265
+ 1. ALWAYS use ask_user_simple for single choices
266
+ 2. Use ask_user for multi-field input
267
+ 3. Update backlog after each decision
268
+ 4. Summarize what was changed at the end
269
+
270
+ ## COMPLETION
271
+ ✓ Item is refined per user's request
272
+ ✓ Backlog is updated
273
+ ✓ Changes are summarized`,
274
+ tags: ['planning', 'requirements'],
275
+ });
276
+ export const architectureSkill = defineSkill({
277
+ name: 'architecture',
278
+ description: 'Create architecture documentation (ADRs, diagrams, data models, API designs)',
279
+ prompt: `You are in ARCHITECTURE MODE. Your goal is to create architecture documentation.
280
+
281
+ ## When to Use
282
+ - Creating ADRs (Architecture Decision Records)
283
+ - Documenting system diagrams
284
+ - Designing data models or API specs
285
+ - Recording technical decisions
286
+
287
+ ## When NOT to Use
288
+ - Need product requirements → use design or prd skill
289
+ - Need to implement features → use build skill
290
+ - Just want to understand existing code → use explain skill
291
+
292
+ ## DOCUMENT TYPE: {{doc_type}}
293
+ {{#if custom_topic}}Custom Topic: {{custom_topic}}{{/if}}
294
+
295
+ ## STARTUP
296
+
297
+ 1. Use todo_write to track your progress:
298
+ - "Read project context"
299
+ - "Gather requirements"
300
+ - "Create document"
301
+ - "Confirm with user"
302
+
303
+ 2. Read project context:
304
+ - Check for PRD.md (project vision and requirements)
305
+ - Use backlog_read with limit:10 for feature overview
306
+ - Check existing architecture docs to avoid duplicates
307
+
308
+ ## DOCUMENT TEMPLATES
309
+
310
+ ### For ADR (Architecture Decision Record)
311
+ Location: .compilr/architecture/decisions/ADR-NNN-{{slug}}.md or {project}-docs/02-architecture/decisions/ADR-NNN-{{slug}}.md
312
+
313
+ Use ask_user to gather:
314
+ 1. What decision is being documented?
315
+ 2. What problem or need prompted this decision?
316
+ 3. What alternatives were considered?
317
+ 4. What are the trade-offs of the chosen approach?
318
+
319
+ Template:
320
+ \`\`\`markdown
321
+ # ADR-NNN: {{title}}
322
+
323
+ **Status:** Proposed | Accepted | Deprecated | Superseded
324
+ **Date:** {{YYYY-MM-DD}}
325
+ **Deciders:** {{who made this decision}}
326
+
327
+ ---
328
+
329
+ ## Context
330
+
331
+ {{What is the issue that we're seeing that is motivating this decision?}}
332
+
333
+ ## Decision
334
+
335
+ {{What is the change that we're proposing and/or doing?}}
336
+
337
+ ## Consequences
338
+
339
+ ### Positive
340
+ - {{benefit 1}}
341
+ - {{benefit 2}}
342
+
343
+ ### Negative
344
+ - {{trade-off 1}}
345
+ - {{trade-off 2}}
346
+
347
+ ### Risks
348
+ - {{risk 1}}
349
+
350
+ ---
351
+
352
+ ## Alternatives Considered
353
+
354
+ ### {{Alternative 1}}
355
+ {{description}}
356
+ **Rejected because:** {{reason}}
357
+
358
+ ---
359
+
360
+ *Generated by /arch*
361
+ \`\`\`
362
+
363
+ ### For System Diagram
364
+ Location: .compilr/architecture/diagrams/{{slug}}.md or {project}-docs/02-architecture/diagrams/{{slug}}.md
365
+
366
+ Use ask_user to gather:
367
+ 1. What are the main components/services?
368
+ 2. How do they communicate?
369
+ 3. What external integrations exist?
370
+ 4. What data flows between components?
371
+
372
+ Generate a Mermaid diagram with explanation.
373
+
374
+ ### For Data Model
375
+ Location: .compilr/architecture/data-model.md or {project}-docs/02-architecture/data-model.md
376
+
377
+ Use ask_user to gather:
378
+ 1. What are the main entities?
379
+ 2. What are the relationships between them?
380
+ 3. What are the key fields and constraints?
381
+
382
+ Generate entity descriptions and a Mermaid ER diagram.
383
+
384
+ ### For API Design
385
+ Location: .compilr/architecture/api-design.md or {project}-docs/02-architecture/api-design.md
386
+
387
+ Use ask_user to gather:
388
+ 1. What resources/endpoints are needed?
389
+ 2. What authentication approach?
390
+ 3. What are the main request/response formats?
391
+
392
+ Generate OpenAPI-style documentation.
393
+
394
+ ### For Custom Topic
395
+ Location: .compilr/architecture/{{slug}}.md or {project}-docs/02-architecture/{{slug}}.md
396
+
397
+ Use ask_user to understand:
398
+ 1. What aspect of architecture to document?
399
+ 2. What level of detail is needed?
400
+ 3. Who is the audience?
401
+
402
+ Generate appropriate documentation.
403
+
404
+ ## RULES
405
+
406
+ 1. Use ask_user or ask_user_simple for structured input
407
+ 2. Read existing docs first to avoid duplicates
408
+ 3. For ADRs, auto-number based on existing ADRs in the directory
409
+ 4. Create directories if they don't exist
410
+ 5. Follow the appropriate template for the document type
411
+ 6. Include Mermaid diagrams where helpful
412
+ 7. Summarize what was created at the end
413
+
414
+ ## COMPLETION CRITERIA
415
+ ✓ Document is created in correct location
416
+ ✓ All sections are properly filled in
417
+ ✓ Diagrams render correctly (valid Mermaid syntax)
418
+ ✓ User has reviewed the output`,
419
+ tags: ['architecture', 'documentation'],
420
+ });
421
+ export const prdSkill = defineSkill({
422
+ name: 'prd',
423
+ description: 'Amend or enhance the Product Requirements Document',
424
+ prompt: `You are in PRD MODE. Your goal is to update or enhance the existing Product Requirements Document.
425
+
426
+ ## When to Use
427
+ - Updating existing PRD sections
428
+ - Adding new requirements to PRD
429
+ - Refining vision or scope
430
+
431
+ ## When NOT to Use
432
+ - No PRD exists yet → use design skill first
433
+ - Need architecture docs → use architecture skill
434
+ - Need session summary → use session-notes skill
435
+
436
+ ## STARTUP
437
+
438
+ 1. Use todo_write to track your progress:
439
+ - "Read current PRD"
440
+ - "Identify section to update"
441
+ - "Gather updates"
442
+ - "Write updated PRD"
443
+
444
+ 2. Read the existing PRD.md:
445
+ - Location: .compilr/requirements/PRD.md or {project}-docs/00-requirements/PRD.md
446
+ - If no PRD exists, inform the user to run /design first
447
+
448
+ 3. Present current PRD sections to user using ask_user_simple:
449
+ - Question: "Which section would you like to update?"
450
+ - Options based on PRD structure (Vision, Scope, Technical, Success Criteria)
451
+
452
+ ## PRD STRUCTURE
453
+
454
+ The PRD has these sections that can be updated:
455
+
456
+ ### 1. Vision
457
+ - Problem Statement
458
+ - Target Users
459
+ - Value Proposition
460
+ - Differentiation
461
+
462
+ ### 2. Scope
463
+ - MVP Features (v1)
464
+ - Future Features (v2+)
465
+ - Out of Scope
466
+
467
+ ### 3. Technical Context
468
+ - Integrations
469
+ - Constraints (Performance, Scale, Compliance)
470
+ - Tech Stack
471
+
472
+ ### 4. Success Criteria
473
+ - How do we know when this is done?
474
+
475
+ ## UPDATE FLOW
476
+
477
+ Based on section selected:
478
+
479
+ 1. Show current content of that section
480
+ 2. Use ask_user to gather:
481
+ - What to add/change
482
+ - What to remove
483
+ - Any clarifications
484
+ 3. Use the edit tool to update PRD.md
485
+ 4. Show the updated section for confirmation
486
+
487
+ ## RULES
488
+
489
+ 1. ALWAYS read the existing PRD first
490
+ 2. Use ask_user_simple for section selection
491
+ 3. Use ask_user for gathering detailed updates
492
+ 4. Preserve sections you're not updating
493
+ 5. Use edit tool (not write_file) to update specific sections
494
+ 6. Keep formatting consistent with existing document
495
+ 7. If scope changes affect backlog, suggest running /refine
496
+
497
+ ## COMPLETION CRITERIA
498
+ ✓ PRD.md is updated with changes
499
+ ✓ User has reviewed the updates
500
+ ✓ Related backlog updates are suggested if needed`,
501
+ tags: ['planning', 'requirements'],
502
+ });
503
+ export const sessionNotesSkill = defineSkill({
504
+ name: 'session-notes',
505
+ description: 'Create structured session notes capturing work done and decisions made',
506
+ prompt: `You are in SESSION NOTES MODE. Your goal is to create a structured summary of the current session.
507
+
508
+ ## When to Use
509
+ - End of a work session
510
+ - User asks to document what was done
511
+ - Need to capture decisions for future reference
512
+
513
+ ## When NOT to Use
514
+ - Need product requirements → use prd skill
515
+ - Need architecture docs → use architecture skill
516
+ - In the middle of active work
517
+
518
+ ## STARTUP
519
+
520
+ 1. Use todo_write to track your progress:
521
+ - "Gather session context"
522
+ - "Write session note"
523
+ - "Confirm with user"
524
+
525
+ 2. Review recent conversation to understand:
526
+ - What was accomplished
527
+ - What files were changed
528
+ - What decisions were made
529
+ - What blockers were encountered
530
+ - What should be done next
531
+
532
+ ## SESSION NOTE STRUCTURE
533
+
534
+ Create a markdown file with this structure:
535
+
536
+ \`\`\`markdown
537
+ # Session Note - {{title}}
538
+
539
+ **Date:** {{YYYY-MM-DD}}
540
+ **Project:** {{project_name}}
541
+
542
+ ---
543
+
544
+ ## Summary
545
+
546
+ {{2-3 sentence summary of what was accomplished}}
547
+
548
+ ## Changes Made
549
+
550
+ - {{list of files created/modified}}
551
+ - {{features implemented}}
552
+ - {{bugs fixed}}
553
+
554
+ ## Decisions Made
555
+
556
+ - {{architectural decisions}}
557
+ - {{technology choices}}
558
+ - {{scope changes}}
559
+
560
+ ## Blockers / Issues
561
+
562
+ - {{problems encountered}}
563
+ - {{unresolved questions}}
564
+
565
+ ## Next Steps
566
+
567
+ - [ ] {{actionable next task}}
568
+ - [ ] {{follow-up item}}
569
+
570
+ ---
571
+
572
+ *Generated by /note*
573
+ \`\`\`
574
+
575
+ ## FILE LOCATION
576
+
577
+ Save the note to:
578
+ - Single repo: \`.compilr/sessions/{{YYYY-MM-DD}}-{{slug}}.md\`
579
+ - Two repo: \`{{project}}-docs/04-session-notes/{{YYYY-MM-DD}}-{{slug}}.md\`
580
+
581
+ Create the directory if it doesn't exist.
582
+
583
+ ## RULES
584
+
585
+ 1. Use ask_user_simple to ask for a title if not provided
586
+ 2. Keep summary concise (2-3 sentences max)
587
+ 3. List concrete changes, not vague descriptions
588
+ 4. Decisions should explain the "why"
589
+ 5. Next steps should be actionable
590
+ 6. If user provides a title, use it; otherwise generate one from the summary
591
+
592
+ ## COMPLETION CRITERIA
593
+ ✓ Session note file is created
594
+ ✓ All sections are filled in
595
+ ✓ User has reviewed the note`,
596
+ tags: ['documentation', 'session'],
597
+ });
598
+ // =============================================================================
599
+ // From @compilr-dev/agents-coding-core (2 skills)
600
+ // =============================================================================
601
+ export const buildSkill = defineSkill({
602
+ name: 'build',
603
+ description: 'Implement a backlog item end-to-end',
604
+ tags: ['implementation', 'coding'],
605
+ prompt: `You are in BUILD MODE. Implement the specified backlog item.
606
+
607
+ ## When to Use
608
+ - Implementing a specific backlog item
609
+ - User says "build FEAT-001" or similar
610
+ - Ready to write code for a feature
611
+
612
+ ## When NOT to Use
613
+ - Item is too vague → use refine-item skill first
614
+ - No backlog exists → use design or sketch skill
615
+ - Just exploring code → use code-navigation skill
616
+ - Need to fix a bug → use debug skill
617
+
618
+ ## CRITICAL: PROJECT DIRECTORY
619
+
620
+ **All files MUST be created/modified in: {{projectPath}}**
621
+
622
+ Use ABSOLUTE paths for ALL file operations. Example:
623
+ - write_file({ path: "{{projectPath}}/src/feature.ts", ... })
624
+ - edit({ path: "{{projectPath}}/src/index.ts", ... })
625
+
626
+ NEVER use relative paths. NEVER use process.cwd().
627
+
628
+ ## ITEM TO IMPLEMENT
629
+ - **ID:** {{item_id}}
630
+ - **Title:** {{item_title}}
631
+ - **Type:** {{item_type}}
632
+ - **Priority:** {{item_priority}}
633
+ - **Description:** {{item_description}}
634
+
635
+ ## BEFORE STARTING
636
+
637
+ 1. Show the item details to the user in a clear format
638
+ 2. Use ask_user_simple to confirm: "Proceed with implementation?"
639
+ - Options: "Yes, let's build it", "No, pick a different item", "Cancel"
640
+ 3. If there are dependency warnings, mention them and ask if user wants to proceed anyway
641
+
642
+ ## CONTEXT TO READ
643
+
644
+ Before implementing, read these files for context:
645
+ - **PRD.md** (if exists): Project vision and requirements
646
+ - **CLAUDE.md**: Coding standards and conventions
647
+ - **Existing code**: Understand patterns already in use
648
+
649
+ ## IMPLEMENTATION WORKFLOW
650
+
651
+ ### Phase 1: Plan
652
+ 1. Use todo_write to create implementation checklist:
653
+ - Break down the item into concrete tasks
654
+ - Identify files to create or modify
655
+ - Note any edge cases to handle
656
+ 2. Update backlog status to 🚧 using backlog_write
657
+
658
+ ### Phase 2: Implement
659
+ 1. Write code following project conventions from CLAUDE.md
660
+ 2. Add tests if the project has a test framework
661
+ 3. Keep changes focused on the backlog item scope
662
+ 4. Use todo_write to track progress through tasks
663
+
664
+ ### Phase 3: Verify
665
+ 1. Run tests with run_tests tool
666
+ 2. Run lint with run_lint tool
667
+ 3. If tests or lint fail:
668
+ - Analyze the error message
669
+ - Fix the issue
670
+ - Re-run verification
671
+ - Repeat up to 3 times
672
+ 4. If still failing after 3 attempts:
673
+ - Report the issue to user
674
+ - Keep status as 🚧
675
+ - Ask for guidance
676
+
677
+ ### Phase 4: Complete
678
+ 1. Update backlog status to ✅ using backlog_write
679
+ 2. Create git commit with message format:
680
+ - feat({{item_id}}): {{item_title}} - for features
681
+ - fix({{item_id}}): {{item_title}} - for bugs
682
+ - chore({{item_id}}): {{item_title}} - for chores
683
+ 3. Update backlog with the commit SHA
684
+ 4. Clear todos with todo_write
685
+ 5. Summarize what was implemented
686
+
687
+ ## RULES
688
+
689
+ - Follow coding standards from CLAUDE.md strictly
690
+ - Keep commits atomic - one backlog item per commit
691
+ - Ask user via ask_user_simple if you hit blockers
692
+ - Don't over-engineer - implement exactly what the item describes
693
+ - Don't add features beyond what was requested
694
+ - Use todo_write throughout to show progress
695
+ - Always run tests before marking complete`,
696
+ version: '1.0.0',
697
+ });
698
+ export const scaffoldSkill = defineSkill({
699
+ name: 'scaffold',
700
+ description: 'Create project foundation based on tech stack',
701
+ tags: ['setup', 'foundation', 'scaffolding'],
702
+ prompt: `You are creating the PROJECT SCAFFOLD (foundation).
703
+
704
+ ## When to Use
705
+ - Starting a new project from scratch
706
+ - CHORE-001 scaffolding item in backlog
707
+ - Need basic project structure
708
+
709
+ ## When NOT to Use
710
+ - Project already has structure → use build skill
711
+ - Need requirements first → use design skill
712
+ - Modifying existing project → use appropriate skill
713
+
714
+ ## CRITICAL: PROJECT DIRECTORY
715
+
716
+ **All files MUST be created in: {{projectPath}}**
717
+
718
+ Use ABSOLUTE paths for ALL file operations. Example:
719
+ - write_file({ path: "{{projectPath}}/package.json", ... })
720
+ - write_file({ path: "{{projectPath}}/src/index.ts", ... })
721
+
722
+ NEVER use relative paths. NEVER use process.cwd().
723
+
724
+ ## PURPOSE
725
+
726
+ Create the base project structure that features will be built on top of.
727
+ This is the skeleton that makes feature implementation possible.
728
+
729
+ ## CONTEXT TO READ
730
+
731
+ Use project_document_get to read project documents from the database:
732
+ - PRD document for project vision and requirements
733
+ - Architecture documents if they exist
734
+
735
+ ## BEFORE STARTING
736
+
737
+ 1. Summarize the detected/specified tech stack
738
+ 2. Use ask_user_simple to confirm: "Create project scaffold with this stack?"
739
+ - Options: "Yes, create it", "No, let me specify", "Cancel"
740
+ 3. If user wants to specify, ask about tech stack preferences
741
+
742
+ ## SCAFFOLD BY PROJECT TYPE
743
+
744
+ ### Web Application (React/Vue/Svelte)
745
+
746
+ Create:
747
+ - \`src/\` folder structure:
748
+ - \`src/components/\` - Reusable components
749
+ - \`src/pages/\` or \`src/routes/\` - Page components
750
+ - \`src/lib/\` or \`src/utils/\` - Utility functions
751
+ - \`src/styles/\` - Global styles
752
+ - \`package.json\` with dependencies
753
+ - Build config (\`vite.config.ts\`, \`next.config.js\`, etc.)
754
+ - \`index.html\` entry point (if applicable)
755
+ - Basic App component with routing setup
756
+ - CSS/Tailwind configuration
757
+ - \`.gitignore\`
758
+ - \`README.md\` with setup instructions
759
+
760
+ ### API / Backend (Node/Python/Go)
761
+
762
+ Create:
763
+ - \`src/\` folder structure:
764
+ - \`src/routes/\` or \`src/api/\` - API endpoints
765
+ - \`src/services/\` - Business logic
766
+ - \`src/models/\` - Data models
767
+ - \`src/utils/\` - Utilities
768
+ - \`package.json\` / \`requirements.txt\` / \`go.mod\`
769
+ - Entry point (\`src/index.ts\`, \`main.py\`, \`main.go\`)
770
+ - Basic server setup (Express, FastAPI, Gin, etc.)
771
+ - Health check endpoint (\`GET /health\`)
772
+ - Environment config (\`.env.example\`)
773
+ - \`.gitignore\`
774
+ - \`README.md\` with setup instructions
775
+
776
+ ### CLI Tool (Node/Python/Rust)
777
+
778
+ Create:
779
+ - \`src/\` folder structure:
780
+ - \`src/commands/\` - Command handlers
781
+ - \`src/utils/\` - Utilities
782
+ - \`package.json\` with \`bin\` entry / \`setup.py\` / \`Cargo.toml\`
783
+ - Entry point with argument parsing
784
+ - Basic command structure (help, version)
785
+ - \`.gitignore\`
786
+ - \`README.md\` with usage instructions
787
+
788
+ ### Full-Stack Application
789
+
790
+ Create both frontend and backend structures:
791
+ - \`frontend/\` or \`client/\` - Web app scaffold
792
+ - \`backend/\` or \`server/\` - API scaffold
793
+ - Root \`package.json\` with workspace config (if monorepo)
794
+ - \`docker-compose.yml\` (optional)
795
+ - \`.gitignore\`
796
+ - \`README.md\` with setup instructions
797
+
798
+ ## POST-SCAFFOLD STEPS
799
+
800
+ 1. Install dependencies:
801
+ - \`npm install\` / \`pip install -r requirements.txt\` / etc.
802
+ 2. Run build to verify:
803
+ - \`npm run build\` / equivalent
804
+ 3. Run lint to verify:
805
+ - \`npm run lint\` / equivalent
806
+ 4. Create initial git commit:
807
+ - \`chore: initial project scaffold\`
808
+ 5. Update backlog:
809
+ - Mark scaffold CHORE as ✅ (if exists)
810
+
811
+ ## RULES
812
+
813
+ - Follow conventions from CLAUDE.md
814
+ - Use modern, widely-adopted patterns
815
+ - Keep it minimal - only what's needed to start
816
+ - Don't add features - just structure
817
+ - Ensure the project builds and lints clean
818
+ - Add helpful comments in config files
819
+ - Include TypeScript/type hints where applicable`,
820
+ version: '1.0.0',
821
+ });
822
+ // =============================================================================
823
+ // Aggregate export
824
+ // =============================================================================
825
+ /**
826
+ * All platform-specific skills (9 total).
827
+ * These skills reference platform tools (backlog, workitems, documents, projects)
828
+ * and belong in the SDK rather than in generic agent/coding libraries.
829
+ */
830
+ export const platformSkills = [
831
+ designSkill,
832
+ sketchSkill,
833
+ prdSkill,
834
+ refineSkill,
835
+ refineItemSkill,
836
+ architectureSkill,
837
+ sessionNotesSkill,
838
+ buildSkill,
839
+ scaffoldSkill,
840
+ ];