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/dafthunk-com/dafthunkWrote 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/dafthunk-com/dafthunk/06-api-development)<a href="https://agentmods.dev/rules/dafthunk-com/dafthunk/06-api-development"><img src="https://agentmods.dev/badge/rules/dafthunk-com/dafthunk/06-api-development/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/dafthunk-com/dafthunk/06-api-development"><img src="https://agentmods.dev/badge/rules/dafthunk-com/dafthunk/06-api-development.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.00000 | $0.00801 |
| Opus 5.5 | $0.00000 | $0.00320 |
| Sonnet 5.5 | $0.00000 | $0.00160 |
| Haiku 4.5 | $0.00000 | $0.00080 |
Grade A, and why
06-api-development 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.
How it starts
The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.
REST API
Routing & Handler Structure
-
Define routes inline for simplicity
Avoid traditional "controller" layers. Use route handlers directly with Hono for better type inference and simpler structure.app.get('/books/:id', (c) => { const id = c.req.param('id'); return c.json({ id }); }); -
Modularize routes by feature
Useapp.route()to separate route logic into distinct modules.// routes/books.ts import { Hono } from 'hono'; const books = new Hono(); books.get('/', (c) => c.json(['book1', 'book2'])); books.get('/:id', (c) => c.json({ id: c.req.param('id') })); export default books; // main.ts import books from './routes/books'; const app = new Hono(); app.route('/books', books);
Type Safety & Validation with Zod
-
Use Zod for schema validation
Combinezodand@hono/zod-validatorfor strict runtime and compile-time validation.import { z } from 'zod'; import { zValidator } from '@hono/zod-validator'; const userSchema = z.object({ name: z.string(), }); app.post('/users', zValidator('json', userSchema), (c) => { const data = c.req.valid('json'); return c.json({ message: `Hello, ${data.name}` }); }); -
Always validate request bodies, query params, and route params to prevent runtime issues and improve DX.
Middleware Usage
-
Built-in Middleware
Use Hono's middleware for logging, CORS, etc.import { logger } from 'hono/logger'; import { cors } from 'hono/cors'; app.use('*', logger()); app.use('*', cors()); -
Custom Middleware for JWT and API key Auth (see auth.ts)
Authorization & Organization Scoping
- Authentication & Context Establishment:
- Authentication is handled by custom middleware detailed in
[auth.ts](mdc:apps/api/src/auth.ts). - This middleware supports both JWT (JSON Web Tokens) for user sessions and API Keys for programmatic access.
- Upon successful authentication, the middleware establishes the
organizationIdin the request context (e.g.,c.set("organizationId", ...)) based on the authenticated user or API key.
- Authentication is handled by custom middleware detailed in
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.
- 1mo ago First seen · 110 lines · 0 tokens per session scan A 05365f8d0af4
06-api-development is a cursor rule published in the GitHub repository dafthunk-com/dafthunk (137 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 801 tokens. 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.
Other cursor rules, from other repositories
dev
AIOX agent @dev - Full Stack Developer.
cpp
Name methods (casing, etc) like "isvalid", "streamtext".
contracts
Zod DTO and enum contract rules - shared vs local shapes, layers, naming and type inference, schema authoring, additive changes.
testing
Vitest toolchain and testing discipline - two runtimes, no watch for agents, authoring gate, junk patterns.
service-bindings
Worker-to-Worker RPC - bindings.worker() by name, WorkerEntrypoint callee, typed RPC deferred, requestId propagation.
boundaries
Package dependency boundaries - tag map and enforced invariants.