performance-patterns

performance-patterns is a skill for Claude Code from hculap/better-code. It costs 61 tokens per session (1,211 once invoked), scanned A, original, MIT.

A reference for finding and fixing common sources of slow software, such as repeated database queries, unnecessary data fetching, and oversized bundles.

In plain words
What is it for?
Use it when optimizing database queries, API calls, frontend rendering, backend code, or bundle size.
Why use it?
It explains how these problems arise and gives matching repair patterns, helping developers diagnose performance issues.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the n1-optimizer plugin — 1 skill, 1 command, 4 agents shipped together

Good fit Use it when optimizing database queries, API calls, frontend rendering, backend code, or bundle size.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hculap/better-code/performance-patterns
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.

Any agent
npx skills add hculap/better-code --skill performance-patterns
Clone the repo
git clone --depth 1 https://github.com/hculap/better-code

Made for: Claude Code.

Or install n1-optimizer, the plugin that ships this one along with the rest of its 1 skill, 1 command, 4 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for performance-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/hculap/better-code/performance-patterns/github.svg)](https://agentmods.dev/skills/hculap/better-code/performance-patterns)
Your own site
<a href="https://agentmods.dev/skills/hculap/better-code/performance-patterns"><img src="https://agentmods.dev/badge/skills/hculap/better-code/performance-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for performance-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/hculap/better-code/performance-patterns"><img src="https://agentmods.dev/badge/skills/hculap/better-code/performance-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,211 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00061 $0.01211
Opus 5.5 $0.00024 $0.00484
Sonnet 5.5 $0.00012 $0.00242
Haiku 4.5 $0.00006 $0.00121

Measured 1mo ago against content hash e97082d1ee56, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

performance-patterns 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 1mo 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.

plugins/n1-optimizer/skills/performance-patterns/SKILL.md · 164 lines

How it starts

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

Performance Anti-Patterns Reference

N+1 Query Problem

The N+1 problem occurs when code executes N additional queries to fetch related data for N items from an initial query.

Identification:

  • Queries inside loops
  • Lazy loading of associations during iteration
  • GraphQL resolvers fetching per-item

Fix Strategies:

  1. Eager Loading: Load related data in initial query
  2. Batching: Collect IDs, fetch all at once
  3. DataLoader: For GraphQL, batch and cache per-request
  4. Denormalization: Store computed/related data together

Severity: HIGH - Scales linearly with data size, causes exponential slowdown

Over-Fetching

Retrieving more data than needed from API or database.

Identification:

  • SELECT * queries
  • API endpoints returning full objects
  • No field selection support
  • Loading nested relations by default

Fix Strategies:

  1. Field Selection: Only query needed columns
  2. Sparse Fieldsets: Support ?fields=id,name parameter
  3. GraphQL: Let clients specify exact fields
  4. DTOs: Map to response-specific objects

Severity: MEDIUM - Increases bandwidth, memory, serialization time

Under-Fetching

Requiring multiple requests to get needed data.

Identification:

  • Waterfall requests (request depends on previous)
  • Multiple endpoints for related data
  • No include/expand support

Fix Strategies:

  1. Compound Endpoints: /users?include=orders
  2. GraphQL: Single query for nested data
  3. BFF Pattern: Backend aggregates for frontend
  4. Parallel Requests: When dependencies allow

Severity: MEDIUM - Increases latency, connection overhead

Missing Pagination

Returning unbounded result sets.

Identification:

  • List endpoints without limit
  • findAll() without pagination
  • No cursor for large datasets

Fix Strategies:

  1. Offset Pagination: ?page=1&limit=20
  2. Cursor Pagination: ?cursor=abc&limit=20 (better for large sets)
  3. Default Limits: Always apply max limit server-side
  4. Streaming: For very large exports

Read the full file on GitHub · 164 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. 1mo ago First seen · 164 lines · 61 tokens per session scan A e97082d1ee56

Subscribe to this mod's changes

performance-patterns is a skill published in the GitHub repository hculap/better-code (2 stars, last pushed 13d ago), licensed MIT. It adds 61 tokens to every session and 1,211 once invoked, about $0.0002 per session on Opus 5.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-31.

Related

Other skills, from other repositories

audit-dead-code

Read-only hunt for dead and unused code across four labeled lanes (Knip for TS/JS, vulture for Python, gopls for Go, grep for shell and files no lane owns), each candidate adjudicated dead, uncertain or alive. Use when asked to 'find dead code', to find what is unused in a repository (exports, functions, orphaned…

melodic-software/claude-code-plugins · 99 tokens

devils-advocate

Stress-test plans and proposals via systematic adversarial review. Assumption extraction, evidence check, failure scenarios, operational gotchas. Before implementation begins. Use when: asked to attack a plan or proposal ('devil's advocate', 'stress test', 'poke holes', 'what could go wrong'), or before implementation…

melodic-software/claude-code-plugins · 139 tokens

known-issues

Lookup and tracking of known Claude product issues: GitHub bug search, service health and model quality checks, and a persistent registry of tracked issues. Use when: 'is this broken', 'any workarounds', 'troubleshoot Claude Code', 'feature behaves unexpectedly', 'scan repo for issues', 'file a bug'. Actions: status…

melodic-software/claude-code-plugins · 86 tokens

diagnose

Diagnose unexpected behavior from Claude Code's built-in computer-use MCP server (desktop screen control). Use when: 'computer use', 'control my screen', 'screenshot is blurry', 'why is the screenshot low resolution', 'zoom in on the screen', 'screenshot capture failed', 'empty capture', 'clicks are landing in the…

melodic-software/claude-code-plugins · 184 tokens

target

Identify and rank optimization targets by evidence quality, so an unmeasured system yields 'instrument this first' instead of a guess. Accepts session pain, a named path, telemetry, or open-ended 'what is slow here'. Use when: 'what should we optimize', 'find the bottleneck', 'this feels slow', 'is X worth…

melodic-software/claude-code-plugins · 102 tokens

drive

Launch and operate the project's app, observe it and record evidence, without judging it. Actions: drive a feature, ready (what is reachable), capture one artifact, cleanup. Use when another skill, a scheduled run or a CI job needs the real app run and shown (/verification:confirm, /debugging:debug), or when asked to…

melodic-software/claude-code-plugins · 92 tokens