@raftlabs/raftstack 1.7.2 → 1.9.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,244 @@
1
+ # RaftStack: Inject Relevant Context
2
+
3
+ Surface relevant standards and skills for the current work context.
4
+
5
+ ## Arguments
6
+
7
+ - `$ARGUMENTS` - (Optional) Specific domain or task context (e.g., "React component", "API endpoint", "database migration")
8
+
9
+ ## Tool Usage
10
+
11
+ **IMPORTANT:** Always use the `AskUserQuestion` tool for:
12
+ - Context clarification
13
+ - Standard selection
14
+ - Follow-up options
15
+
16
+ Never use plain text questions - always use the structured `AskUserQuestion` tool.
17
+
18
+ ## Phase 1: Context Detection
19
+
20
+ If no specific context provided, infer from:
21
+
22
+ 1. **Recent conversation:** What has been discussed?
23
+ 2. **Recent files:** What files were recently read/edited?
24
+ 3. **Current task:** What is the user working on?
25
+
26
+ Identify the domain(s):
27
+ - React/Frontend
28
+ - API/Backend
29
+ - Database
30
+ - SEO
31
+ - Testing
32
+ - General code quality
33
+
34
+ If context is unclear, use `AskUserQuestion`:
35
+ - Option A: React/Frontend - Components, hooks, state
36
+ - Option B: API/Backend - Routes, services, validation
37
+ - Option C: Database - Schema, queries, migrations
38
+ - Option D: Other (let user specify)
39
+
40
+ ## Phase 2: Standards Discovery
41
+
42
+ Scan for standards files in likely locations:
43
+
44
+ 1. **Check common standard locations:**
45
+ - `.claude/standards/` and subdirectories
46
+ - `docs/standards/`
47
+ - `standards/`
48
+ - Files matching `*.standard.md`
49
+
50
+ 2. **Match by domain:**
51
+ - React work → look for component, state, hooks standards
52
+ - API work → look for route, validation, error standards
53
+ - Database work → look for schema, query, migration standards
54
+
55
+ 3. **Check for constitution/context:**
56
+ - `.claude/context/constitution.md`
57
+ - `CONSTITUTION.md`
58
+ - `docs/constitution.md`
59
+
60
+ ## Phase 3: Skills Matching
61
+
62
+ Based on the detected domain, identify relevant RaftStack skills:
63
+
64
+ | Domain | Skill | Path |
65
+ |--------|-------|------|
66
+ | React/Frontend | React Development | `.claude/skills/react/SKILL.md` |
67
+ | API/Backend | Backend Development | `.claude/skills/backend/SKILL.md` |
68
+ | Database | Database Design | `.claude/skills/database/SKILL.md` |
69
+ | SEO | Technical SEO | `.claude/skills/seo/SKILL.md` |
70
+ | General | Code Quality | `.claude/skills/code-quality/SKILL.md` |
71
+ | Asana Integration | Asana Workflow | `.claude/skills/asana/SKILL.md` |
72
+
73
+ ## Phase 4: Context-Aware Summary
74
+
75
+ Present the injected context as a structured summary:
76
+
77
+ ```markdown
78
+ ## 📚 Relevant Context for [Domain]
79
+
80
+ ### Standards Found
81
+ | Standard | Path | Key Points |
82
+ |----------|------|------------|
83
+ | [Name] | `[Path]` | • [Point 1] • [Point 2] |
84
+ | [Name] | `[Path]` | • [Point 1] • [Point 2] |
85
+
86
+ ### Skills to Apply
87
+ | Skill | Path | When to Use |
88
+ |-------|------|-------------|
89
+ | [Name] | `[Path]` | [Trigger condition] |
90
+ | [Name] | `[Path]` | [Trigger condition] |
91
+
92
+ ### Quick Reference (Most Important Rules)
93
+ 1. **[Rule]** - [Brief explanation]
94
+ 2. **[Rule]** - [Brief explanation]
95
+ 3. **[Rule]** - [Brief explanation]
96
+
97
+ ### Constitution Context
98
+ [Key points from constitution relevant to this domain]
99
+
100
+ ---
101
+
102
+ **Your options:** [A] Load full standard [B] Load specific skill [C] Show all details [D] Search for more
103
+ ```
104
+
105
+ Use `AskUserQuestion` for options.
106
+
107
+ ## Phase 5: Detailed Loading
108
+
109
+ If user selects to load full details:
110
+
111
+ ### For Standards
112
+ ```markdown
113
+ ## [Standard Name] (Full)
114
+
115
+ **Source:** `path/to/standard.md`
116
+
117
+ [Full content of the standard]
118
+
119
+ ---
120
+ **Your options:** [A] Load another standard [B] Back to summary [C] Done
121
+ ```
122
+
123
+ ### For Skills
124
+ ```markdown
125
+ ## [Skill Name] (Full)
126
+
127
+ **Source:** `path/to/SKILL.md`
128
+
129
+ [Key sections of the skill relevant to current task]
130
+
131
+ ---
132
+ **Your options:** [A] Load another skill [B] Back to summary [C] Done
133
+ ```
134
+
135
+ ## Phase 6: Follow-up Suggestions
136
+
137
+ After injecting context, present recommendations:
138
+
139
+ ```markdown
140
+ ### 🔄 Suggestions Based on Context
141
+
142
+ **If no standards found:**
143
+ → Consider running `/raftstack/discover [area]` to document patterns from your codebase
144
+
145
+ **If no constitution:**
146
+ → Consider running `/raftstack/init-context` to generate a project constitution
147
+
148
+ **If standards may be outdated:**
149
+ → Consider running `/raftstack/index` to check for drift
150
+
151
+ **Your options:** [A] [Relevant suggestion] [B] [Alternative] [C] Continue working [D] Show all commands
152
+ ```
153
+
154
+ Use `AskUserQuestion` for follow-up options.
155
+
156
+ ## Example Sessions
157
+
158
+ ### Example 1: Working on React Component
159
+
160
+ **User:** `/raftstack/inject React`
161
+
162
+ **AI responds:**
163
+ ```markdown
164
+ ## 📚 Relevant Context for React
165
+
166
+ ### Standards Found
167
+ | Standard | Path | Key Points |
168
+ |----------|------|------------|
169
+ | Components | `.claude/standards/react/components.md` | • Named exports • Max 3 concerns |
170
+
171
+ ### Skills to Apply
172
+ | Skill | Path | When to Use |
173
+ |-------|------|-------------|
174
+ | React Development | `.claude/skills/react/SKILL.md` | Components, hooks, state |
175
+ | Code Quality | `.claude/skills/code-quality/SKILL.md` | All code changes |
176
+
177
+ ### Quick Reference (Most Important Rules)
178
+ 1. **Server Components by default** - Add 'use client' only when needed
179
+ 2. **Max 3 concerns per component** - Split if handling more
180
+ 3. **React 19: No manual memoization** - React Compiler handles it
181
+
182
+ **Your options:** [A] Load React skill [B] Load Components standard [C] Show all [D] Search more
183
+ ```
184
+
185
+ ### Example 2: Planning API Work
186
+
187
+ **User:** `/raftstack/inject API`
188
+
189
+ **AI responds:**
190
+ ```markdown
191
+ ## 📚 Relevant Context for API
192
+
193
+ ### Standards Found
194
+ | Standard | Path | Key Points |
195
+ |----------|------|------------|
196
+ | Error Handling | `.claude/standards/api/error-handling.md` | • ApiError class • Correlation ID |
197
+ | Validation | `.claude/standards/api/validation.md` | • Zod schemas • 400 responses |
198
+
199
+ ### Skills to Apply
200
+ | Skill | Path | When to Use |
201
+ |-------|------|-------------|
202
+ | Backend Development | `.claude/skills/backend/SKILL.md` | Routes, services, handlers |
203
+ | Code Quality | `.claude/skills/code-quality/SKILL.md` | All code changes |
204
+
205
+ ### Quick Reference (Most Important Rules)
206
+ 1. **Clean architecture** - Handler → Service → Repository
207
+ 2. **Zod validation** - Validate at handler entry point
208
+ 3. **Consistent error format** - Use ApiError with code, message, details
209
+
210
+ **Your options:** [A] Load Backend skill [B] Load Error standard [C] Show all [D] Search more
211
+ ```
212
+
213
+ ### Example 3: No Standards Found
214
+
215
+ **User:** `/raftstack/inject auth`
216
+
217
+ **AI responds:**
218
+ ```markdown
219
+ ## 📚 Relevant Context for Authentication
220
+
221
+ ### Standards Found
222
+ | Standard | Path | Key Points |
223
+ |----------|------|------------|
224
+ | *No auth-specific standards found* | - | - |
225
+
226
+ ### Skills to Apply
227
+ | Skill | Path | When to Use |
228
+ |-------|------|-------------|
229
+ | Backend Development | `.claude/skills/backend/SKILL.md` | Auth middleware, sessions |
230
+
231
+ ### Quick Reference (From Backend Skill)
232
+ 1. **Middleware pattern** - Check auth before handlers
233
+ 2. **Error handling** - Return 401/403 appropriately
234
+ 3. **Session management** - Use secure, httpOnly cookies
235
+
236
+ ---
237
+
238
+ ### 🔄 Suggestions
239
+ No auth-specific standards found in this project.
240
+
241
+ **Your options:** [A] Run `/raftstack/discover auth` to document patterns [B] Load Backend skill [C] Continue without standards [D] Show all commands
242
+ ```
243
+
244
+ Use `AskUserQuestion` for options.
@@ -0,0 +1,253 @@
1
+ # RaftStack: Shape Feature/Task
2
+
3
+ Plan a feature or task with scale-adaptive depth. Simple tasks get quick flow, complex tasks get full specs.
4
+
5
+ ## Arguments
6
+
7
+ - `$ARGUMENTS` - Description of the feature or task to plan
8
+
9
+ ## Tool Usage
10
+
11
+ **IMPORTANT:** Always use the `AskUserQuestion` tool for:
12
+ - Complexity confirmation
13
+ - Location negotiation
14
+ - Option selection
15
+ - Clarification questions
16
+
17
+ Never use plain text questions - always use the structured `AskUserQuestion` tool.
18
+
19
+ ## Feature Status Tracking
20
+
21
+ Include status in every summary:
22
+
23
+ ```
24
+ 📊 **Feature Status:** [Feature Name] ([Stage])
25
+ Progress: [●●●○○] [X]% | Phase: [Current] → Next: [Next Phase]
26
+ ```
27
+
28
+ **Stage values:**
29
+ - `Shaping` (20%) - ●○○○○
30
+ - `Planning` (40%) - ●●○○○
31
+ - `Tasking` (60%) - ●●●○○
32
+ - `In Progress` (80%) - ●●●●○
33
+ - `Complete` (100%) - ●●●●●
34
+
35
+ ## Phase 1: Complexity Assessment
36
+
37
+ Analyze the task to determine scale:
38
+
39
+ **Simple (Quick Flow):**
40
+ - Bug fix with clear cause
41
+ - Single-file change
42
+ - Adding a field/property
43
+ - Simple UI tweak
44
+
45
+ **Medium (Light Spec):**
46
+ - New component with clear requirements
47
+ - New API endpoint
48
+ - Refactoring a module
49
+ - Adding a straightforward feature
50
+
51
+ **Complex (Full Spec):**
52
+ - Multi-component feature
53
+ - New data flow/architecture
54
+ - Integration with external service
55
+ - Major refactoring
56
+ - Cross-cutting concerns (auth, logging, etc.)
57
+
58
+ After assessment, use `AskUserQuestion` to confirm the complexity level:
59
+ - Option A: Quick Flow (simple task)
60
+ - Option B: Light Spec (medium complexity)
61
+ - Option C: Full Spec (complex feature)
62
+ - Option D: Let me clarify the task
63
+
64
+ ## Phase 2: Execute Based on Scale
65
+
66
+ ### Quick Flow (Simple Tasks)
67
+
68
+ 1. Clarify scope in 2-3 sentences
69
+ 2. Identify the file(s) to change
70
+ 3. Describe the change briefly
71
+ 4. Proceed directly to implementation
72
+
73
+ Output format:
74
+ ```markdown
75
+ ## Quick Shape: [Task Name]
76
+
77
+ 📊 **Feature Status:** [Task Name] (Shaping)
78
+ Progress: [●○○○○] 20% | Phase: Quick Shape → Implementation
79
+
80
+ **Scope:** [What needs to change]
81
+ **Files:** [1-2 files]
82
+ **Approach:** [Brief description]
83
+
84
+ Ready to implement.
85
+
86
+ **Your options:** [A] Proceed to implement [B] Add more detail [C] Change approach [D] Cancel
87
+ ```
88
+
89
+ Use `AskUserQuestion` for options.
90
+
91
+ ### Light Spec (Medium Tasks)
92
+
93
+ 1. Define the requirement clearly
94
+ 2. Identify related code patterns to follow
95
+ 3. List files to create/modify
96
+ 4. Note any standards to apply
97
+
98
+ Output format:
99
+ ```markdown
100
+ ## Shape: [Feature Name]
101
+
102
+ 📊 **Feature Status:** [Feature Name] (Planning)
103
+ Progress: [●●○○○] 40% | Phase: Light Spec → Implementation
104
+
105
+ ### Requirement
106
+ [Clear statement of what needs to be built]
107
+
108
+ ### Existing Patterns
109
+ [Reference similar code in the codebase to follow]
110
+
111
+ ### Implementation Plan
112
+ 1. [Step with file path]
113
+ 2. [Step with file path]
114
+ 3. [Step with file path]
115
+
116
+ ### Standards to Apply
117
+ - [Reference any discovered standards: @.claude/standards/...]
118
+ - [Reference any skills: @.claude/skills/...]
119
+
120
+ **Your options:** [A] Proceed to implement [B] Save spec to file [C] Modify plan [D] Upgrade to full spec
121
+ ```
122
+
123
+ Use `AskUserQuestion` for options.
124
+
125
+ ### Full Spec (Complex Tasks)
126
+
127
+ 1. **Understand the domain:**
128
+ - What problem does this solve?
129
+ - Who are the users/consumers?
130
+ - What are the success criteria?
131
+
132
+ 2. **Explore existing code:**
133
+ - Find similar features to learn from
134
+ - Identify integration points
135
+ - Note architectural constraints
136
+
137
+ 3. **Design the solution:**
138
+ - Data model changes
139
+ - API contracts
140
+ - Component structure
141
+ - State management approach
142
+ - Error handling strategy
143
+
144
+ 4. **Break into phases:**
145
+ - Phase 1: Core functionality
146
+ - Phase 2: Edge cases/polish
147
+ - Phase 3: Testing/docs
148
+
149
+ 5. **Location negotiation for spec folder:**
150
+
151
+ Use `AskUserQuestion` with these options:
152
+ - Option A: `.claude/specs/[feature-slug]/` - Claude-specific planning (Recommended)
153
+ - Option B: `docs/specs/[feature-slug]/` - With documentation
154
+ - Option C: `specs/[feature-slug]/` - At project root
155
+ - Option D: Other (let user specify)
156
+
157
+ ## Full Spec Folder Structure
158
+
159
+ Create folder: `{negotiated-path}/{YYYY-MM-DD-HHMM}-{feature-slug}/`
160
+
161
+ Example: `.claude/specs/2024-01-27-1430-comment-threading/`
162
+
163
+ Contents:
164
+ ```
165
+ {spec-folder}/
166
+ ├── README.md # Overview, goals, success criteria
167
+ ├── shape.md # Shaping decisions and context
168
+ │ - Scope definition
169
+ │ - Key decisions made
170
+ │ - Constraints noted
171
+ ├── standards.md # Full content of applicable standards
172
+ │ - Copy relevant standards inline
173
+ │ - Note why each applies
174
+ ├── references.md # Similar code in codebase
175
+ │ - File paths studied
176
+ │ - Patterns to follow
177
+ │ - Patterns to avoid
178
+ ├── architecture.md # Technical design (if needed)
179
+ │ - Data model changes
180
+ │ - API contracts
181
+ │ - Component structure
182
+ └── visuals/ # Mockups, screenshots (if provided)
183
+ ```
184
+
185
+ ### Full Spec Summary
186
+
187
+ After creating the spec folder, present:
188
+
189
+ ```markdown
190
+ ## ✅ Full Spec Created
191
+
192
+ 📊 **Feature Status:** [Feature Name] (Tasking)
193
+ Progress: [●●●○○] 60% | Phase: Full Spec → Implementation
194
+
195
+ ### 🎯 Key Decisions Made (Top 3)
196
+ 1. [Decision] - **Rationale:** [Why this approach]
197
+ 2. [Decision] - **Rationale:** [Why this approach]
198
+ 3. [Decision] - **Rationale:** [Why this approach]
199
+
200
+ ### 📋 Spec Contents
201
+ - **README.md:** Overview and success criteria
202
+ - **shape.md:** Scope and constraints
203
+ - **standards.md:** [N] applicable standards
204
+ - **references.md:** [N] similar patterns found
205
+ - **architecture.md:** Technical design
206
+
207
+ ### 🔍 Implementation Phases
208
+ 1. **Phase 1:** [Core functionality] - [N files]
209
+ 2. **Phase 2:** [Edge cases] - [N files]
210
+ 3. **Phase 3:** [Testing/docs] - [N files]
211
+
212
+ ### ⚠️ Watch Out For
213
+ - [Risk or complexity] - **Mitigation:** [How to handle]
214
+ - [Dependency or blocker] - **Status:** [Current state]
215
+
216
+ ### 🔄 Ready for Implementation
217
+ Spec folder created at: `{path}`
218
+
219
+ **Your options:** [A] Start implementation [B] Review spec files [C] Modify architecture [D] Add more detail
220
+ ```
221
+
222
+ Use `AskUserQuestion` for options.
223
+
224
+ ## Phase 3: Standards Injection
225
+
226
+ Before finalizing the plan, check for relevant standards and skills:
227
+
228
+ 1. Scan for standards files in likely locations:
229
+ - `.claude/standards/`
230
+ - `docs/standards/`
231
+ - Project root (`*.standard.md`)
232
+
233
+ 2. Identify relevant skills based on the task domain:
234
+ - React work → `@.claude/skills/react/SKILL.md`
235
+ - API work → `@.claude/skills/backend/SKILL.md`
236
+ - Database work → `@.claude/skills/database/SKILL.md`
237
+ - SEO work → `@.claude/skills/seo/SKILL.md`
238
+ - General → `@.claude/skills/code-quality/SKILL.md`
239
+
240
+ 3. Include references in the plan output
241
+
242
+ For Full Specs, copy the full content of applicable standards into `standards.md` with notes on why each applies.
243
+
244
+ ## Examples
245
+
246
+ **User says:** "Fix the typo in the header"
247
+ → Quick Flow: Identify file, describe fix, implement
248
+
249
+ **User says:** "Add a delete button to user cards"
250
+ → Light Spec: Plan component changes, identify patterns, list steps
251
+
252
+ **User says:** "Implement comment threading for posts"
253
+ → Full Spec: Create timestamped spec folder with architecture docs, phased plan