Claude-code-skills ln-810-performance-optimizer
Multi-cycle performance optimization with profiling and bottleneck analysis. Use when optimizing application performance.
install
source · Clone the upstream repo
git clone https://github.com/levnikolaevich/claude-code-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/levnikolaevich/claude-code-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills-catalog/ln-810-performance-optimizer" ~/.claude/skills/levnikolaevich-claude-code-skills-ln-810-performance-optimizer && rm -rf "$T"
manifest:
skills-catalog/ln-810-performance-optimizer/SKILL.mdsource content
Paths: File paths (
,shared/,references/) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. If../ln-*is missing, fetch files via WebFetch fromshared/.https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}
Type: L2 Domain Coordinator Category: 8XX Optimization
Performance Optimizer
Runtime-backed multi-cycle optimization coordinator. Profiles, researches, validates, and executes optimization hypotheses until target reached, plateau detected, or budget exhausted.
Inputs
| Input | Required | Description |
|---|---|---|
| Yes | endpoint, function, or pipeline to optimize |
| Yes | current performance problem |
| No | user or research-derived target |
| No | default |
Purpose & Scope
- Detect whether optimization is the right tool
- Run iterative cycles:
profile -> gate -> research -> target -> context -> validate -> execute - Preserve optimization artifacts under
and runtime state under.hex-skills/optimization/{slug}/.hex-skills/optimization/runtime/runs/{run_id}/ - Resume deterministically from the last checkpointed phase
- Keep cycle summaries machine-readable
Runtime Contract
MANDATORY READ: Load
shared/references/ci_tool_detection.md
MANDATORY READ: Load shared/references/coordinator_runtime_contract.md, shared/references/optimization_runtime_contract.md, shared/references/coordinator_summary_contract.md
Runtime CLI:
node shared/scripts/optimization-runtime/cli.mjs start --slug {slug} --manifest-file .hex-skills/optimization/{slug}/manifest.json node shared/scripts/optimization-runtime/cli.mjs status --slug {slug} node shared/scripts/optimization-runtime/cli.mjs record-worker-result --payload '{...}' node shared/scripts/optimization-runtime/cli.mjs record-summary --payload '{...}' node shared/scripts/optimization-runtime/cli.mjs record-cycle --payload '{...}' node shared/scripts/optimization-runtime/cli.mjs checkpoint --phase PHASE_8_EXECUTE --payload '{...}' node shared/scripts/optimization-runtime/cli.mjs advance --to PHASE_9_CYCLE_BOUNDARY
Runtime Layout
Runtime state is run-scoped, while optimization artifacts stay slug-scoped:
.hex-skills/optimization/ runtime/active/ln-810/{slug}.json runtime/runs/{run_id}/manifest.json runtime/runs/{run_id}/state.json runtime/runs/{run_id}/checkpoints.json runtime/runs/{run_id}/history.jsonl runtime-artifacts/runs/{run_id}/optimization-coordinator/ln-810--{slug}.json runtime-artifacts/runs/{run_id}/optimization-worker/{worker}--{child_identifier}.json {slug}/context.md {slug}/ln-814-log.tsv
Workflow
Phase 0: Preflight
- Validate:
- target identifiable
- observed metric provided
- git clean state
- test infrastructure exists
- Detect stack and optional service topology.
- Derive slug.
- Build manifest with:
slugtargetobserved_metrictarget_metricexecution_modecycle_config
- Start runtime and checkpoint
.PHASE_0_PREFLIGHT
Phase 1: Parse Input
- Normalize the problem statement.
- Set or defer
.target_metric - Checkpoint
.PHASE_1_PARSE_INPUT
Phase 2: Profile
- Compute deterministic child metadata:
identifier=ln-811--{slug}--cycle-{current_cycle}- child
run_id - exact
summaryArtifactPath=.hex-skills/runtime-artifacts/runs/{parent_run_id}/optimization-worker/ln-811--{slug}--cycle-{current_cycle}.json
- Checkpoint
withPHASE_2_PROFILE
.child_run - Invoke
with the childln-811-performance-profiler
and exactrunId
.summaryArtifactPath - Read the emitted
summary envelope from the exact artifact path.optimization-worker - Record the worker summary with
.record-worker-result
Phase 3: Wrong Tool Gate
Evaluate profiler output:
| Gate | Meaning | Action |
|---|---|---|
| optimization work is justified | continue |
| measurements usable but imperfect | continue with warning |
| wrong tool, already optimized, or infrastructure-bound | aggregate and exit |
| user overrides | continue with explicit waiver |
Rules:
- cycle 1
-> finish as diagnostic resultBLOCK - cycle 2+
due toBLOCK
oralready_optimized
-> finish as successful stopwithin_industry_norm
Checkpoint
PHASE_3_WRONG_TOOL_GATE with:
gate_verdict
when blockedstop_reason
when terminalfinal_result
Phase 4: Research
- Compute deterministic child metadata for
.ln-812 - Checkpoint
withPHASE_4_RESEARCH
.child_run - Invoke
with the childln-812-optimization-researcher
and exactrunId
.summaryArtifactPath - Read and record the emitted
summary envelope.optimization-worker - If no hypotheses remain, stop after aggregate/report.
Phase 5: Set Target
- Resolve target metric:
- user-specified target wins
- otherwise use research target with confidence
- otherwise default to 50% improvement
- Checkpoint
withPHASE_5_SET_TARGET
.target_metric
Phase 6: Write Context
- Build
..hex-skills/optimization/{slug}/context.md - Include:
- problem statement
- performance map
- target metrics
- hypotheses and conflicts
- local codebase findings
- previous cycles
- Checkpoint
withPHASE_6_WRITE_CONTEXT
.context_file
Phase 7: Validate Plan
- Compute deterministic child metadata for
.ln-813 - Checkpoint
withPHASE_7_VALIDATE_PLAN
andvalidation_verdict
.child_run - Invoke
with the childln-813-optimization-plan-validator
and exactrunId
.summaryArtifactPath - Read and record the emitted
summary envelope.evaluation-coordinator - If verdict is
, pause runtime until user resolves or waives.NO_GO
Phase 8: Execute
execution_mode=execute:
- Compute deterministic child metadata for
.ln-814 - Checkpoint
withPHASE_8_EXECUTE
.child_run - Invoke
with the childln-814-optimization-executor
and exactrunId
.summaryArtifactPath - Read and record the emitted
summary envelope.optimization-worker
execution_mode=plan_only:
- Do not run
.ln-814 - Checkpoint
asPHASE_8_EXECUTE
.skipped_by_mode
Phase 9: Cycle Boundary
- Record the cycle summary with
.record-cycle - Evaluate stop conditions:
- target met
- plateau
- max cycles reached
- no new hypotheses
- If continuing:
- merge previous branch when needed
- increment
current_cycle - checkpoint
PHASE_9_CYCLE_BOUNDARY - advance back to
PHASE_2_PROFILE
- If stopping:
- checkpoint
withPHASE_9_CYCLE_BOUNDARYstop_reason - advance to
PHASE_10_AGGREGATE
- checkpoint
Phase 10: Aggregate
- Aggregate all cycle summaries from runtime state.
- Compute cumulative improvement.
- Checkpoint
.PHASE_10_AGGREGATE
Phase 11: Report
- Produce final report with:
- per-cycle summary
- cumulative improvement
- final result
- gap analysis when target not met
- Checkpoint
with:PHASE_11_REPORTreport_ready=truefinal_result
- Record the
summary envelope withoptimization-coordinator
.record-summary - Complete runtime only after the report checkpoint and coordinator summary exist.
Worker Invocation (MANDATORY)
| Phase | Skill | Purpose |
|---|---|---|
| 2 | | Build measured performance map |
| 4 | | Research hypotheses and targets |
| 7 | | Validate feasibility via evaluation-platform review (L2 Coordinator) |
| 8 | | Execute optimization strike and bisect |
Skill(skill: "ln-811-performance-profiler") Skill(skill: "ln-812-optimization-researcher") Agent(... Skill(skill: "ln-813-optimization-plan-validator")) Agent(... Skill(skill: "ln-814-optimization-executor"))
TodoWrite format (mandatory)
- Start ln-810 runtime (pending) - Run profiler and record summary (pending) - Apply Wrong Tool Gate (pending) - Run researcher and record summary (pending) - Set target metric (pending) - Write optimization context (pending) - Validate plan and record summary (pending) - Execute or skip by mode (pending) - Record cycle boundary (pending) - Aggregate results and write final report (pending)
Critical Rules
- Runtime state is the optimization orchestration SSOT.
- Worker outputs are consumed only through summary JSON artifacts.
is a first-class execution mode, not an informal branch.plan_only
fromNO_GO
must pause runtime until explicitly resolved.ln-813- Cycle history lives in runtime state, not in chat memory.
- A terminal diagnostic result is still a valid
orchestration outcome.DONE
Definition of Done
- Runtime started and preflight/input checkpoints recorded
- Profiler and researcher summaries recorded deterministically
- Wrong Tool Gate result checkpointed
- Target metric and context file checkpointed
- Validator summary recorded;
handled viaNO_GO
when neededPAUSED - Executor summary recorded or
checkpointedskipped_by_mode - Cycle boundary recorded for every completed cycle
- Aggregate and final report checkpoints recorded
- Runtime completed with final result and resume-free terminal state
Phase 12: Meta-Analysis
MANDATORY READ: Load
shared/references/meta_analysis_protocol.md
Skill type:
optimization-coordinator. Run after phases complete. Output to chat using the optimization-coordinator format.
Reference Files
shared/references/coordinator_runtime_contract.mdshared/references/optimization_runtime_contract.mdshared/references/coordinator_summary_contract.md../ln-811-performance-profiler/SKILL.md../ln-812-optimization-researcher/SKILL.md../ln-813-optimization-plan-validator/SKILL.md../ln-814-optimization-executor/SKILL.md
Version: 3.0.0 Last Updated: 2026-03-15