Skip to content

Commit f531755

Browse files
rysweetUbuntuclaude
authored
refactor: Make skills import canonical sources instead of duplicating content (#1557)
* refactor: Make skills import canonical sources instead of duplicating content Eliminate content duplication by converting skills to thin wrappers that reference canonical sources. ## Changes - Refactor `.claude/skills/default-workflow/SKILL.md` (253→84 lines, 67% reduction) - Refactor `.claude/skills/ultrathink-orchestrator/SKILL.md` (197→88 lines, 55% reduction) - Remove `.claude/skills/default-workflow/reference/REVIEW_PHASES.md` (duplicated content) ## Benefits - Single source of truth for workflow and command definitions - No content duplication or drift between skills and canonical sources - Changes to canonical sources automatically inherited by skills - Clear separation: skills handle auto-activation, canonical sources define logic ## Implementation Skills now use Read tool to load canonical sources: - default-workflow → `.claude/workflow/DEFAULT_WORKFLOW.md` - ultrathink-orchestrator → `.claude/commands/amplihack/ultrathink.md` Fixes #1554 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix: Use relative paths instead of hardcoded absolute paths in skills Replace hardcoded absolute paths with project-relative paths to ensure skills work across different installations and clone locations. ## Changes - `.claude/skills/default-workflow/SKILL.md`: Use `.claude/workflow/DEFAULT_WORKFLOW.md` - `.claude/skills/ultrathink-orchestrator/SKILL.md`: Use `.claude/commands/amplihack/ultrathink.md` - Added note that Claude Code resolves relative paths automatically ## Addresses Review Feedback From PR review: Hardcoded paths would break for users who clone repo to different locations. Relative paths ensure portability. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Ubuntu <azureuser@amplihack2.yb0a3bvkdghunmsjr4s3fnfhra.phxx.internal.cloudapp.net> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 941a2ab commit f531755

File tree

3 files changed

+93
-459
lines changed

3 files changed

+93
-459
lines changed

.claude/skills/default-workflow/SKILL.md

Lines changed: 46 additions & 212 deletions
Original file line numberDiff line numberDiff line change
@@ -14,239 +14,73 @@ skip_confirmation_if_explicit: true
1414
token_budget: 4500
1515
---
1616

17-
# Default Coding Workflow
17+
# Default Workflow Skill
1818

19-
This skill defines the default workflow for all non-trivial code changes.
20-
You can customize this workflow by editing this file.
19+
## Purpose
2120

22-
## How This Workflow Works
21+
This skill provides the standard development workflow for all non-trivial code changes in amplihack. It auto-activates when detecting multi-file implementations, complex integrations, or significant refactoring work.
2322

24-
**This workflow is the single source of truth for:**
23+
The workflow defines the canonical execution process: from requirements clarification through design, implementation, testing, review, and merge. It ensures consistent quality by orchestrating specialized agents at each step and enforcing philosophy compliance throughout.
2524

26-
- The order of operations (steps must be followed sequentially)
27-
- Git workflow (branch, commit, push, PR process)
28-
- CI/CD integration points
29-
- Review and merge requirements
25+
This is a thin wrapper that references the complete workflow definition stored in a single canonical location, ensuring no duplication or drift between the skill interface and the workflow specification.
3026

31-
**Execution approach:**
27+
## Canonical Source
3228

33-
- Start with `/ultrathink` for any non-trivial task
34-
- UltraThink reads this workflow and orchestrates agents to execute it
35-
- Each step leverages specialized agents for maximum effectiveness
36-
- The workflow defines the process; agents execute the work
29+
**This skill is a thin wrapper that references the canonical workflow:**
3730

38-
## Default Execution with UltraThink
31+
**Source**: `.claude/workflow/DEFAULT_WORKFLOW.md` (471+ lines)
3932

40-
**For all non-trivial tasks, start with `/ultrathink` to orchestrate the workflow:**
33+
The canonical workflow contains the complete 15-step development process with all details, agent specifications, and execution guidance.
4134

42-
- `/ultrathink` reads this workflow and executes it with multi-agent coordination
43-
- Each step below leverages specialized agents whenever possible
44-
- UltraThink orchestrates parallel agent execution for maximum efficiency
45-
- When you customize this workflow, UltraThink adapts automatically
35+
## Execution Instructions
4636

47-
**TodoWrite Usage During Workflow Execution:**
37+
When this skill is activated, you MUST:
4838

49-
When creating todos during workflow execution, reference the workflow steps directly:
39+
1. **Read the canonical workflow** immediately:
5040

51-
- Format: `Step N: [Step Name] - [Specific Action]`
52-
- Example: `Step 1: Rewrite and Clarify Requirements - Use prompt-writer agent`
53-
- This helps users track exactly which workflow step is active (Step X of 15)
41+
```
42+
Read(file_path=".claude/workflow/DEFAULT_WORKFLOW.md")
43+
```
5444

55-
## When This Workflow Applies
45+
Note: Path is relative to project root. Claude Code resolves this automatically.
5646

57-
This workflow should be followed for:
47+
2. **Follow all 15 steps** exactly as specified in the canonical workflow
5848

59-
- New features
60-
- Bug fixes
61-
- Refactoring
62-
- Any non-trivial code changes
49+
3. **Use TodoWrite** to track progress through workflow steps with format:
50+
- `Step N: [Step Name] - [Specific Action]`
51+
- Example: `Step 1: Rewrite and Clarify Requirements - Use prompt-writer agent`
52+
- This helps users track exactly which workflow step is active (Step X of 15)
6353

64-
## TodoWrite Best Practices
54+
4. **Invoke specialized agents** as specified in each workflow step:
55+
- Step 1: prompt-writer, analyzer, ambiguity agents
56+
- Step 4: architect, api-designer, database, tester, security agents
57+
- Step 5: builder, integration agents
58+
- Step 6: cleanup, optimizer agents
59+
- Step 7: pre-commit-diagnostic agent
60+
- Step 9-15: Review and merge agents
6561

66-
When using TodoWrite during workflow execution:
62+
## Why This Pattern
6763

68-
- **Reference Step Numbers**: Include the workflow step number in todo content
69-
- Example: `Step 1: Rewrite and Clarify Requirements - Use prompt-writer agent`
70-
- Example: `Step 4: Research and Design - Use architect agent for solution design`
64+
**Benefits:**
7165

72-
- **Workstream Prefixes** (Optional): When running multiple workflows in parallel, prefix todos with workstream name
73-
- Format: `[WORKSTREAM] Step N: Description`
74-
- Example: `[PR1090 TASK] Step 1: Rewrite and Clarify Requirements`
75-
- Example: `[FEATURE-X] Step 4: Research and Design - Use architect agent`
76-
- This helps track which todos belong to which parallel workstream
66+
- Single source of truth for workflow definition
67+
- No content duplication or drift
68+
- Changes to workflow made once in canonical location
69+
- Clear delegation contract between skill and workflow
70+
- Reduced token usage (skill is ~60 lines vs 471+ in canonical source)
7771

78-
- **Be Specific**: Include the specific agent or action for each step
79-
- Example: `Step 5: Implement the Solution - Use builder agent from specifications`
72+
## Auto-Activation Triggers
8073

81-
- **Track Progress**: Users can see exactly which step is active (e.g., "Step 5 of 15")
74+
This skill auto-activates for:
8275

83-
**Example Todo Structure (Single Workflow):**
76+
- Features spanning multiple files (5+)
77+
- Complex integrations across components
78+
- Refactoring affecting 5+ files
79+
- Any non-trivial code changes requiring structured workflow
8480

85-
```
86-
Step 1: Rewrite and Clarify Requirements - Use prompt-writer agent to clarify task
87-
Step 2: Create GitHub Issue - Define requirements and constraints using gh issue create
88-
Step 3: Setup Worktree and Branch - Create feat/issue-XXX branch in worktrees/
89-
Step 4: Research and Design - Use architect agent for solution design
90-
Step 5: Implement the Solution - Use builder agent to implement from specifications
91-
...
92-
```
81+
## Related Files
9382

94-
**Example Todo Structure (Multiple Parallel Workflows):**
95-
96-
```
97-
[PR1090 TASK] Step 1: Rewrite and Clarify Requirements - Use prompt-writer agent
98-
[PR1090 TASK] Step 2: Create GitHub Issue - Define requirements using gh issue create
99-
[PR1090 TASK] Step 4: Research and Design - Use architect agent for solution design
100-
[FEATURE-X] Step 1: Rewrite and Clarify Requirements - Use prompt-writer agent
101-
[FEATURE-X] Step 3: Setup Worktree and Branch - Create feat/issue-XXX branch
102-
[BUGFIX-Y] Step 5: Implement the Solution - Use builder agent from specifications
103-
...
104-
```
105-
106-
This step-based structure helps users understand:
107-
108-
- Exactly which workflow step is currently active
109-
- How many steps remain (e.g., Step 5 of 15 means 10 steps left)
110-
- What comes next in the workflow
111-
112-
## The 15-Step Workflow (Part 1: Implementation)
113-
114-
This file contains **Steps 1-8** (Requirements through Testing). For the review and merge phases, see [reference/REVIEW_PHASES.md](reference/REVIEW_PHASES.md).
115-
116-
### Step 1: Rewrite and Clarify Requirements
117-
118-
- [ ] **FIRST: Identify explicit user requirements** that CANNOT be optimized away
119-
- [ ] **Always use** prompt-writer agent to clarify task requirements
120-
- [ ] **Use** analyzer agent to understand existing codebase context
121-
- [ ] **Use** ambiguity agent if requirements are unclear
122-
- [ ] Remove ambiguity from the task description
123-
- [ ] Define clear success criteria
124-
- [ ] Document acceptance criteria
125-
- [ ] **CRITICAL: Pass explicit requirements to ALL subsequent agents**
126-
127-
### Step 2: Create GitHub Issue
128-
129-
- [ ] **Use** GitHub issue creation tool via agent
130-
- [ ] Create issue using `gh issue create`
131-
- [ ] Include clear problem description
132-
- [ ] Define requirements and constraints
133-
- [ ] Add success criteria
134-
- [ ] Assign appropriate labels
135-
136-
### Step 3: Setup Worktree and Branch
137-
138-
- [ ] **Always use** worktree-manager agent for worktree operations
139-
- [ ] Create new git worktree in `./worktrees/{branch-name}` for isolated development
140-
- [ ] Create branch with format: `feat/issue-{number}-{brief-description}`
141-
- [ ] Command: `git worktree add ./worktrees/{branch-name} -b {branch-name}`
142-
- [ ] Push branch to remote with tracking: `git push -u origin {branch-name}`
143-
- [ ] Switch to new worktree directory: `cd ./worktrees/{branch-name}`
144-
145-
### Step 4: Research and Design with TDD
146-
147-
**⚠️ INVESTIGATION-FIRST PATTERN**: If the existing codebase or system is unfamiliar/complex, consider running the **INVESTIGATION_WORKFLOW.md** (6 phases) FIRST, then return here to continue development. This is especially valuable when:
148-
149-
- The codebase area is unfamiliar or poorly documented
150-
- The feature touches multiple complex subsystems
151-
- You need to understand existing patterns before designing new ones
152-
- The architecture or integration points are unclear
153-
154-
After investigation completes, continue with these tasks:
155-
156-
- [ ] **Use** architect agent to design solution architecture
157-
- [ ] **Use** api-designer agent for API contracts (if applicable)
158-
- [ ] **Use** database agent for data model design (if applicable)
159-
- [ ] **Use** tester agent to write failing tests (TDD approach)
160-
- [ ] **Use** security agent to identify security requirements
161-
- [ ] **💡 TIP**: For diagnostic follow-up questions during research, consider [parallel agent investigation](.claude/CLAUDE.md#parallel-agent-investigation-strategy)
162-
- [ ] Document module specifications
163-
- [ ] Create detailed implementation plan
164-
- [ ] Identify risks and dependencies
165-
166-
### Step 5: Implement the Solution
167-
168-
- [ ] **Always use** builder agent to implement from specifications
169-
- [ ] **Use** integration agent for external service connections
170-
- [ ] Follow the architecture design
171-
- [ ] Make failing tests pass iteratively
172-
- [ ] Ensure all requirements are met
173-
- [ ] Add inline documentation
174-
175-
### Step 6: Refactor and Simplify
176-
177-
- [ ] **CRITICAL: Provide cleanup agent with original user requirements**
178-
- [ ] **Always use** cleanup agent for ruthless simplification WITHIN user constraints
179-
- [ ] **Use** optimizer agent for performance improvements
180-
- [ ] Remove unnecessary abstractions (that weren't explicitly requested)
181-
- [ ] Eliminate dead code (unless user explicitly wanted it)
182-
- [ ] Simplify complex logic (without violating user specifications)
183-
- [ ] Ensure single responsibility principle
184-
- [ ] Verify no placeholders remain - no stubs, no TODOs, no swallowed exceptions, no unimplemented functions - follow the zero-BS principle.
185-
- [ ] **VALIDATE: All explicit user requirements still preserved**
186-
187-
### Step 7: Run Tests and Pre-commit Hooks
188-
189-
- [ ] **Use** pre-commit-diagnostic agent if hooks fail
190-
- [ ] **💡 TIP**: For test failures, use [parallel investigation](.claude/CLAUDE.md#parallel-agent-investigation-strategy) to explore issues while continuing work
191-
- [ ] Run all unit tests
192-
- [ ] Execute `pre-commit run --all-files`
193-
- [ ] Fix any linting issues
194-
- [ ] Fix any formatting issues
195-
- [ ] Resolve type checking errors
196-
- [ ] Iterate until all checks pass
197-
198-
### Step 8: Mandatory Local Testing (NOT in CI)
199-
200-
**CRITICAL: Test all changes locally in realistic scenarios BEFORE committing.**
201-
202-
- [ ] **Test simple use cases** - Basic functionality verification
203-
- [ ] **Test complex use cases** - Edge cases and longer operations
204-
- [ ] **Test integration points** - External dependencies and APIs
205-
- [ ] **Verify no regressions** - Ensure existing functionality still works
206-
- [ ] **Document test results** - What was tested and results
207-
- [ ] **RULE: Never commit without local testing**
208-
209-
**Examples of required tests:**
210-
211-
- If proxy changes: Test simple and long requests locally
212-
- If API changes: Test with real client requests
213-
- If CLI changes: Run actual commands with various options
214-
- If database changes: Test with actual data operations
215-
216-
**Why this matters:**
217-
218-
- CI checks can't catch all real-world issues
219-
- Local testing catches problems before they reach users
220-
- Faster feedback loop than waiting for CI
221-
- Prevents embarrassing failures after merge
222-
223-
---
224-
225-
## Next Steps: Review and Merge Phases
226-
227-
After completing Steps 1-8, continue with **Steps 9-15** in [reference/REVIEW_PHASES.md](reference/REVIEW_PHASES.md):
228-
229-
- Step 9: Commit and Push
230-
- Step 10: Open Pull Request
231-
- Step 11: Review the PR
232-
- Step 12: Implement Review Feedback
233-
- Step 13: Philosophy Compliance Check
234-
- Step 14: Ensure PR is Mergeable
235-
- Step 15: Final Cleanup and Verification
236-
237-
## Customization
238-
239-
To customize this workflow:
240-
241-
1. Edit this file to modify, add, or remove steps
242-
2. Save your changes
243-
3. The updated workflow will be used for future tasks
244-
245-
## Philosophy Notes
246-
247-
This workflow enforces our core principles:
248-
249-
- **Ruthless Simplicity**: Each step has one clear purpose
250-
- **Test-Driven Development**: Write tests before implementation
251-
- **Quality Gates**: Multiple review and validation steps
252-
- **Documentation**: Clear commits and PR descriptions
83+
- **Canonical Workflow**: `.claude/workflow/DEFAULT_WORKFLOW.md`
84+
- **Command Interface**: `.claude/commands/amplihack/ultrathink.md`
85+
- **Orchestrator Skill**: `.claude/skills/ultrathink-orchestrator/`
86+
- **Investigation Workflow**: `.claude/skills/investigation-workflow/`

.claude/skills/default-workflow/reference/REVIEW_PHASES.md

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)