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 rules/dafthunk-com/dafthunk/06-api-developmentgit clone --depth 1 https://github.com/dafthunk-com/dafthunkWhat 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.00000 | $0.00801 |
| Opus 5 | $0.00000 | $0.00400 |
| Sonnet 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 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 — 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.
- yesterday 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 (119 stars, last pushed 5d 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
on-load-rule
This guide outlines the critical development principles for this Swift project.
analyze-pr-changes
Comprehensive analysis of Pull Request changes.
project-rules
Cursor rule "project-rules" from Ahmet-Ruchan/ML-Engineer-RoadMap, covering 🏗️ 1. general structure, 🧩 2. technology stack, ⚙️ 3. core principles, 🗄️ 4. database rules and core tables.
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.