From tl
Use when something works correctly but is too slow, too memory-heavy, or too resource-intensive. Measures baselines, implements fixes, iterates until a target is reached. Keywords: optimize, performance, profiling, bottleneck, latency, throughput, memory, benchmark.
How this skill is triggered — by the user, by Claude, or both
Slash command
/tl:optimize <component or area to optimize><component or area to optimize>This skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are running the **Optimize** workflow. The goal is to make **$ARGUMENTS** faster, lighter, or more efficient — without breaking correctness. Every decision is grounded in measured data, not intuition.
You are running the Optimize workflow. The goal is to make $ARGUMENTS faster, lighter, or more efficient — without breaking correctness. Every decision is grounded in measured data, not intuition.
/tracer)Optimize works in 5 phases. Each phase produces a committed checkpoint before the next begins.
Baseline (measure current state)
-> Profile (locate hot paths)
-> Identify bottleneck (single highest-leverage target)
-> Implement fix (one change at a time)
-> Measure delta (confirm improvement, no regression)
-> Iterate (repeat until target reached or returns diminish)
If $ARGUMENTS is vague or no performance target was stated, ask one clarifying question:
Do not proceed without a concrete, measurable target. Optimization without a target is refactoring in disguise.
Choose the measurement method appropriate for the project:
npm run bench, cargo bench, pytest --benchmark, etc.)time or equivalentRecord the baseline numbers precisely:
## Baseline: [component/area]
**Date**: [date]
**Target**: [measurable target]
**Current state**:
- p50 latency: Xms
- p99 latency: Xms
- Throughput: X req/s
- Memory: XMB RSS
- [other metrics relevant to target]
**Measurement method**: [benchmark/load-test/profiler/time]
**Commit**: [git hash of measured commit]
git add [benchmark or measurement files]
git commit -m "$(cat <<'EOF'
optimize: establish baseline for [component]
Measured current performance before any changes.
Target: [measurable target]
Baseline: [key metric and value]
Co-Authored-By: Claude Opus 4.6 <[email protected]>
EOF
)"
Select the appropriate profiler for the language and environment:
| Language | CPU profiling | Memory profiling |
|---|---|---|
| Node.js | --cpu-prof, clinic flame | --heap-prof, clinic heap |
| Python | cProfile, py-spy, memray | tracemalloc, memray |
| Rust | perf, cargo flamegraph | heaptrack, valgrind --massif |
| Go | pprof (cpu + mem) | pprof |
| JVM | async-profiler, JFR | JVM heap dump + MAT |
| C/C++ | perf, gprof, Instruments | valgrind --massif, Instruments |
If none of the above apply or no profiler is available, proceed to manual code analysis (Phase 3) using Grep and Read.
Run the profiler against a representative workload — the same workload used for the baseline if possible. Avoid synthetic microbenchmarks unless the target is a specific function in isolation.
Extract the top consumers from the profiler output:
## Profile Results: [component]
**Profiler**: [name and version]
**Workload**: [what was profiled]
**Top CPU consumers:**
1. `[function/module]` — X% of samples — [file:line]
2. `[function/module]` — X% of samples — [file:line]
3. `[function/module]` — X% of samples — [file:line]
**Top memory allocators (if applicable):**
1. `[allocation site]` — XMB — [file:line]
2. `[allocation site]` — XMB — [file:line]
**Observations:**
- [Any non-obvious finding: e.g., "98% of CPU is in JSON parsing, not the DB query"]
From the profile results, select one bottleneck to address in this iteration. Criteria:
State the bottleneck explicitly:
## Bottleneck: [iteration N]
**Target**: [function/module/pattern]
**Rationale**: [why this is the highest-leverage target — cite profiler numbers]
**Hypothesis**: [what change is expected to help and why]
**Risk**: [what could break or regress]
**Not targeting**: [other hot paths deferred and why]
Before implementing, read the hot path code to confirm the hypothesis:
Do not proceed with a fix until the root cause is confirmed in code — not just in profiler output.
Implement one targeted change per iteration. Do not bundle multiple optimizations — each change must be independently measurable. Common patterns:
After implementing, run the existing test suite. If tests fail, fix the implementation — not the tests. The optimization is invalid if it changes observable behavior.
[project test command]
git add [modified files]
git commit -m "$(cat <<'EOF'
optimize: [brief description of change] in [component]
Bottleneck: [what was identified in Phase 3]
Fix: [what was changed and why it should help]
Hypothesis: [expected improvement]
Tests: passing
No behavior change.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
EOF
)"
Run the same measurement method used in Phase 1 against the same workload. Record results in the same format:
## Delta: Iteration N
**Commit**: [git hash of fix]
**Fix applied**: [description]
**Before**: [key metric and value from baseline or prior iteration]
**After**: [key metric and value]
**Delta**: [improvement as absolute value and percentage]
**Regression check**: [any other metric that got worse]
**Tests**: [passing / failing — if failing, revert the fix]
# If reverting:
git revert HEAD --no-edit
Produce a final report covering all iterations:
## Optimization Report: [component/area]
**Target**: [measurable target stated in Phase 1]
**Outcome**: [target reached / partially reached / not reached — explain]
### Iterations
| # | Bottleneck | Fix | Before | After | Delta |
|---|-----------|-----|--------|-------|-------|
| 1 | [target] | [change] | [metric] | [metric] | [%] |
| 2 | [target] | [change] | [metric] | [metric] | [%] |
| N | ... | ... | ... | ... | ... |
### Final State vs Baseline
| Metric | Baseline | Final | Change |
|--------|---------|-------|--------|
| [metric 1] | X | Y | +/-Z% |
| [metric 2] | X | Y | +/-Z% |
### What Was Not Addressed
- [Deferred bottleneck]: [why it was not worth addressing]
- [Deferred concern]: [why it was out of scope]
### Known Risks
- [Risk introduced by the optimization]
- [Workload assumptions that may not hold in production]
If follow-up work was identified:
Create follow-up tasks using your preferred task tracking approach. Each task should include the title, priority, and context from the optimization work. If no tracker is configured, write follow-up tasks to TODO.md in the project root.
/tracer — iterative correctness-first implementation (use before /optimize if the feature is incomplete)/test-strategy — ensure tests exist before optimizing (correctness is a precondition)/review — code review of optimization changes (useful after a complex fix)/spec — formalize performance requirements before starting if the target is unclearnpx claudepluginhub tyevans/tackline --plugin tacklineMake code measurably faster or leaner without breaking it: define a target, measure a baseline, profile to find the actual bottleneck, apply optimizations in order of leverage, and re-verify correctness.
Profiles and optimizes performance with a mandatory baseline-first gate. Use when something is slow or you need to hit a latency/throughput target.
Applies a measured hot-path optimization loop: locate, transform candidates, benchmark, and commit the winner. For performance regressions or reducing allocations.