ai-workflow-init 6.6.0 → 7.0.0

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/CLAUDE.md CHANGED
@@ -8,6 +8,11 @@
8
8
  - Avoid over-engineering and unnecessary abstractions
9
9
  - Don't build for hypothetical futures
10
10
 
11
+ - **Readability > Cleverness**
12
+ - Prefer clear, readable code over clever one-liners
13
+ - Code is read more often than written - optimize for understanding
14
+ - If code needs a comment to explain what it does, consider rewriting it
15
+
11
16
  - **Think ahead ONLY for:**
12
17
  - **Security**: Input validation, authentication, authorization
13
18
  - **Performance**: Scalability bottlenecks, query optimization
@@ -18,9 +23,11 @@
18
23
  - ✅ Add input validation for user data (security)
19
24
  - ✅ Consider pagination for large datasets (performance)
20
25
  - ❌ Don't create abstractions for one-time operations
26
+ - ❌ Don't write clever one-liners that require mental parsing
21
27
 
22
28
  ### 2. Deep Understanding
23
29
  - If unclear about requirements, edge cases, or expected behavior → **Ask first**
30
+ - Use `AskUserQuestion` tool to ask multiple questions at once (up to 4)
24
31
  - Never assume or guess - clarification prevents wasted effort
25
32
  - Key questions:
26
33
  - "What should happen when X occurs?"
@@ -0,0 +1,209 @@
1
+ ---
2
+ name: audit-workflow
3
+ description: Audit Claude Code workflow configuration (agents, skills, commands, hooks, output-styles) and provide improvement recommendations.
4
+ ---
5
+
6
+ # Workflow Audit
7
+
8
+ Analyze the Claude Code workflow configuration in this project and provide actionable recommendations.
9
+
10
+ ## Audit Process
11
+
12
+ ### Step 1: Gather Workflow Files
13
+
14
+ Collect all workflow configuration files:
15
+
16
+ ```
17
+ Read and analyze:
18
+ - .claude/CLAUDE.md (main instructions)
19
+ - .claude/settings.json (hooks configuration)
20
+ - .claude/settings.local.json (local hooks)
21
+ - .claude/agents/*.md (all agent definitions)
22
+ - .claude/skills/*/SKILL.md (all skill definitions)
23
+ - .claude/commands/*.md (all command definitions)
24
+ - .claude/output-styles/*.md (all output styles)
25
+ ```
26
+
27
+ Use Glob to find all files, then Read each one.
28
+
29
+ ### Step 2: Analyze Each Category
30
+
31
+ For each category, evaluate:
32
+
33
+ #### 2.1 Skills Analysis
34
+
35
+ | Criteria | Check |
36
+ |----------|-------|
37
+ | **Trigger clarity** | Is `description` specific about when to load? |
38
+ | **Overlap detection** | Do multiple skills cover same triggers? |
39
+ | **Size efficiency** | Is SKILL.md < 500 lines? Uses references for large content? |
40
+ | **Progressive disclosure** | Does it use references/ for optional content? |
41
+ | **Auto-load frequency** | Does "ALWAYS load when..." appear too often? |
42
+
43
+ **Overlap detection keywords to check:**
44
+ - UI/frontend: `frontend-design-*`, `ux-*`
45
+ - Code quality: `quality-*`, `*-review`
46
+ - Testing: `*-test`, `writing-test`
47
+
48
+ #### 2.2 Commands Analysis
49
+
50
+ | Criteria | Check |
51
+ |----------|-------|
52
+ | **Purpose clarity** | Is the command's purpose clear from name + description? |
53
+ | **Workflow alignment** | Does it follow CLAUDE.md guidelines? |
54
+ | **Agent delegation** | Does it use Task tool for complex sub-tasks? |
55
+ | **Duplication** | Are there commands that do similar things? |
56
+
57
+ #### 2.3 Agents Analysis
58
+
59
+ | Criteria | Check |
60
+ |----------|-------|
61
+ | **Role clarity** | Is the agent's specialized role well-defined? |
62
+ | **Tool access** | Does it have appropriate tool restrictions? |
63
+ | **Prompt quality** | Is the prompt concise but complete? |
64
+
65
+ #### 2.4 Hooks Analysis
66
+
67
+ | Criteria | Check |
68
+ |----------|-------|
69
+ | **Necessity** | Is each hook actually needed? |
70
+ | **Performance** | Are hooks lightweight (< 1 second execution)? |
71
+ | **Error handling** | Do hooks exit gracefully on failure? |
72
+ | **Matcher specificity** | Are matchers precise enough? |
73
+
74
+ #### 2.5 Output Styles Analysis
75
+
76
+ | Criteria | Check |
77
+ |----------|-------|
78
+ | **Use case clarity** | When should this style be applied? |
79
+ | **Conflict potential** | Does it conflict with other styles? |
80
+
81
+ #### 2.6 CLAUDE.md Analysis
82
+
83
+ | Criteria | Check |
84
+ |----------|-------|
85
+ | **Conciseness** | Is it under 500 lines? No redundant info? |
86
+ | **Actionability** | Are instructions clear and actionable? |
87
+ | **Conflicts** | Does it conflict with skill instructions? |
88
+
89
+ ### Step 3: Context Usage Estimation
90
+
91
+ Estimate token usage for each component:
92
+
93
+ ```
94
+ Token estimation formula:
95
+ - ~4 characters = 1 token (rough estimate)
96
+ - Metadata always loaded: name + description (~100-200 tokens each)
97
+ - Body loaded on trigger: full content
98
+ ```
99
+
100
+ Calculate:
101
+ 1. **Always-loaded tokens**: Sum of all metadata
102
+ 2. **Frequently-loaded tokens**: Skills with "ALWAYS load" triggers
103
+ 3. **On-demand tokens**: Skills with specific triggers
104
+
105
+ ### Step 4: Generate Report
106
+
107
+ Output format:
108
+
109
+ ```markdown
110
+ # Workflow Audit Report
111
+
112
+ ## Summary
113
+
114
+ | Category | Count | Issues | Recommendations |
115
+ |----------|-------|--------|-----------------|
116
+ | Skills | X | Y | Z |
117
+ | Commands | X | Y | Z |
118
+ | Agents | X | Y | Z |
119
+ | Hooks | X | Y | Z |
120
+ | Output Styles | X | Y | Z |
121
+
122
+ ## Context Budget Analysis
123
+
124
+ ### Always-Loaded (~X tokens)
125
+ - CLAUDE.md: ~X tokens
126
+ - Skill metadata: ~X tokens (Y skills × ~100 tokens)
127
+ - Total baseline: ~X tokens
128
+
129
+ ### Frequently-Loaded (~X tokens per session)
130
+ - skill-name-1 (ALWAYS load for frontend): ~X tokens
131
+ - skill-name-2 (ALWAYS load for React): ~X tokens
132
+
133
+ ### On-Demand
134
+ - skill-name-3: ~X tokens (loads for specific trigger)
135
+
136
+ ## Detailed Findings
137
+
138
+ ### 🔴 Critical Issues
139
+ Issues that significantly impact performance or cause errors.
140
+
141
+ ### 🟡 Improvements
142
+ Optimizations that would improve efficiency.
143
+
144
+ ### 🟢 Best Practices Followed
145
+ Positive patterns worth maintaining.
146
+
147
+ ## Recommendations
148
+
149
+ ### High Priority
150
+ 1. [Specific actionable recommendation]
151
+ - **Impact**: [What improves]
152
+ - **Effort**: [Low/Medium/High]
153
+
154
+ ### Medium Priority
155
+ ...
156
+
157
+ ### Low Priority (Nice to Have)
158
+ ...
159
+
160
+ ## Overlap Analysis
161
+
162
+ ### Potential Skill Overlaps
163
+ | Skills | Overlap Area | Recommendation |
164
+ |--------|--------------|----------------|
165
+ | A, B | frontend triggers | Consider merging or clarifying triggers |
166
+
167
+ ### Command Redundancies
168
+ ...
169
+
170
+ ## Suggested Consolidations
171
+
172
+ If skills/commands can be merged:
173
+ - Merge `skill-a` + `skill-b` → `combined-skill` (saves ~X tokens)
174
+ ```
175
+
176
+ ## Analysis Guidelines
177
+
178
+ ### What Makes a Good Workflow
179
+
180
+ 1. **Minimal always-loaded content**: Only essential instructions in CLAUDE.md
181
+ 2. **Specific triggers**: Skills load only when truly needed
182
+ 3. **No overlaps**: Each skill/command has unique purpose
183
+ 4. **Progressive disclosure**: Large content split into references
184
+ 5. **Lightweight hooks**: Fast execution, graceful failures
185
+
186
+ ### Red Flags to Watch For
187
+
188
+ - Skills with "ALWAYS load" for broad triggers (e.g., "any code")
189
+ - Multiple skills triggering on same keywords
190
+ - Commands that duplicate skill functionality
191
+ - Hooks that run on every tool use
192
+ - CLAUDE.md > 300 lines
193
+ - Skills > 500 lines without using references/
194
+
195
+ ### Token Budget Guidelines
196
+
197
+ | Budget Level | Always-Loaded | Recommendation |
198
+ |--------------|---------------|----------------|
199
+ | Lean | < 2000 tokens | Excellent |
200
+ | Normal | 2000-5000 | Good |
201
+ | Heavy | 5000-10000 | Consider optimization |
202
+ | Bloated | > 10000 | Needs consolidation |
203
+
204
+ ## Execution
205
+
206
+ 1. Run full analysis
207
+ 2. Generate report with findings
208
+ 3. Prioritize recommendations by impact/effort ratio
209
+ 4. Offer to implement quick wins if user approves
@@ -0,0 +1,184 @@
1
+ ---
2
+ name: cleanup
3
+ description: Cleans up workflow markdown files older than the configured retention period.
4
+ ---
5
+
6
+ ## Configuration
7
+
8
+ ```
9
+ RETENTION_DAYS = 7
10
+ ```
11
+
12
+ > **To change retention period**: Update the `RETENTION_DAYS` value above.
13
+
14
+ ---
15
+
16
+ ## Goal
17
+
18
+ Clean up workflow markdown files older than `RETENTION_DAYS` in `docs/ai/` directories.
19
+
20
+ ---
21
+
22
+ ## Step 1: Select Cleanup Scope
23
+
24
+ **Tool:** AskUserQuestion
25
+
26
+ ```
27
+ Question: Which scope do you want to clean up?
28
+ Options:
29
+ 1. Main files only - Delete main files (exclude archive/ folders)
30
+ 2. Archive only - Delete only files in archive/ folders
31
+ 3. All files - Delete both main files and archive/
32
+ ```
33
+
34
+ **Set internal flag:** `CLEANUP_SCOPE = main_only | archive_only | all`
35
+
36
+ ---
37
+
38
+ ## Step 2: Scan Files
39
+
40
+ **Directories to scan:**
41
+
42
+ ```
43
+ docs/ai/planning/ # epic-*.md, feature-*.md
44
+ docs/ai/planning/archive/ # backup files
45
+ docs/ai/testing/ # unit-*.md, integration-*.md
46
+ docs/ai/requirements/ # req-*.md
47
+ docs/ai/requirements/agents/ # ba-*.md, sa-*.md, research-*.md, uiux-*.md
48
+ docs/ai/requirements/archive/ # backup files
49
+ ```
50
+
51
+ **Based on CLEANUP_SCOPE:**
52
+ - `main_only`: Scan all except `archive/` folders
53
+ - `archive_only`: Scan only `archive/` folders
54
+ - `all`: Scan everything
55
+
56
+ **Command to find old files (older than RETENTION_DAYS):**
57
+
58
+ ```bash
59
+ find docs/ai/planning docs/ai/testing docs/ai/requirements -name "*.md" -type f -mtime +{RETENTION_DAYS} 2>/dev/null
60
+ ```
61
+
62
+ **For archive only:**
63
+
64
+ ```bash
65
+ find docs/ai/planning/archive docs/ai/requirements/archive -name "*.md" -type f -mtime +{RETENTION_DAYS} 2>/dev/null
66
+ ```
67
+
68
+ **For main only (exclude archive):**
69
+
70
+ ```bash
71
+ find docs/ai/planning docs/ai/testing docs/ai/requirements -name "*.md" -type f -mtime +{RETENTION_DAYS} -not -path "*/archive/*" 2>/dev/null
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Step 3: Build File List
77
+
78
+ **For each file found:**
79
+ 1. Get file path
80
+ 2. Get last modified date
81
+ 3. Calculate age in days
82
+
83
+ **Format output:**
84
+
85
+ ```markdown
86
+ ## Files older than {RETENTION_DAYS} days
87
+
88
+ | File | Last Modified | Age |
89
+ |------|---------------|-----|
90
+ | docs/ai/planning/feature-login.md | 2025-01-10 | 15 days |
91
+ | docs/ai/planning/archive/feature-auth_20250105.md | 2025-01-05 | 20 days |
92
+ | docs/ai/testing/unit-auth.md | 2025-01-12 | 13 days |
93
+
94
+ **Total: X files**
95
+ ```
96
+
97
+ **If no files found:**
98
+
99
+ ```
100
+ ✓ No files older than {RETENTION_DAYS} days found in the selected scope.
101
+ ```
102
+
103
+ Then exit.
104
+
105
+ ---
106
+
107
+ ## Step 4: Confirm Deletion
108
+
109
+ **Tool:** AskUserQuestion
110
+
111
+ ```
112
+ Question: Confirm deletion of {X} files listed above?
113
+ Options:
114
+ 1. Yes, delete all - Delete all listed files
115
+ 2. No, cancel - Cancel, do not delete anything
116
+ ```
117
+
118
+ **If user chooses "No, cancel":**
119
+
120
+ ```
121
+ ✓ Cancelled. No files were deleted.
122
+ ```
123
+
124
+ Then exit.
125
+
126
+ ---
127
+
128
+ ## Step 5: Execute Deletion
129
+
130
+ **For each file in the list:**
131
+
132
+ ```bash
133
+ rm "{file_path}"
134
+ ```
135
+
136
+ **Track results:**
137
+ - Files deleted successfully
138
+ - Files failed to delete (if any)
139
+
140
+ ---
141
+
142
+ ## Step 6: Report Results
143
+
144
+ ```markdown
145
+ ## Cleanup Complete
146
+
147
+ ✓ Deleted: {success_count} files
148
+ ✗ Failed: {failed_count} files
149
+
150
+ ### Deleted Files
151
+ - docs/ai/planning/feature-login.md
152
+ - docs/ai/planning/archive/feature-auth_20250105.md
153
+ - docs/ai/testing/unit-auth.md
154
+
155
+ {If any failed:}
156
+ ### Failed to Delete
157
+ - {file_path}: {error message}
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Notes
163
+
164
+ - **Retention period**: Configured via `RETENTION_DAYS` variable (default: 7)
165
+ - **Safe by default**: Always requires confirmation before deletion
166
+ - **No orphan detection**: Only checks file age, not relationships
167
+ - **Templates excluded**: Does not delete `*-template.md` files
168
+
169
+ ### File Patterns Affected
170
+
171
+ | Directory | Patterns |
172
+ |-----------|----------|
173
+ | `docs/ai/planning/` | `epic-*.md`, `feature-*.md` |
174
+ | `docs/ai/planning/archive/` | `epic-*_*.md`, `feature-*_*.md` |
175
+ | `docs/ai/testing/` | `unit-*.md`, `integration-*.md` |
176
+ | `docs/ai/requirements/` | `req-*.md` |
177
+ | `docs/ai/requirements/agents/` | `ba-*.md`, `sa-*.md`, `research-*.md`, `uiux-*.md` |
178
+ | `docs/ai/requirements/archive/` | `req-*_*.md` |
179
+
180
+ ### Excluded from Cleanup
181
+
182
+ - Template files: `*-template.md`
183
+ - Non-markdown files
184
+ - Files in other directories
@@ -15,47 +15,6 @@ Generate a single planning doc at `docs/ai/planning/feature-{name}.md` using the
15
15
 
16
16
  ---
17
17
 
18
- ## Step 0: Check Beads Context (Optional Integration)
19
-
20
- > **Purpose**: Detect if this plan is for a Beads task. If so, link to epic and inherit context.
21
-
22
- **Read:** `.beads/current-task.json`
23
-
24
- **If file exists (Beads workflow active):**
25
-
26
- ```json
27
- {
28
- "task_id": "bd-auth.1",
29
- "task_title": "Setup JWT infrastructure",
30
- "epic_id": "bd-auth",
31
- "epic_title": "User Authentication System",
32
- "epic_plan": "docs/ai/planning/epic-auth-system.md"
33
- }
34
- ```
35
-
36
- Set internal flags:
37
- - `BEADS_MODE = true`
38
- - `beads_task = task_id`
39
- - `beads_epic = epic_id`
40
- - `suggested_title = task_title`
41
- - `epic_plan_path = epic_plan`
42
-
43
- **If epic_plan exists:**
44
- - Read epic plan for architecture context
45
- - Extract relevant sections:
46
- - Architecture overview (for codebase context)
47
- - Key decisions (for constraints)
48
- - Data flow (for understanding)
49
- - Use as additional context in Step 3 (Explore)
50
-
51
- **If file does not exist:**
52
- - `BEADS_MODE = false`
53
- - Proceed with normal workflow (no Beads integration)
54
-
55
- **Output:** Internal state set. No user-visible output for this step.
56
-
57
- ---
58
-
59
18
  ## Step 1: Analyze User Prompt
60
19
 
61
20
  **Parse user request to identify:**
@@ -339,38 +298,19 @@ Create the file automatically:
339
298
 
340
299
  - `docs/ai/planning/feature-{name}.md` - Use complete structure from `feature-template.md`
341
300
 
342
- **If BEADS_MODE = true:**
343
- - Add frontmatter with Beads metadata:
344
- ```yaml
345
- ---
346
- beads_task: {task_id}
347
- beads_epic: {epic_id}
348
- epic_plan: {epic_plan_path}
349
- ---
350
- ```
351
- - Update Beads task with plan doc reference:
352
- ```bash
353
- bd update {task_id} --notes "plan: docs/ai/planning/feature-{name}.md"
354
- ```
355
-
356
301
  **Notify user:** "Created plan with X phases: [Phase 1], [Phase 2], ..."
357
302
 
358
303
  ## Step 8: Next Actions
359
304
 
360
- **If BEADS_MODE = true:**
305
+ **Suggest next command:**
306
+
361
307
  ```
362
308
  ✓ Created plan: docs/ai/planning/feature-{name}.md
363
- ✓ Linked to Beads task: {task_id}
364
309
 
365
310
  Next steps:
366
- /execute-plan → Implement this task
367
- /beads-status → View epic progress
311
+ /execute-plan → Implement this feature
368
312
  ```
369
313
 
370
- **If normal mode:**
371
-
372
- Suggest: `/execute-plan` to begin implementation.
373
-
374
314
  Implementation will be driven from `docs/ai/planning/feature-{name}.md`.
375
315
 
376
316
  Note: Test documentation will be created separately using the `writing-test` command.
@@ -40,36 +40,6 @@ Expected speedup: 30-40% for context loading phase.
40
40
 
41
41
  ---
42
42
 
43
- ## Step 0: Check Beads Context (Optional Integration)
44
-
45
- > **Purpose**: Detect if this plan is for a Beads task. If so, track for final suggestions.
46
-
47
- **Read:** `.beads/current-task.json`
48
-
49
- **If file exists (Beads workflow active):**
50
-
51
- ```json
52
- {
53
- "task_id": "bd-auth.1",
54
- "task_title": "Setup JWT infrastructure",
55
- "epic_id": "bd-auth",
56
- "epic_title": "User Authentication System"
57
- }
58
- ```
59
-
60
- Set internal flags:
61
- - `BEADS_MODE = true`
62
- - `beads_task_id = task_id`
63
- - `beads_task_title = task_title`
64
-
65
- **If file does not exist:**
66
- - `BEADS_MODE = false`
67
- - Proceed with normal workflow (no Beads integration)
68
-
69
- **Output:** Internal state set. No user-visible output for this step.
70
-
71
- ---
72
-
73
43
  ## Step 1: Gather Context
74
44
 
75
45
  **Tools:**
@@ -254,31 +224,20 @@ Only run after ALL phases are marked complete. If incomplete phases remain, skip
254
224
 
255
225
  ## Step 6: Next Actions
256
226
 
257
- **If BEADS_MODE = true AND all phases complete:**
227
+ **If all phases complete:**
258
228
 
259
229
  ```
260
- ✓ All phases complete for Beads task: {beads_task_id} "{beads_task_title}"
230
+ ✓ All phases complete!
261
231
 
262
232
  Next steps:
263
- /beads-done → Close task, sync to git, see next ready tasks
264
- /beads-status → View epic progress
265
-
266
- Optional quality checks:
267
233
  /code-review → Verify against standards
268
234
  /writing-test → Add test coverage
269
235
  /check-implementation → Validate alignment with plan
270
236
  ```
271
237
 
272
- **If BEADS_MODE = false AND all phases complete:**
273
-
274
- - Suggest running `code-review` to verify against standards
275
- - Suggest running `writing-test` if edge cases need coverage
276
- - Suggest running `check-implementation` to validate alignment with planning entries
277
-
278
- **If phases remain (both modes):**
238
+ **If phases remain:**
279
239
 
280
240
  - User runs `/execute-plan` again; Phase detection (Step 1d) will resume correctly
281
- - **If BEADS_MODE = true:** Remind user task is still in_progress in Beads
282
241
 
283
242
  ## Notes
284
243