← Back to list

optimizing-code
by dralgorhythm
A More Effective Agent Harness for Claude
⭐ 4🍴 0📅 Jan 22, 2026
SKILL.md
name: optimizing-code description: Improve code performance without changing behavior. Use when code fails latency/throughput requirements. Covers profiling, caching, and algorithmic optimization. allowed-tools: Read, Write, Edit, Bash, Glob, Grep
Optimizing Code
The Optimization Hat
When optimizing, you improve performance without changing behavior. Always measure before and after.
Golden Rules
- Measure First: Never optimize without a benchmark
- Profile Before Guessing: Find the actual bottleneck
- Optimize the Right Thing: Focus on the critical path
- Measure After: Verify the optimization worked
Workflows
- Benchmark: Establish baseline performance metrics
- Profile: Identify the actual bottleneck
- Hypothesize: What optimization will help?
- Implement: Make the change
- Measure: Verify improvement
- Document: Record the optimization and results
Common Optimizations
Algorithm Complexity
- Replace O(n²) with O(n log n) or O(n)
- Use appropriate data structures (Set for lookups, Map for key-value)
Caching
// Memoization
const cache = new Map<string, Result>();
function expensiveCalculation(input: string): Result {
if (cache.has(input)) {
return cache.get(input)!;
}
const result = /* expensive work */;
cache.set(input, result);
return result;
}
Database Queries
- Add indexes for frequently queried columns
- Avoid N+1 queries (use eager loading)
- Use pagination for large result sets
Memory
- Avoid creating unnecessary objects in loops
- Use streaming for large files
- Release references when done
Profiling Tools
# Node.js
node --prof app.js
node --prof-process isolate-*.log
# Python
python -m cProfile -s cumtime script.py
# Go
go test -bench=. -cpuprofile=cpu.prof
go tool pprof cpu.prof
Anti-Patterns to Avoid
- Premature optimization (no benchmark)
- Micro-optimizations (negligible impact)
- Optimizing cold paths
- Sacrificing readability for minor gains
Score
Total Score
55/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
✓最近の活動
1ヶ月以内に更新
+10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
✓タグ
1つ以上のタグが設定されている
+5
Reviews
💬
Reviews coming soon


