.claude/skills/task-delegation/SKILL.md
Cost-effective task delegation strategy using Haiku model for straightforward work. Use when planning how to approach simple, pattern-following tasks to minimize costs.
npx skillsauth add Cantara/lib-electronic-components task-delegationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Purpose: Guide cost-effective delegation of straightforward tasks to Haiku model (12x cheaper than Sonnet 4.5) while reserving Sonnet for complex reasoning.
Use this skill when you're about to start a task and need to decide:
| Model | Input | Output | Speed | Best For | |-------|-------|--------|-------|----------| | Haiku | $0.25/MTok | $1.25/MTok | Fast | Pattern-following, test fixes, simple refactoring | | Sonnet 4.5 | $3.00/MTok | $15.00/MTok | Thorough | Architecture, complex debugging, ambiguous problems |
Cost multiplier: Haiku is 12x cheaper than Sonnet 4.5
Test-related:
assertEquals(0.9, x) → assertTrue(x >= 0.9))Refactoring:
Documentation:
Bug fixes:
Code hygiene:
Architecture:
Complex debugging:
Exploration:
First-time patterns:
Security-sensitive:
When delegating to Haiku, use this proven template:
Task(
subagent_type="general-purpose",
model="haiku",
prompt=`You are working on <branch-name> for <PR-number>.
## Context
[1-2 sentences explaining what needs to be done]
## Tasks
1. [Specific task with file path]
2. [Specific task with expected outcome]
3. Run tests: mvn test -Dtest=<TestClass>
4. Verify all tests pass
## Success Criteria
- [Concrete measurable outcome]
- [Test count or assertion format]
- [No compilation errors]
## Reference Examples
Look at these files for patterns:
- <file1.java>
- <file2.java>
## Implementation Notes
- Use JUnit 5 (@Test, @Nested, @DisplayName)
- Follow existing code style
- Add descriptive assertion messages
Report back:
- Changes made
- Test results (pass/fail count)
`
)
Task: Expand test coverage for 3 calculator test files
Delegation prompt:
Results:
Why it worked:
Based on PR #125 success, these are likely to work well:
Test expansion:
Simple refactoring:
Documentation:
Work: 840 lines of test code
Tokens: ~70,000 (input) + ~10,000 (output)
Haiku cost:
Input: 70k * $0.25/1M = $0.0175
Output: 10k * $1.25/1M = $0.0125
Total: $0.03
Sonnet cost:
Input: 70k * $3.00/1M = $0.21
Output: 10k * $15.00/1M = $0.15
Total: $0.36
Savings: $0.33 per task (91% reduction)
| Task Type | Count | Savings/Task | Total Savings | |-----------|-------|--------------|---------------| | Test expansion (handlers) | 50 | $0.33 | $16.50 | | Simple refactoring | 30 | $0.20 | $6.00 | | Documentation updates | 20 | $0.15 | $3.00 | | Bug fixes (simple) | 40 | $0.25 | $10.00 | | Total | 140 | - | $35.50 |
Annual savings potential: $100-200 with consistent delegation
Observation from PR #125:
Mitigation:
Haiku strengths:
Haiku weaknesses:
Quality check:
Default to attempting Haiku delegation for simple tasks:
if (task.isPatternFollowing() && hasExamples) {
try {
delegate_to_haiku()
} catch (ResourceLimitError) {
complete_with_sonnet()
}
}
Good prompt:
Add edge case tests to DefaultSimilarityCalculatorTest:
- Very long MPNs (50+ characters)
- Single character MPNs
- MPNs with only numbers
Follow the pattern in lines 25-45 (BasicSimilarityTests).
Target: 15+ new tests.
Bad prompt:
Improve DefaultSimilarityCalculatorTest coverage.
Always end with:
Run mvn test -Dtest=<TestClass> and verify all tests pass.
Report the results.
Point to specific files/lines:
Reference examples:
- ResistorSimilarityCalculatorTest.java lines 50-80
- CapacitorSimilarityCalculatorTest.java @Nested classes
Good: "Add 10 edge case tests to DefaultSimilarityCalculatorTest" Bad: "Fix tests in 5 different calculator test files"
If you see these in a task description, DO NOT delegate to Haiku:
If Haiku delegation fails:
For each delegation attempt, record:
Task: <description>
Delegated: Yes/No
Success: Yes/Partial/No
Lines changed: <count>
Cost (Haiku): $<amount>
Cost (Sonnet equiv): $<amount>
Savings: $<amount>
Notes: <learnings>
Running totals (update in CLAUDE.md):
Potential enhancements:
Context: Expanding test coverage for DefaultSimilarityCalculator, LevenshteinCalculator, and creating new MetadataIntegrationTest.
What worked:
mvn clean test commandUnexpected win:
Metrics:
Key insight: Haiku is excellent at structured, pattern-following work. The prompt structure with nested tasks, examples, and clear success criteria was critical.
Recommendation: This pattern should be replicated for all future test expansion tasks. The ROI is exceptional.
<!-- Add new learnings above this line -->tools
Use when working with component similarity calculations - comparing MPNs, finding equivalent parts, implementing new similarity calculators, or understanding how component matching works.
testing
Use when working with transistor similarity calculations - comparing BJT MPNs, understanding NPN/PNP polarity matching, equivalent groups like 2N2222/PN2222, or transistor-specific similarity logic.
testing
Use when working with sensor similarity calculations - comparing temperature/accelerometer/humidity sensor MPNs, understanding sensor families, equivalent parts, or sensor-specific similarity logic.
testing
Use when working with resistor similarity calculations - comparing resistor MPNs, understanding value/tolerance/package matching, or implementing resistor-specific similarity logic.