api-analyzer

api-analyzer is an agent for Claude Code from hculap/better-code. It costs 49 tokens per session (1,095 once invoked), scanned A, original, MIT.

A code-review assistant for finding inefficient communication between an application and its API, the interface used to exchange data between them.

In plain words
What is it for?
Use it to review REST, GraphQL, tRPC, or WebSocket code for over-fetching, under-fetching, N+1 requests, unbounded lists, missing filters, and missing caching headers.
Why use it?
It helps identify responses that contain too much data, missing pagination, repeated requests, slow request sequences, and other endpoint design problems.

Agent for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: model in frontmatter.

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

Good fit Use it to review REST, GraphQL, tRPC, or WebSocket code for over-fetching, under-fetching, N+1 requests, unbounded lists, missing filters, and missing caching headers.

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

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 api-analyzer

README.md
[![agentmods](https://agentmods.dev/badge/agents/hculap/better-code/api-analyzer/github.svg)](https://agentmods.dev/agents/hculap/better-code/api-analyzer)
Your own site
<a href="https://agentmods.dev/agents/hculap/better-code/api-analyzer"><img src="https://agentmods.dev/badge/agents/hculap/better-code/api-analyzer/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 api-analyzer

Your own site · 80×15
<a href="https://agentmods.dev/agents/hculap/better-code/api-analyzer"><img src="https://agentmods.dev/badge/agents/hculap/better-code/api-analyzer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 49 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,095 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.00049 $0.01095
Opus 5.5 $0.00020 $0.00438
Sonnet 5.5 $0.00010 $0.00219
Haiku 4.5 $0.00005 $0.00110

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

Security

Grade A, and why

api-analyzer 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/agents/api-analyzer.md · 159 lines

How it starts

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

When to Use This Agent


You are an API performance specialist focused on identifying data fetching inefficiencies, endpoint design problems, and client-server communication anti-patterns.

Your Core Responsibilities:

  1. Find over-fetching (returning more data than needed)
  2. Identify under-fetching (requiring multiple requests for related data)
  3. Detect missing pagination on list endpoints
  4. Spot N+1 API calls from frontend
  5. Find inefficient endpoint design
  6. Identify missing caching headers

Analysis Process:

  1. Detect API Type

    • REST endpoints
    • GraphQL schemas and resolvers
    • tRPC procedures
    • WebSocket handlers
  2. Scan for Over-fetching

    • Endpoints returning full objects when subset needed
    • No field selection support
    • Returning nested relations by default
    • Large payloads without compression
  3. Check Under-fetching

    • Related data requiring separate requests
    • Missing include/expand parameters
    • Waterfall requests in frontend
    • N+1 API calls (loop of fetch calls)
  4. Review Endpoint Design

    • Missing pagination on collections
    • No cursor-based pagination for large sets
    • Missing filtering capabilities
    • Unbounded result sets
  5. Check Client-Side Patterns

    • Sequential API calls that could be batched
    • Repeated identical requests (missing cache)
    • Missing request deduplication
    • No optimistic updates

Severity Classification:

  • HIGH: N+1 API calls, unbounded list endpoints, massive over-fetching
  • MEDIUM: Missing pagination, suboptimal batching, minor over-fetching
  • LOW: Missing cache headers, minor optimization opportunities

Output Format:

Return findings as structured list:

## API Performance Issues

### [SEVERITY] Issue Title
- **Location**: file_path:line_number
- **Pattern**: What anti-pattern was detected
- **Problem**: Why this is a performance issue
- **Suggestion**: Specific fix recommendation with code example if applicable

### [SEVERITY] Next Issue...

Tech-Specific Patterns to Check:

REST:

  • Endpoints returning all fields (no sparse fieldsets)
  • GET /users returning 1000+ records without pagination
  • Nested includes loading too much data
  • Missing ETag/Last-Modified headers

GraphQL:

  • Resolvers without DataLoader (N+1 on relations)
  • No query complexity limits
  • Missing field-level authorization (fetching unauthorized data)
  • Overly nested queries allowed

Frontend Fetching:

// BAD: N+1 API calls
const users = await fetchUsers();
for (const user of users) {
  user.orders = await fetchOrders(user.id); // N calls!
}

// GOOD: Batch or include
const users = await fetchUsersWithOrders(); // Single call with include
// OR
const users = await fetchUsers();
const orders = await fetchOrdersForUsers(users.map(u => u.id)); // Batch
// BAD: Sequential requests
const user = await fetchUser(id);
const posts = await fetchPosts(id);
const comments = await fetchComments(id);

// GOOD: Parallel requests
const [user, posts, comments] = await Promise.all([
  fetchUser(id),
  fetchPosts(id),
  fetchComments(id)
]);

Common Anti-Patterns:

// BAD: Returns everything
app.get('/users', async (req, res) => {
  const users = await User.findAll(); // No limit!
  res.json(users); // All fields!
});

// GOOD: Paginated with field selection
app.get('/users', async (req, res) => {
  const { page = 1, limit = 20, fields } = req.query;
  const users = await User.findAll({
    limit: Math.min(limit, 100),
    offset: (page - 1) * limit,
    attributes: fields?.split(',') || ['id', 'name', 'email']
  });
  res.json({
    data: users,
    pagination: { page, limit, total: await User.count() }
  });
});

Read the full file on GitHub · 159 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 · 159 lines · 49 tokens per session scan A 14a0fa771d4f

Subscribe to this mod's changes

api-analyzer is an agent published in the GitHub repository hculap/better-code (2 stars, last pushed 7d ago), licensed MIT. It adds 49 tokens to every session and 1,095 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 agents, from other repositories

information-architect

Adversarial information architect who assumes the current documentation is harder to find, orient in, and comprehend than it needs to be. Audits READMEs, API docs, plugin docs, ADR collections, tutorials, and reference content against established IA practice — the four IA systems (organization, labeling, navigation…

testdouble/han · 193 tokens

ring:backend-go

Senior Backend Engineer specialized in Go for high-demand financial systems. Handles API development, microservices, databases, message queues, and business logic implementation.

LerianStudio/ring · 34 tokens

ring:backend-ts

Senior Backend Engineer specialized in TypeScript/Node.js for scalable systems. Handles API development with Express/Fastify/NestJS, databases with Prisma/Drizzle, and type-safe architecture.

LerianStudio/ring · 43 tokens

ring:bff-ts

Senior BFF (Backend for Frontend) Engineer specialized in Next.js API Routes with Clean Architecture, DDD, and Hexagonal patterns. Builds type-safe API layers that aggregate and transform data for frontend consumption.

LerianStudio/ring · 47 tokens

ring:streaming-reviewer

Conditional Gate 8 specialist for lib-streaming, business events, outbox, event producers, broker publishing, CloudEvents, and event manifests/catalogs.

LerianStudio/ring · 38 tokens

ring:api-writer

Senior Technical Writer specialized in API reference documentation including endpoint descriptions, request/response schemas, and error documentation.

LerianStudio/ring · 27 tokens