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.
npx agentmods add agents/hculap/better-code/api-analyzergit clone --depth 1 https://github.com/hculap/better-codeWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00049 | $0.01095 |
| Opus 5 | $0.00024 | $0.00548 |
| Sonnet 5 | $0.00010 | $0.00219 |
| Haiku 4.5 | $0.00005 | $0.00110 |
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 yesterday.
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.
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:
- Find over-fetching (returning more data than needed)
- Identify under-fetching (requiring multiple requests for related data)
- Detect missing pagination on list endpoints
- Spot N+1 API calls from frontend
- Find inefficient endpoint design
- Identify missing caching headers
Analysis Process:
-
Detect API Type
- REST endpoints
- GraphQL schemas and resolvers
- tRPC procedures
- WebSocket handlers
-
Scan for Over-fetching
- Endpoints returning full objects when subset needed
- No field selection support
- Returning nested relations by default
- Large payloads without compression
-
Check Under-fetching
- Related data requiring separate requests
- Missing include/expand parameters
- Waterfall requests in frontend
- N+1 API calls (loop of fetch calls)
-
Review Endpoint Design
- Missing pagination on collections
- No cursor-based pagination for large sets
- Missing filtering capabilities
- Unbounded result sets
-
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() }
});
});
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.
- yesterday First seen · 159 lines · 49 tokens per session scan A 14a0fa771d4f
api-analyzer is an agent published in the GitHub repository hculap/better-code (2 stars, last pushed 7mo ago), licensed MIT. It adds 49 tokens to every session and 1,095 once invoked, about $0.0002 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-31.
Other agents, from other repositories
thoughts-analyzer
Extracts decisions and actionable insights from project history documents. Plans in thoughts/ contain problems, solutions, and reasoning - but mixed with exploration noise. Returns: what was decided, why, constraints identified, and whether conclusions are still valid. Filters noise, returns only high-value…
review-performance
Performance reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-performance with artifact paths. Hunts N+1s, missing indexes, memory bloat, and cross-tenant leakage by reading changed files and their query paths in full.
review-tests-rspec
RSpec test quality and coverage reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-tests-rspec in repos that test with RSpec. Reads the specs and the code they claim to cover in full — coverage in mention is not coverage in meaning.
review-ticket-delivery
Ticket-delivery reviewer for PR audits. Spawned by /rpi:review-pr as subagenttype rpi:review-ticket-delivery with artifact paths. Code-quality reviewers judge how the work was done; this one judges whether the work was done. Runs on every review; carries the always-on security sweep.
documcp-test
Write tests for DocuMCP following established patterns.
documcp-memory
Work with DocuMCP's Knowledge Graph memory system.