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.
git clone --depth 1 https://github.com/maccman/ai-monorepo-scaffoldWrote 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.
[](https://agentmods.dev/rules/maccman/ai-monorepo-scaffold/zod-json-parsing)<a href="https://agentmods.dev/rules/maccman/ai-monorepo-scaffold/zod-json-parsing"><img src="https://agentmods.dev/badge/rules/maccman/ai-monorepo-scaffold/zod-json-parsing/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.
<a href="https://agentmods.dev/rules/maccman/ai-monorepo-scaffold/zod-json-parsing"><img src="https://agentmods.dev/badge/rules/maccman/ai-monorepo-scaffold/zod-json-parsing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00856 | $0.00856 |
| Opus 5 | $0.00428 | $0.00428 |
| Sonnet 5 | $0.00171 | $0.00171 |
| Haiku 4.5 | $0.00086 | $0.00086 |
Grade A, and why
zod-json-parsing scanned grade A with 1 finding 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 11d 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
const response = await fetch(externalApi) How it starts
The opening of the file, as written. The whole thing — 163 lines — stays where its author put it; the contents beside it link to each section on GitHub.
JSON Parsing - MANDATORY Zod Validation
NEVER USE TYPE ASSERTIONS FOR JSON
VIOLATION EXAMPLES (DO NOT DO THIS):
// ❌ WRONG: Type assertion
const result = (await response.json()) as SomeType
// ❌ WRONG: Unsafe parsing
const body = await request.json()
const { field } = body
// ❌ WRONG: Any type
const data: any = await response.json()
CORRECT APPROACH - ALWAYS USE ZOD:
// ✅ CORRECT: Zod schema validation
const resultSchema = z.object({
success: z.boolean(),
data: z.string(),
})
const result = resultSchema.parse(await response.json())
// ✅ CORRECT: Request body parsing
const requestSchema = z.object({
retailerId: z.string().uuid(),
force: z.boolean().optional(),
})
const body = requestSchema.parse(await request.json())
MANDATORY PATTERNS
1. Define Zod Schema First
// Always define the schema before parsing
const apiResponseSchema = z.object({
message: z.string(),
data: z.array(
z.object({
id: z.string(),
name: z.string(),
}),
),
})
type ApiResponse = z.infer<typeof apiResponseSchema>
2. Parse with Error Handling
// Handle Zod validation errors gracefully
try {
const parsed = schema.parse(rawData)
return parsed
} catch (error) {
console.error('Validation failed:', error)
throw new Error('Invalid data format')
}
3. API Endpoint Pattern
export const POST: APIRoute = async ({ request }) => {
try {
// Define schema for request body
const requestSchema = z.object({
field1: z.string(),
field2: z.number().optional(),
})
// Parse with Zod (never type assertion)
const body = requestSchema.parse(await request.json())
// Use the validated data
const result = await businessLogic(body)
return new Response(JSON.stringify(result))
} catch (error) {
// Handle Zod validation errors
return new Response('Invalid request', { status: 400 })
}
}
4. External API Response Pattern
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.
- 11d ago First seen · 163 lines · 856 tokens per session scan A 16aefc495cc6
zod-json-parsing is a cursor rule published in the GitHub repository maccman/ai-monorepo-scaffold (304 stars, last pushed 10mo ago), licensed MIT. It adds 856 tokens to every session, about $0.0043 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
python--typescript-guide-cursorrules-prompt-file
Cursor rules for Python development with TypeScript guide integration.
django-python
Rules for writing Python services at PostHog (Python servers powered by the Django framework).
standard-nestjs-module-hierarchy
Establish a consistent NestJS module structure in the API application where each resource is encapsulated in its own module with proper hierarchical organization to enhance maintainability, scalabilit... .
nestjs
This guide provides opinionated, actionable best practices for building robust, scalable, and maintainable NestJS applications using TypeScript, emphasizing modern patterns and common pitfalls.
nestjs-best-practices
../../.claude/rules/nestjs-best-practices.md.
handle-rate-limiting-responses
Cursor rule "handle-rate-limiting-responses" from PaulJPhilp/EffectPatterns, covering handle rate limiting responses and example.