Bruno-Cunha-Souza/ValarMindSkills / skills/code-optimization
code-optimization
VerifiedLifecycle perf audit Go/Rust/TS/Python. N+1/leak/duplication sweeps, tri-axis Impact×Risk×Effort, writes OPTIMIZATION_REPORT.md. Read-only — file:line evidence. Triggers: 'optimize code', 'otimizar código', 'auditar performance', 'find bottlenecks', '/code-optimization'.
| File | Kind | Size |
|---|---|---|
| EXAMPLE.md | markdown | 10.6 KB |
| SKILL.md | skill md | 22.6 KB |
| references/CALLS.md | markdown | 9.2 KB |
| references/CHECKLIST.md | markdown | 3.6 KB |
| references/DUPLICATION.md | markdown | 5.6 KB |
| references/GOLANG.md | markdown | 7.3 KB |
| references/PYTHON.md | markdown | 9.2 KB |
| references/REPORT_TEMPLATE.md | markdown | 10.1 KB |
| references/RESOURCES.md | markdown | 6.8 KB |
| references/RUST.md | markdown | 7.6 KB |
| references/SEVERITY_RUBRIC.md | markdown | 6.5 KB |
| references/TYPESCRIPT.md | markdown | 8.0 KB |
references/CHECKLIST.md
View on GitHub> Reference companion for the [code-optimization](../SKILL.md) skill.
# Optimization Checklist
Copy-paste cheat sheet, one block per Phase. Track progress as you walk the lifecycle.
## Phase 0 — Detection
- [ ] Language identified (`go` / `rust` / `typescript` / `python`)
- [ ] Framework identified (FastAPI / Django / Flask / Gin / Fiber / fx / Axum / Actix / Elysia / Fastify / Hono / Express / none)
- [ ] Package manager identified (`uv` / `poetry` / `pip` / `cargo` / `bun` / `pnpm` / `npm` / `yarn` / `go mod`)
- [ ] Runtime version captured (`go.mod` Go version, `Cargo.toml` `rust-version`, `pyproject.toml` `requires-python`, `package.json` `engines`)
- [ ] Project docs read (`README`, `ARCHITECTURE`, `PERFORMANCE`, `BENCHMARKS`, ADRs)
- [ ] SLO / perf target identified (or noted absent under `assumptions:`)
## Phase 1 — Triage
- [ ] File count + LOC computed
- [ ] Scope decided: full sweep / module list / refused (too large)
- [ ] User confirmed scope when ≥ 100 files OR ≥ 20k LOC
## Phase 2 — Static & Profile Sweep
- [ ] Duplication scan run (`jscpd` + language-specific tool)
- [ ] Static perf-aware linter run (`ruff PERF` / `clippy::pedantic` / `staticcheck` / `knip`)
- [ ] CPU profile attempted with user consent (`pprof` / `cargo flamegraph` / `clinic flame` / `py-spy`)
- [ ] Alloc / memory profile attempted with user consent (`pprof -alloc_objects` / `heaptrack` / `clinic heapprofile` / `tracemalloc` / `pytest-memray`)
- [ ] Tool versions recorded for the report
## Phase 3 — Manual Read
- [ ] Hot path entry points walked (handlers, controllers)
- [ ] ORM / data layer walked
- [ ] Loop-heavy code walked
- [ ] External I/O walked (HTTP clients, brokers, caches)
- [ ] Concurrency primitives walked (locks, channels, goroutines, tasks, Promises)
- [ ] Each draft finding has: `file:line`, code quote, category, suggested change, draft tri-axis grade
## Phase 4 — External Validation (conditional)
- [ ] Identified findings with `Impact >= High AND Confidence < High`
- [ ] For each: at least one WebSearch result OR one context7 doc snippet cited
- [ ] Confidence updated based on validation outcome
- [ ] Contradicted draft findings rewritten or dropped
## Phase 5 — Classification
- [ ] Every finding scored on three axes (Impact / Risk / Effort)
- [ ] Confidence tag assigned
- [ ] Findings sorted into quadrants (Quick Win / Strategic / Polish / Defer / Drop)
- [ ] `Confidence=Low AND Impact >= High` findings flagged for human review
- [ ] Cross-link tags added (`@code-security-review` / `@code-debugger` / `@clean-code` / `@ci-cd-generator`)
## Phase 6 — Report
- [ ] `OPTIMIZATION_REPORT.md` overwrite confirmed (when file pre-existed)
- [ ] Report written at project root via `Write` tool
- [ ] Terminal summary printed (Findings summary, Quick wins count, Strategic count, Next steps)
- [ ] Report includes Context section (lang, framework, scope, tools, validation, assumptions)
- [ ] Report uses correct schema per `REPORT_TEMPLATE.md` (H3 per finding in QW/Strategic/Polish; table for Defer/Drop)
## Final pre-emit checks
- [ ] Every finding cites `file:line` (no exceptions)
- [ ] Every code quote matches the file byte-for-byte (re-read on doubt)
- [ ] No invented CVEs / latency numbers / library versions
- [ ] No `Edit` / `Write` calls on source files (only on `OPTIMIZATION_REPORT.md`)
- [ ] Cross-link to related skills (`@code-review`, `@clean-code`, `@code-security-review`, `@code-debugger`, `@ci-cd-generator`) where the finding domain overlaps
- [ ] If `Confidence=Low AND Impact >= High`: escalation phrase present (`needs human review before action`)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |