code-optimizer

A code-performance review that uses multiple specialist agents to search a project for common sources of slowness. It checks areas such as database queries, memory, algorithms, concurrency, network use, rendering, caching, and build settings.

In plain words
What is it for?
Use it to audit a codebase, detect performance anti-patterns, confirm findings in context, and propose optimizations.
Why use it?
It helps find performance problems systematically and reduces the chance that a review focuses only on the first issue noticed.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/open-gsd/gsd-pi/code-optimizer
Any agent
npx skills add open-gsd/gsd-pi --skill code-optimizer
Clone the repo
git clone --depth 1 https://github.com/open-gsd/gsd-pi

Made for: Claude Code, Codex.

Per session 94 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,734 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00094 $0.01734
Opus 5 $0.00047 $0.00867
Sonnet 5 $0.00019 $0.00347
Haiku 4.5 $0.00009 $0.00173

Measured 2d ago against content hash 32c7ad9351d0, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-optimizer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/resources/skills/code-optimizer/SKILL.md · 156 lines

How it starts

The opening of the file, as written. The whole thing — 156 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Optimizer

Parallel multi-agent code optimization audit. Spawn 13 specialist agents simultaneously, each hunting for a different class of performance problem using pattern-based detection.

Critical Principle: No Code Reading Before Analysis

Agents MUST NOT read source files before searching for patterns. Reading the code first causes anchoring bias — the agent accepts the existing implementation as "reasonable" and misses better alternatives. Instead, each agent:

  1. Read its assigned reference file from references/ to load detection patterns
  2. Use Grep/Glob to scan the codebase for anti-patterns
  3. For each finding, ONLY THEN read the surrounding context (5-10 lines) to confirm the issue
  4. Propose the optimal solution based on best practices, NOT based on the existing code

Workflow

Step 1: Detect Stack

Use Glob to identify the project's tech stack:

  • **/package.json → Node.js/JS/TS (check for React, Next.js, Express, etc.)
  • **/requirements.txt, **/pyproject.toml, **/setup.py → Python
  • **/go.mod → Go
  • **/Cargo.toml → Rust
  • **/pom.xml, **/build.gradle → Java
  • **/Gemfile → Ruby
  • **/Dockerfile → Docker
  • **/*.sql → SQL
  • **/webpack.config.*, **/vite.config.*, **/tsconfig.json → Build tools

Step 2: Spawn 13 Parallel Agents

Launch ALL agents simultaneously using the Agent tool. Each agent receives:

  • Its domain name and reference file path
  • The detected tech stack (so it can focus on relevant patterns)
  • The project root path
  • Instructions to NOT read code files, only Grep/Glob for patterns

Agent definitions (spawn all 13 in a single message):

# Agent Name Reference File Focus
1 Database & Queries references/database-queries.md N+1 queries, SELECT *, missing indexes, ORM misuse, connection pooling
2 Memory & Resources references/memory-resources.md Memory leaks, unclosed resources, large allocations, string concat in loops
3 Algorithmic Complexity references/algorithmic-complexity.md O(n^2) patterns, unnecessary iterations, wrong data structures for lookups
4 Concurrency & Async references/concurrency-async.md Sequential awaits, blocking in async, race conditions, unbounded concurrency
5 Bundle & Dependencies references/bundle-dependencies.md Heavy imports, unused deps, duplicate libs, missing lazy loading
6 Dead Code & Redundancy references/dead-code-redundancy.md Unused exports, commented code, dead branches, duplicate logic
7 I/O & Network references/io-network.md Sequential requests, missing batching, no dedup, missing compression
8 Rendering & UI references/rendering-ui.md Re-renders, missing virtualization, layout thrashing, animation perf
9 Data Structures references/data-structures.md Wrong structures, unnecessary copies, inefficient serialization
10 Error & Resilience references/error-resilience.md Missing timeouts, swallowed errors, no retries, no circuit breakers
11 Caching & Memoization references/caching-memoization.md Missing memoization, cache without invalidation, redundant API calls
12 Build & Compilation references/build-compilation.md Dev code in prod, missing optimization flags, slow tests, Docker issues
13 Security-Performance references/security-performance.md Crypto misuse, missing rate limiting, ReDoS, SQL injection vectors

Read the full file on GitHub · 156 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 156 lines · 94 tokens per session scan A 32c7ad9351d0

Subscribe to this mod's changes

code-optimizer is a skill published in the GitHub repository open-gsd/gsd-pi (1,179 stars, last pushed 2d ago), licensed MIT. It adds 94 tokens to every session and 1,734 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.