aiblueprint-cli 1.4.23 → 1.4.25

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.
Files changed (108) hide show
  1. package/claude-code-config/skills/git-commit/SKILL.md +42 -0
  2. package/claude-code-config/{commands/git/create-pr.md → skills/git-create-pr/SKILL.md} +12 -18
  3. package/claude-code-config/skills/git-fix-pr-comments/SKILL.md +51 -0
  4. package/claude-code-config/skills/git-merge/SKILL.md +68 -0
  5. package/claude-code-config/skills/{claude-memory → meta-claude-memory}/SKILL.md +7 -2
  6. package/claude-code-config/skills/meta-claude-memory/references/rules-directory-guide.md +298 -0
  7. package/claude-code-config/skills/meta-prompt-creator/SKILL.md +285 -0
  8. package/claude-code-config/skills/meta-prompt-creator/references/anthropic-best-practices.md +126 -0
  9. package/claude-code-config/skills/meta-prompt-creator/references/anti-patterns.md +57 -0
  10. package/claude-code-config/skills/meta-prompt-creator/references/clarity-principles.md +54 -0
  11. package/claude-code-config/skills/meta-prompt-creator/references/context-management.md +389 -0
  12. package/claude-code-config/skills/meta-prompt-creator/references/few-shot-patterns.md +47 -0
  13. package/claude-code-config/skills/meta-prompt-creator/references/openai-best-practices.md +50 -0
  14. package/claude-code-config/skills/meta-prompt-creator/references/prompt-templates.md +110 -0
  15. package/claude-code-config/skills/meta-prompt-creator/references/reasoning-techniques.md +52 -0
  16. package/claude-code-config/skills/meta-prompt-creator/references/system-prompt-patterns.md +48 -0
  17. package/claude-code-config/skills/meta-prompt-creator/references/xml-structure.md +36 -0
  18. package/claude-code-config/skills/meta-skill-creator/LICENSE.txt +202 -0
  19. package/claude-code-config/skills/meta-skill-creator/SKILL.md +421 -0
  20. package/claude-code-config/skills/meta-skill-creator/package.json +5 -0
  21. package/claude-code-config/skills/meta-skill-creator/references/output-patterns.md +82 -0
  22. package/claude-code-config/skills/meta-skill-creator/references/progressive-disclosure-patterns.md +374 -0
  23. package/claude-code-config/skills/meta-skill-creator/references/prompting-integration.md +363 -0
  24. package/claude-code-config/skills/meta-skill-creator/references/real-world-examples.md +513 -0
  25. package/claude-code-config/skills/meta-skill-creator/references/script-patterns.md +385 -0
  26. package/claude-code-config/skills/meta-skill-creator/references/workflows.md +28 -0
  27. package/claude-code-config/skills/meta-skill-creator/references/xml-tag-guide.md +606 -0
  28. package/claude-code-config/skills/meta-skill-creator/scripts/init-skill.ts +214 -0
  29. package/claude-code-config/skills/meta-skill-creator/scripts/package-skill.ts +146 -0
  30. package/claude-code-config/skills/meta-skill-creator/scripts/validate.ts +138 -0
  31. package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/SKILL.md +41 -15
  32. package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-00-init.md +2 -3
  33. package/claude-code-config/skills/utils-fix-errors/SKILL.md +61 -0
  34. package/claude-code-config/skills/utils-fix-grammar/SKILL.md +59 -0
  35. package/claude-code-config/skills/utils-oneshot/SKILL.md +56 -0
  36. package/claude-code-config/skills/workflow-apex/SKILL.md +303 -0
  37. package/claude-code-config/skills/workflow-apex/scripts/setup-templates.sh +134 -0
  38. package/claude-code-config/skills/workflow-apex/scripts/update-progress.sh +80 -0
  39. package/claude-code-config/skills/workflow-apex/steps/step-00-init.md +288 -0
  40. package/claude-code-config/skills/workflow-apex/steps/step-00b-branch.md +126 -0
  41. package/claude-code-config/skills/workflow-apex/steps/step-00b-economy.md +244 -0
  42. package/claude-code-config/skills/workflow-apex/steps/step-00b-interactive.md +153 -0
  43. package/claude-code-config/skills/workflow-apex/steps/step-01-analyze.md +361 -0
  44. package/claude-code-config/skills/workflow-apex/steps/step-02-plan.md +264 -0
  45. package/claude-code-config/skills/workflow-apex/steps/step-03-execute.md +239 -0
  46. package/claude-code-config/skills/workflow-apex/steps/step-04-validate.md +264 -0
  47. package/claude-code-config/skills/workflow-apex/steps/step-05-examine.md +294 -0
  48. package/claude-code-config/skills/workflow-apex/steps/step-06-resolve.md +237 -0
  49. package/claude-code-config/skills/workflow-apex/steps/step-07-tests.md +250 -0
  50. package/claude-code-config/skills/workflow-apex/steps/step-08-run-tests.md +308 -0
  51. package/claude-code-config/skills/workflow-apex/steps/step-09-finish.md +193 -0
  52. package/claude-code-config/skills/workflow-apex/templates/00-context.md +51 -0
  53. package/claude-code-config/skills/workflow-apex/templates/01-analyze.md +10 -0
  54. package/claude-code-config/skills/workflow-apex/templates/02-plan.md +10 -0
  55. package/claude-code-config/skills/workflow-apex/templates/03-execute.md +10 -0
  56. package/claude-code-config/skills/workflow-apex/templates/04-validate.md +10 -0
  57. package/claude-code-config/skills/workflow-apex/templates/05-examine.md +10 -0
  58. package/claude-code-config/skills/workflow-apex/templates/06-resolve.md +10 -0
  59. package/claude-code-config/skills/workflow-apex/templates/07-tests.md +10 -0
  60. package/claude-code-config/skills/workflow-apex/templates/08-run-tests.md +10 -0
  61. package/claude-code-config/skills/workflow-apex/templates/09-finish.md +10 -0
  62. package/claude-code-config/skills/workflow-apex/templates/README.md +195 -0
  63. package/claude-code-config/skills/workflow-apex/templates/step-complete.md +7 -0
  64. package/claude-code-config/skills/workflow-apex-free/SKILL.md +261 -0
  65. package/claude-code-config/skills/workflow-apex-free/scripts/setup-templates.sh +100 -0
  66. package/claude-code-config/skills/workflow-apex-free/scripts/update-progress.sh +80 -0
  67. package/claude-code-config/skills/workflow-apex-free/steps/step-00-init.md +267 -0
  68. package/claude-code-config/skills/workflow-apex-free/steps/step-00b-branch.md +126 -0
  69. package/claude-code-config/skills/workflow-apex-free/steps/step-00b-economy.md +244 -0
  70. package/claude-code-config/skills/workflow-apex-free/steps/step-00b-interactive.md +153 -0
  71. package/claude-code-config/skills/workflow-apex-free/steps/step-01-analyze.md +361 -0
  72. package/claude-code-config/skills/workflow-apex-free/steps/step-02-plan.md +264 -0
  73. package/claude-code-config/skills/workflow-apex-free/steps/step-03-execute.md +239 -0
  74. package/claude-code-config/skills/workflow-apex-free/steps/step-04-validate.md +251 -0
  75. package/claude-code-config/skills/workflow-apex-free/templates/00-context.md +43 -0
  76. package/claude-code-config/skills/workflow-apex-free/templates/01-analyze.md +10 -0
  77. package/claude-code-config/skills/workflow-apex-free/templates/02-plan.md +10 -0
  78. package/claude-code-config/skills/workflow-apex-free/templates/03-execute.md +10 -0
  79. package/claude-code-config/skills/workflow-apex-free/templates/04-validate.md +10 -0
  80. package/claude-code-config/skills/workflow-apex-free/templates/README.md +176 -0
  81. package/claude-code-config/skills/workflow-apex-free/templates/step-complete.md +7 -0
  82. package/dist/cli.js +146 -9
  83. package/package.json +1 -1
  84. package/claude-code-config/commands/explore.md +0 -90
  85. package/claude-code-config/commands/git/commit.md +0 -60
  86. package/claude-code-config/commands/git/fix-pr-comments.md +0 -59
  87. package/claude-code-config/commands/oneshot.md +0 -57
  88. package/claude-code-config/skills/create-slash-commands/SKILL.md +0 -1110
  89. package/claude-code-config/skills/create-slash-commands/references/arguments.md +0 -273
  90. package/claude-code-config/skills/create-slash-commands/references/patterns.md +0 -947
  91. package/claude-code-config/skills/create-slash-commands/references/prompt-examples.md +0 -656
  92. package/claude-code-config/skills/create-slash-commands/references/tool-restrictions.md +0 -389
  93. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/comprehensive-example.md +0 -0
  94. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/project-patterns.md +0 -0
  95. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/prompting-techniques.md +0 -0
  96. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/section-templates.md +0 -0
  97. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/context-management.md +0 -0
  98. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/debugging-agents.md +0 -0
  99. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/error-handling-and-recovery.md +0 -0
  100. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/evaluation-and-testing.md +0 -0
  101. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/orchestration-patterns.md +0 -0
  102. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/subagents.md +0 -0
  103. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/writing-subagent-prompts.md +0 -0
  104. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/SKILL.md +0 -0
  105. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/scripts/setup.sh +0 -0
  106. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-01-interactive-prd.md +0 -0
  107. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-02-create-stories.md +0 -0
  108. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-03-finish.md +0 -0
@@ -0,0 +1,195 @@
1
+ # APEX Template System
2
+
3
+ ## Overview
4
+
5
+ This directory contains template files used to initialize APEX workflow outputs when save mode (`-s`) is enabled. This template system significantly reduces token usage by moving repetitive content out of step files.
6
+
7
+ ## Template Files
8
+
9
+ | Template | Purpose | Created When |
10
+ |----------|---------|--------------|
11
+ | `00-context.md` | Workflow configuration and progress tracking | Always (if save_mode) |
12
+ | `01-analyze.md` | Analysis findings | Always (if save_mode) |
13
+ | `02-plan.md` | Implementation plan | Always (if save_mode) |
14
+ | `03-execute.md` | Implementation log | Always (if save_mode) |
15
+ | `04-validate.md` | Validation results | Always (if save_mode) |
16
+ | `05-examine.md` | Adversarial review findings | Only if examine_mode enabled |
17
+ | `06-resolve.md` | Finding resolution log | Only if examine_mode enabled |
18
+ | `07-tests.md` | Test analysis and creation | Only if test_mode enabled |
19
+ | `08-run-tests.md` | Test runner log | Only if test_mode enabled |
20
+ | `09-finish.md` | PR creation log | Only if pr_mode enabled |
21
+ | `step-complete.md` | Completion marker template | Referenced in steps |
22
+
23
+ ## Template Variables
24
+
25
+ Templates use `{{variable}}` syntax for placeholders:
26
+
27
+ | Variable | Description | Example |
28
+ |----------|-------------|---------|
29
+ | `{{task_id}}` | Kebab-case task identifier | `01-add-auth-middleware` |
30
+ | `{{task_description}}` | Plain text task description | `add authentication middleware` |
31
+ | `{{timestamp}}` | ISO 8601 timestamp | `2026-01-12T10:30:00Z` |
32
+ | `{{auto_mode}}` | Auto mode flag | `true` or `false` |
33
+ | `{{examine_mode}}` | Examine mode flag | `true` or `false` |
34
+ | `{{save_mode}}` | Save mode flag | `true` or `false` |
35
+ | `{{test_mode}}` | Test mode flag | `true` or `false` |
36
+ | `{{economy_mode}}` | Economy mode flag | `true` or `false` |
37
+ | `{{branch_mode}}` | Branch mode flag | `true` or `false` |
38
+ | `{{pr_mode}}` | PR mode flag | `true` or `false` |
39
+ | `{{interactive_mode}}` | Interactive mode flag | `true` or `false` |
40
+ | `{{branch_name}}` | Git branch name | `feature/add-auth` |
41
+ | `{{original_input}}` | Raw user input | `/apex -a -s add auth` |
42
+ | `{{examine_status}}` | Progress status for examine steps | `⏸ Pending` or `⏭ Skip` |
43
+ | `{{test_status}}` | Progress status for test steps | `⏸ Pending` or `⏭ Skip` |
44
+ | `{{pr_status}}` | Progress status for PR step | `⏸ Pending` or `⏭ Skip` |
45
+
46
+ ## Setup Script
47
+
48
+ ### `setup-templates.sh`
49
+
50
+ Initializes all template files in the output directory with variables replaced.
51
+
52
+ **Usage:**
53
+ ```bash
54
+ bash scripts/setup-templates.sh \
55
+ "task_id" \
56
+ "task_description" \
57
+ "auto_mode" \
58
+ "examine_mode" \
59
+ "save_mode" \
60
+ "test_mode" \
61
+ "economy_mode" \
62
+ "branch_mode" \
63
+ "pr_mode" \
64
+ "interactive_mode" \
65
+ "branch_name" \
66
+ "original_input"
67
+ ```
68
+
69
+ **Output:**
70
+ ```
71
+ .claude/output/apex/01-add-auth-middleware/
72
+ ├── 00-context.md # Always created
73
+ ├── 01-analyze.md # Always created
74
+ ├── 02-plan.md # Always created
75
+ ├── 03-execute.md # Always created
76
+ ├── 04-validate.md # Always created
77
+ ├── 05-examine.md # Only if examine_mode
78
+ ├── 06-resolve.md # Only if examine_mode
79
+ ├── 07-tests.md # Only if test_mode
80
+ ├── 08-run-tests.md # Only if test_mode
81
+ └── 09-finish.md # Only if pr_mode
82
+ ```
83
+
84
+ ## Progress Update Script
85
+
86
+ ### `update-progress.sh`
87
+
88
+ Updates the progress table in `00-context.md` without manual markdown editing.
89
+
90
+ **Usage:**
91
+ ```bash
92
+ bash scripts/update-progress.sh <task_id> <step_number> <step_name> <status>
93
+ ```
94
+
95
+ **Examples:**
96
+ ```bash
97
+ # Mark step 01 as in progress
98
+ bash scripts/update-progress.sh "01-add-auth" "01" "analyze" "in_progress"
99
+
100
+ # Mark step 01 as complete
101
+ bash scripts/update-progress.sh "01-add-auth" "01" "analyze" "complete"
102
+
103
+ # Mark step 02 as in progress
104
+ bash scripts/update-progress.sh "01-add-auth" "02" "plan" "in_progress"
105
+ ```
106
+
107
+ **Status Values:**
108
+ - `in_progress` → `⏳ In Progress`
109
+ - `complete` → `✓ Complete`
110
+
111
+ ## Token Savings
112
+
113
+ ### Before Optimization
114
+
115
+ Each step file contained full template content inline:
116
+
117
+ ```markdown
118
+ ### 1. Initialize Save Output (if save_mode)
119
+
120
+ **If `{save_mode}` = true:**
121
+
122
+ Create `{output_dir}/01-analyze.md`:
123
+ ```markdown
124
+ # Step 01: Analyze
125
+
126
+ **Task:** {task_description}
127
+ **Started:** {ISO timestamp}
128
+
129
+ ---
130
+
131
+ ## Context Discovery
132
+ ```
133
+
134
+ Update `00-context.md` progress:
135
+ ```markdown
136
+ | 01-analyze | ⏳ In Progress | {timestamp} |
137
+ ```
138
+ ```
139
+
140
+ **Token cost per step:** ~200 tokens × 9 steps = ~1,800 tokens
141
+
142
+ ### After Optimization
143
+
144
+ Step files now reference templates and scripts:
145
+
146
+ ```markdown
147
+ ### 1. Initialize Save Output (if save_mode)
148
+
149
+ **If `{save_mode}` = true:**
150
+
151
+ The file `{output_dir}/01-analyze.md` has already been created by the setup script.
152
+
153
+ Update progress:
154
+ ```bash
155
+ bash {skill_dir}/scripts/update-progress.sh "{task_id}" "01" "analyze" "in_progress"
156
+ ```
157
+
158
+ Append your findings to `01-analyze.md` as you work.
159
+ ```
160
+
161
+ **Token cost per step:** ~50 tokens × 9 steps = ~450 tokens
162
+
163
+ **Total savings:** ~1,350 tokens per workflow execution (75% reduction)
164
+
165
+ ## How It Works
166
+
167
+ 1. **Initialization (step-00-init.md):**
168
+ - Runs `setup-templates.sh` once at workflow start
169
+ - Creates all template files with variables replaced
170
+ - Output directory is ready with pre-initialized files
171
+
172
+ 2. **Each Step:**
173
+ - Runs `update-progress.sh` to mark step as "in_progress"
174
+ - Appends findings/logs to the pre-created step file
175
+ - Runs `update-progress.sh` again to mark step as "complete"
176
+
177
+ 3. **Benefits:**
178
+ - AI doesn't need to hold template content in context
179
+ - Consistent formatting across all workflows
180
+ - Easy to update templates without editing step files
181
+ - Scripts handle the tedious markdown updates
182
+
183
+ ## Updating Templates
184
+
185
+ To modify template content:
186
+
187
+ 1. Edit the template file in `templates/`
188
+ 2. Changes apply to all future workflows automatically
189
+ 3. No need to update step files
190
+
191
+ ## Maintenance
192
+
193
+ - Templates are stateless (no workflow-specific logic)
194
+ - Scripts are idempotent (safe to run multiple times)
195
+ - Variables use `{{var}}` syntax to avoid conflicts with markdown
@@ -0,0 +1,7 @@
1
+ ---
2
+
3
+ ## Step Complete
4
+
5
+ **Status:** ✓ Complete
6
+ **Next:** {{next_step}}
7
+ **Timestamp:** {{timestamp}}
@@ -0,0 +1,261 @@
1
+ ---
2
+ name: apex
3
+ description: Systematic implementation using APEX methodology (Analyze-Plan-Execute-Validate) with parallel agents and self-validation. Use when implementing features, fixing bugs, or making code changes that benefit from structured workflow.
4
+ argument-hint: "[-a] [-s] [-e] [-b] [-i] [-r <task-id>] <task description>"
5
+ ---
6
+
7
+ <objective>
8
+ Execute systematic implementation workflows using the APEX methodology. This skill uses progressive step loading to minimize context usage and supports saving outputs for review and resumption.
9
+ </objective>
10
+
11
+ <quick_start>
12
+ **Basic usage:**
13
+
14
+ ```bash
15
+ /apex add authentication middleware
16
+ ```
17
+
18
+ **Recommended workflow (autonomous with save):**
19
+
20
+ ```bash
21
+ /apex -a -s implement user registration
22
+ ```
23
+
24
+ **Flags:**
25
+
26
+ - `-a` (auto): Skip confirmations
27
+ - `-s` (save): Save outputs to `.claude/output/apex/`
28
+ - `-e` (economy): No subagents, save tokens
29
+
30
+ See `<parameters>` for complete flag list.
31
+ </quick_start>
32
+
33
+ <parameters>
34
+
35
+ <flags>
36
+ **Enable flags (turn ON):**
37
+ | Short | Long | Description |
38
+ |-------|------|-------------|
39
+ | `-a` | `--auto` | Autonomous mode: skip confirmations, auto-approve plans |
40
+ | `-s` | `--save` | Save mode: output each step to `.claude/output/apex/` |
41
+ | `-e` | `--economy` | Economy mode: no subagents, save tokens (for limited plans) |
42
+ | `-r` | `--resume` | Resume mode: continue from a previous task |
43
+ | `-b` | `--branch` | Branch mode: verify not on main, create branch if needed |
44
+ | `-i` | `--interactive` | Interactive mode: configure flags via AskUserQuestion |
45
+
46
+ **Disable flags (turn OFF):**
47
+ | Short | Long | Description |
48
+ |-------|------|-------------|
49
+ | `-A` | `--no-auto` | Disable auto mode |
50
+ | `-S` | `--no-save` | Disable save mode |
51
+ | `-E` | `--no-economy` | Disable economy mode |
52
+ | `-B` | `--no-branch` | Disable branch mode |
53
+ </flags>
54
+
55
+ <examples>
56
+ ```bash
57
+ # Basic
58
+ /apex add auth middleware
59
+
60
+ # Autonomous (skip confirmations)
61
+ /apex -a add auth middleware
62
+
63
+ # Save outputs
64
+ /apex -a -s add auth middleware
65
+
66
+ # Resume previous task
67
+ /apex -r 01-auth-middleware
68
+ /apex -r 01 # Partial match
69
+
70
+ # Economy mode (save tokens)
71
+ /apex -e add auth middleware
72
+
73
+ # Interactive flag config
74
+ /apex -i add auth middleware
75
+
76
+ # Disable flags (uppercase)
77
+ /apex -A add auth middleware # Disable auto
78
+ ```
79
+ </examples>
80
+
81
+ <parsing_rules>
82
+ **Flag parsing:**
83
+
84
+ 1. Defaults loaded from `steps/step-00-init.md` `<defaults>` section
85
+ 2. Command-line flags override defaults (enable with lowercase `-x`, disable with uppercase `-X`)
86
+ 3. Flags removed from input, remainder becomes `{task_description}`
87
+ 4. Task ID generated as `NN-kebab-case-description`
88
+
89
+ For detailed parsing algorithm, see `steps/step-00-init.md`.
90
+ </parsing_rules>
91
+
92
+ </parameters>
93
+
94
+ <output_structure>
95
+ **When `{save_mode}` = true:**
96
+
97
+ All outputs saved to PROJECT directory (where Claude Code is running):
98
+ ```
99
+ .claude/output/apex/{task-id}/
100
+ ├── 00-context.md # Params, user request, timestamp
101
+ ├── 01-analyze.md # Analysis findings
102
+ ├── 02-plan.md # Implementation plan
103
+ ├── 03-execute.md # Execution log
104
+ └── 04-validate.md # Validation results
105
+ ```
106
+
107
+ **00-context.md structure:**
108
+ ```markdown
109
+ # APEX Task: {task_id}
110
+
111
+ **Created:** {timestamp}
112
+ **Task:** {task_description}
113
+
114
+ ## Flags
115
+ - Auto mode: {auto_mode}
116
+ - Save mode: {save_mode}
117
+ - Economy mode: {economy_mode}
118
+
119
+ ## User Request
120
+ {original user input}
121
+
122
+ ## Acceptance Criteria
123
+ - [ ] AC1: {inferred criterion}
124
+ - [ ] AC2: {inferred criterion}
125
+ ```
126
+
127
+ </output_structure>
128
+
129
+ <resume_workflow>
130
+ **Resume mode (`-r {task-id}`):**
131
+
132
+ When provided, step-00 will:
133
+
134
+ 1. Locate the task folder in `.claude/output/apex/`
135
+ 2. Restore state from `00-context.md`
136
+ 3. Find the last completed step
137
+ 4. Continue from the next step
138
+
139
+ Supports partial matching (e.g., `-r 01` finds `01-add-auth-middleware`).
140
+
141
+ For implementation details, see `steps/step-00-init.md`.
142
+ </resume_workflow>
143
+
144
+ <workflow>
145
+ **Standard flow:**
146
+ 1. Parse flags and task description
147
+ 2. If `-r`: Execute resume workflow
148
+ 3. If `-s`: Create output folder and 00-context.md
149
+ 4. Load step-01-analyze.md → gather context
150
+ 5. Load step-02-plan.md → create strategy
151
+ 6. Load step-03-execute.md → implement
152
+ 7. Load step-04-validate.md → verify and complete
153
+ </workflow>
154
+
155
+ <state_variables>
156
+ **Persist throughout all steps:**
157
+
158
+ | Variable | Type | Description |
159
+ | ----------------------- | ------- | ------------------------------------------------------ |
160
+ | `{task_description}` | string | What to implement (flags removed) |
161
+ | `{feature_name}` | string | Kebab-case name without number (e.g., `add-auth-middleware`) |
162
+ | `{task_id}` | string | Full identifier with number (e.g., `01-add-auth-middleware`) |
163
+ | `{acceptance_criteria}` | list | Success criteria (inferred or explicit) |
164
+ | `{auto_mode}` | boolean | Skip confirmations, use recommended options |
165
+ | `{save_mode}` | boolean | Save outputs to .claude/output/apex/ |
166
+ | `{economy_mode}` | boolean | No subagents, direct tool usage only |
167
+ | `{branch_mode}` | boolean | Verify not on main, create branch if needed |
168
+ | `{interactive_mode}` | boolean | Configure flags interactively |
169
+ | `{resume_task}` | string | Task ID to resume (if -r provided) |
170
+ | `{output_dir}` | string | Full path to output directory |
171
+ | `{branch_name}` | string | Created branch name (if branch_mode) |
172
+
173
+ </state_variables>
174
+
175
+ <entry_point>
176
+
177
+ **FIRST ACTION:** Load `steps/step-00-init.md`
178
+
179
+ Step 00 handles:
180
+
181
+ - Flag parsing (-a, -x, -s, -r, --test)
182
+ - Resume mode detection and task lookup
183
+ - Output folder creation (if save_mode)
184
+ - 00-context.md creation (if save_mode)
185
+ - State variable initialization
186
+
187
+ After initialization, step-00 loads step-01-analyze.md.
188
+
189
+ </entry_point>
190
+
191
+ <step_files>
192
+ **Progressive loading - only load current step:**
193
+
194
+ | Step | File | Purpose |
195
+ | ---- | ---------------------------- | ---------------------------------------------------- |
196
+ | 00 | `steps/step-00-init.md` | Parse flags, create output folder, initialize state |
197
+ | 01 | `steps/step-01-analyze.md` | Smart context gathering with 1-10 parallel agents based on complexity |
198
+ | 02 | `steps/step-02-plan.md` | File-by-file implementation strategy |
199
+ | 03 | `steps/step-03-execute.md` | Todo-driven implementation |
200
+ | 04 | `steps/step-04-validate.md` | Self-check, validation, and workflow completion |
201
+
202
+ </step_files>
203
+
204
+ <execution_rules>
205
+
206
+ - **Load one step at a time** - Only load the current step file
207
+ - **ULTRA THINK** before major decisions
208
+ - **Persist state variables** across all steps
209
+ - **Follow next_step directive** at end of each step
210
+ - **Save outputs** if `{save_mode}` = true (append to step file)
211
+ - **Use parallel agents** for independent exploration tasks
212
+
213
+ ## 🧠 Smart Agent Strategy in Analyze Phase
214
+
215
+ The analyze phase (step-01) uses **adaptive agent launching** (unless economy_mode):
216
+
217
+ **Available agents:**
218
+ - `explore-codebase` - Find existing patterns, files, utilities
219
+ - `explore-docs` - Research library docs (use when unfamiliar with API)
220
+ - `websearch` - Find approaches, best practices, gotchas
221
+
222
+ **Launch 1-10 agents based on task complexity:**
223
+
224
+ | Complexity | Agents | When |
225
+ |------------|--------|------|
226
+ | Simple | 1-2 | Bug fix, small tweak |
227
+ | Medium | 2-4 | New feature in familiar stack |
228
+ | Complex | 4-7 | Unfamiliar libraries, integrations |
229
+ | Major | 6-10 | Multiple systems, many unknowns |
230
+
231
+ **BE SMART:** Analyze what you actually need before launching. Don't over-launch for simple tasks, don't under-launch for complex ones.
232
+
233
+ </execution_rules>
234
+
235
+ <save_output_pattern>
236
+ **When `{save_mode}` = true:**
237
+
238
+ Step-00 runs `scripts/setup-templates.sh` to initialize all output files from `templates/` directory.
239
+
240
+ **Each step then:**
241
+
242
+ 1. Run `scripts/update-progress.sh {task_id} {step_num} {step_name} "in_progress"`
243
+ 2. Append findings/outputs to the pre-created step file
244
+ 3. Run `scripts/update-progress.sh {task_id} {step_num} {step_name} "complete"`
245
+
246
+ **Template system benefits:**
247
+
248
+ - Reduces token usage by ~75% (1,350 tokens saved per workflow)
249
+ - Templates in `templates/` directory (not inline in steps)
250
+ - Scripts handle progress tracking automatically
251
+ - See `templates/README.md` for details
252
+
253
+ </save_output_pattern>
254
+
255
+ <success_criteria>
256
+
257
+ - Each step loaded progressively
258
+ - All validation checks passing
259
+ - Outputs saved if `{save_mode}` enabled
260
+ - Clear completion summary provided
261
+ </success_criteria>
@@ -0,0 +1,100 @@
1
+ #!/bin/bash
2
+ # APEX Template Setup Script
3
+ # Creates output directory structure and initializes template files
4
+ #
5
+ # Usage: setup-templates.sh "feature-name" [other args...]
6
+ # The script auto-generates the task ID with the next available number.
7
+
8
+ set -e
9
+
10
+ # Arguments - first arg is now just the feature name (kebab-case)
11
+ FEATURE_NAME="$1"
12
+ TASK_DESCRIPTION="$2"
13
+ AUTO_MODE="${3:-false}"
14
+ SAVE_MODE="${4:-false}"
15
+ ECONOMY_MODE="${5:-false}"
16
+ BRANCH_MODE="${6:-false}"
17
+ INTERACTIVE_MODE="${7:-false}"
18
+ BRANCH_NAME="${8:-}"
19
+ ORIGINAL_INPUT="${9:-}"
20
+
21
+ # Validate required arguments
22
+ if [[ -z "$FEATURE_NAME" ]]; then
23
+ echo "Error: FEATURE_NAME is required"
24
+ exit 1
25
+ fi
26
+
27
+ if [[ -z "$TASK_DESCRIPTION" ]]; then
28
+ echo "Error: TASK_DESCRIPTION is required"
29
+ exit 1
30
+ fi
31
+
32
+ # Get current timestamp
33
+ TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
34
+
35
+ # Use current working directory as project root
36
+ PROJECT_ROOT=$(pwd)
37
+ APEX_OUTPUT_DIR="${PROJECT_ROOT}/.claude/output/apex"
38
+
39
+ # Create apex output directory if it doesn't exist
40
+ mkdir -p "$APEX_OUTPUT_DIR"
41
+
42
+ # Find the next available number
43
+ NEXT_NUM=1
44
+ if [[ -d "$APEX_OUTPUT_DIR" ]]; then
45
+ # Find highest existing number prefix
46
+ HIGHEST=$(ls -1 "$APEX_OUTPUT_DIR" 2>/dev/null | grep -oE '^[0-9]+' | sort -n | tail -1)
47
+ if [[ -n "$HIGHEST" ]]; then
48
+ # Force base-10 interpretation (leading zeros would be treated as octal)
49
+ NEXT_NUM=$((10#$HIGHEST + 1))
50
+ fi
51
+ fi
52
+
53
+ # Format with leading zeros (2 digits)
54
+ TASK_NUM=$(printf "%02d" "$NEXT_NUM")
55
+
56
+ # Build full task ID
57
+ TASK_ID="${TASK_NUM}-${FEATURE_NAME}"
58
+
59
+ OUTPUT_DIR="${APEX_OUTPUT_DIR}/${TASK_ID}"
60
+
61
+ # Get skill directory
62
+ SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
63
+ TEMPLATE_DIR="${SKILL_DIR}/templates"
64
+
65
+ # Create output directory
66
+ mkdir -p "$OUTPUT_DIR"
67
+
68
+ # Function to replace template variables
69
+ render_template() {
70
+ local template_file="$1"
71
+ local output_file="$2"
72
+
73
+ # Read template and replace variables
74
+ sed -e "s|{{task_id}}|${TASK_ID}|g" \
75
+ -e "s|{{task_description}}|${TASK_DESCRIPTION}|g" \
76
+ -e "s|{{timestamp}}|${TIMESTAMP}|g" \
77
+ -e "s|{{auto_mode}}|${AUTO_MODE}|g" \
78
+ -e "s|{{save_mode}}|${SAVE_MODE}|g" \
79
+ -e "s|{{economy_mode}}|${ECONOMY_MODE}|g" \
80
+ -e "s|{{branch_mode}}|${BRANCH_MODE}|g" \
81
+ -e "s|{{interactive_mode}}|${INTERACTIVE_MODE}|g" \
82
+ -e "s|{{branch_name}}|${BRANCH_NAME}|g" \
83
+ -e "s|{{original_input}}|${ORIGINAL_INPUT}|g" \
84
+ "$template_file" > "$output_file"
85
+ }
86
+
87
+ # Initialize 00-context.md
88
+ render_template "${TEMPLATE_DIR}/00-context.md" "${OUTPUT_DIR}/00-context.md"
89
+
90
+ # Initialize other step files (only headers, content appended during execution)
91
+ render_template "${TEMPLATE_DIR}/01-analyze.md" "${OUTPUT_DIR}/01-analyze.md"
92
+ render_template "${TEMPLATE_DIR}/02-plan.md" "${OUTPUT_DIR}/02-plan.md"
93
+ render_template "${TEMPLATE_DIR}/03-execute.md" "${OUTPUT_DIR}/03-execute.md"
94
+ render_template "${TEMPLATE_DIR}/04-validate.md" "${OUTPUT_DIR}/04-validate.md"
95
+
96
+ # Output the generated task_id for capture by caller
97
+ echo "TASK_ID=${TASK_ID}"
98
+ echo "OUTPUT_DIR=${OUTPUT_DIR}"
99
+ echo "✓ APEX templates initialized: ${OUTPUT_DIR}"
100
+ exit 0
@@ -0,0 +1,80 @@
1
+ #!/bin/bash
2
+ # APEX Progress Update Script
3
+ # Updates 00-context.md progress table
4
+
5
+ set -e
6
+
7
+ # Arguments
8
+ TASK_ID="$1"
9
+ STEP_NUMBER="$2"
10
+ STEP_NAME="$3"
11
+ STATUS="$4" # "in_progress" or "complete"
12
+
13
+ # Validate required arguments
14
+ if [[ -z "$TASK_ID" ]] || [[ -z "$STEP_NUMBER" ]] || [[ -z "$STEP_NAME" ]] || [[ -z "$STATUS" ]]; then
15
+ echo "Usage: $0 <task_id> <step_number> <step_name> <status>"
16
+ echo "Example: $0 01-add-auth 01 analyze complete"
17
+ exit 1
18
+ fi
19
+
20
+ # Find project root
21
+ PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
22
+ CONTEXT_FILE="${PROJECT_ROOT}/.claude/output/apex/${TASK_ID}/00-context.md"
23
+
24
+ # Validate context file exists
25
+ if [[ ! -f "$CONTEXT_FILE" ]]; then
26
+ echo "Error: Context file not found: $CONTEXT_FILE"
27
+ exit 1
28
+ fi
29
+
30
+ # Get timestamp
31
+ TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
32
+
33
+ # Determine status symbol
34
+ if [[ "$STATUS" == "in_progress" ]]; then
35
+ STATUS_SYMBOL="⏳ In Progress"
36
+ elif [[ "$STATUS" == "complete" ]]; then
37
+ STATUS_SYMBOL="✓ Complete"
38
+ else
39
+ echo "Error: Invalid status. Use 'in_progress' or 'complete'"
40
+ exit 1
41
+ fi
42
+
43
+ # Create temp file
44
+ TEMP_FILE=$(mktemp)
45
+
46
+ # Update the progress table
47
+ awk -v step="${STEP_NUMBER}-${STEP_NAME}" \
48
+ -v status="$STATUS_SYMBOL" \
49
+ -v timestamp="$TIMESTAMP" '
50
+ BEGIN { in_table = 0; found = 0 }
51
+ {
52
+ # Detect progress table start
53
+ if ($0 ~ /^## Progress/) {
54
+ in_table = 1
55
+ print $0
56
+ next
57
+ }
58
+
59
+ # If in table and found the matching step
60
+ if (in_table && $0 ~ "\\| " step " \\|") {
61
+ printf "| %s | %s | %s |\n", step, status, timestamp
62
+ found = 1
63
+ next
64
+ }
65
+
66
+ # Print line as-is
67
+ print $0
68
+ }
69
+ END {
70
+ if (!found) {
71
+ print "Warning: Step not found in progress table" > "/dev/stderr"
72
+ }
73
+ }
74
+ ' "$CONTEXT_FILE" > "$TEMP_FILE"
75
+
76
+ # Replace original file
77
+ mv "$TEMP_FILE" "$CONTEXT_FILE"
78
+
79
+ echo "✓ Progress updated: ${STEP_NUMBER}-${STEP_NAME} → ${STATUS_SYMBOL}"
80
+ exit 0