From agent-almanac
Optimizes working codebases by assaying elements as gold/silver/lead/dross, amplifying value, refining APIs, eliminating dead weight. For sluggish performance, bundle/memory reduction, OSS prep.
npx claudepluginhub pjt222/agent-almanacThis skill uses the workspace's default tool permissions.
---
Optimizes codebases through refactoring, performance tuning, technical debt management, and cleanup. Activates on mentions of refactor, optimize, performance, cleanup, architecture.
Optimizes apps by improving speed (page loads, APIs), cleaning code (dead/unused files), database (queries, orphans), and dependencies (bloat, bundles). Use for slow apps, high bills, or bloated codebases.
Optimizes code for performance, readability, or efficiency: measures baselines, profiles bottlenecks, fixes frontend (React re-renders, bundles), backend, database issues. Use for slowdowns or high usage.
Share bugs, ideas, or general feedback.
Systematically extract maximum value from existing code — identify what's golden (high-value, well-designed), what's lead (resource-heavy, poorly optimized), and what's dross (dead weight). Then amplify the gold, transmute the lead, and remove the dross.
Systematically classify every element by its value contribution.
Value Classification:
+--------+---------------------------------------------------------+
| Gold | High value, well-designed. Amplify and protect. |
| Silver | Good value, minor imperfections. Polish. |
| Lead | Functional but heavy — poor performance, complex API. |
| | Transmute into something lighter. |
| Dross | Dead code, unused exports, vestigial features. |
| | Remove entirely. |
+--------+---------------------------------------------------------+
Expected: Every significant element classified with evidence. Gold elements are identified for protection during optimization. Lead elements are prioritized by impact.
On failure: If profiling tools aren't available, use static analysis: function complexity (cyclomatic), dependency count, and code size as proxies. If the codebase is too large, focus on the critical path first.
Protect and enhance the highest-value elements.
Expected: Gold and Silver elements are better tested, documented, and protected. No behavioral changes, only quality improvements.
On failure: If a "Gold" element reveals hidden problems during closer inspection, reclassify it. Better to be honest about value than to protect flawed code.
Transform heavy, inefficient elements into optimized equivalents.
Expected: Measurable improvement on the target value metric. Each transmuted element performs better than its Lead predecessor while maintaining identical behavior.
On failure: If a Lead element resists optimization within its current interface, consider whether the interface itself is the problem. Sometimes the transmutation requires changing how the element is called, not just how it's implemented.
Eliminate dead weight systematically.
Expected: The codebase is lighter. Bundle size, dependency count, or code volume measurably reduced. All tests still pass.
On failure: If removing an element breaks something, it wasn't dross — reclassify it. If dynamic references make it hard to verify usage, add temporary logging before deletion to confirm no runtime access.
Measure the overall improvement.
Expected: Measurable, documented improvement on the target value metric. The codebase is demonstrably more valuable than before.
On failure: If overall improvement is marginal, the original code may have been better than assumed. Document what was learned — knowing that code is already near-optimal is itself valuable.
athanor — Full four-stage transformation when chrysopoeia reveals the code needs restructuring, not just optimizationtransmute — Targeted conversion when a Lead element needs a paradigm shiftreview-software-architecture — Architecture-level evaluation that complements code-level chrysopoeiareview-data-analysis — Data pipeline optimization parallels code optimization