agentleFS
cmdr-characmdr-chara/chara-toolkit/skills/optimize-codebase-performance/SKILL.md

optimize-codebase-performance

Skill2 starsChanged 11 days agoMITView on GitHub

Measure and improve a named performance bottleneck while preserving correctness. Use when reducing latency, CPU, memory, I/O, rendering cost, startup time, or infrastructure cost. Not for unmeasured cleanup, correctness bugs, or migrations.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 8 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use this skill for a named latency/throughput/CPU/memory/GPU/I/O/startup/rendering/database/bundle/infrastructure-cost problem that can be …

    line 12
  2. Distinctive:

    Do not trigger for unmeasured cleanup, an unknown correctness failure, migration, broad platform audit, or final release approval.

    line 14
  3. Distinctive:

    Start with measurement; do not rewrite code on intuition.

    line 23
  4. Distinctive:

    Keep baseline and candidate workloads comparable.

    line 24
  5. Distinctive:

    Never claim a percentage improvement without paired measurements.

    line 25
  6. Very specific:

    Establish the baseline: Use references/measurement-and-reporting.md.

    line 31
  7. Very specific:

    Attribute the bottleneck: Use references/bottleneck-playbook.md across relevant application, data, dependency, runtime, infrastructure, and …

    line 32
  8. Distinctive:

    Implement one attributable batch at a time: Run focused correctness checks and the same representative benchmark.

    line 35
  9. Distinctive:

    Report honestly: Keep negative results, noise limits, before/after numbers, trade-offs, and residual bottlenecks.

    line 36
  10. Very specific:

    Use repository-intelligence for unclear hot paths, debugging-investigator for incorrect behavior, codebase-evolution-controller for …

    line 40
  11. Distinctive:

    If the workload is not representative or measurement variance hides the effect, improve the measurement before changing more code.

    line 44
  12. Distinctive:

    Stop when the target is met with comparable evidence, the next change is no longer justified by expected value/risk, or a concrete …

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Optimize Codebase Performance

Optimize measured critical paths, not code that merely looks expensive.

Trigger boundary

Use this skill for a named latency/throughput/CPU/memory/GPU/I/O/startup/rendering/database/bundle/infrastructure-cost problem that can be measured.

Do not trigger for unmeasured cleanup, an unknown correctness failure, migration, broad platform audit, or final release approval.

Required inputs

Resolve the critical path, target metric, representative workload, environment, baseline or baseline plan, correctness invariants, budget/stop condition, working-tree state, and approval state.

Safety baseline

  • Preserve uncommitted user work.
  • Start with measurement; do not rewrite code on intuition.
  • Keep baseline and candidate workloads comparable.
  • Never claim a percentage improvement without paired measurements.
  • Broad optimization edits stop at a proposal unless already authorized.

Workflow

  1. Define the target. Name the user/system path, metric, workload, environment, and success/stop criteria.
  2. Establish the baseline. Use references/measurement-and-reporting.md; collect enough samples/profiles to distinguish signal from noise.
  3. Attribute the bottleneck. Use references/bottleneck-playbook.md across relevant application, data, dependency, runtime, infrastructure, and UI layers.
  4. Form falsifiable hypotheses. Each candidate change needs evidence, mechanism, expected metric movement, correctness risk, and a measurement that can reject it.
  5. Propose a bounded batch. Without authorization, stop at AWAITING_APPROVAL.
  6. Implement one attributable batch at a time. Run focused correctness checks and the same representative benchmark. Revert/revise changes that do not help enough or create unjustified regressions.
  7. Report honestly. Keep negative results, noise limits, before/after numbers, trade-offs, and residual bottlenecks.

Handoffs and interaction boundaries

Use repository-intelligence for unclear hot paths, debugging-investigator for incorrect behavior, codebase-evolution-controller for version/contract transitions, a platform builder (production-web-builder, flutter-production-builder, or expo-react-native-builder) for broader product work, security-review if a performance change crosses a security boundary, and verification-and-release for final ship judgment.

Failure handling

If the workload is not representative or measurement variance hides the effect, improve the measurement before changing more code. If the true bottleneck is outside authorized scope, report it and hand off rather than optimizing a proxy.

Stop conditions

Stop when the target is met with comparable evidence, the next change is no longer justified by expected value/risk, or a concrete scope/environment blocker prevents meaningful measurement.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.