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/04-code-implementation-guidelinesgit 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.00546 | $0.00546 |
| Opus 5 | $0.00273 | $0.00273 |
| Sonnet 5 | $0.00109 | $0.00109 |
| Haiku 4.5 | $0.00055 | $0.00055 |
Grade A, and why
04-code-implementation-guidelines 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 — 59 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Development Guidelines
General
- Write correct, DRY, bug-free code — leave no TODOs.
- Prefer functional components and hooks; use TypeScript types/interfaces consistently.
- Use early returns to reduce nesting.
- Choose descriptive names for variables, functions, and components.
Typing
- Use strict TypeScript: avoid
any,unknown, and implicitany. - Prefer
interfaceovertypealiases, unless a type cannot be expressed with an interface. - Always type:
- Props
- State
- Event handlers
- Returned values
- Favor
readonlyandas constassertions for immutability and safety. - Narrow types when possible (e.g.,
'small' | 'medium' | 'large'instead ofstring). - Use utility types like
Partial,Pick,Omitthoughtfully to improve clarity and type safety.
Styling
- Use Tailwind CSS exclusively — do not use external CSS or styled-components.
- Use the
cnutility from@/utils/utilsfor conditional class names.- Avoid ternaries in className strings.
Naming Conventions
- kebab-case for file names (e.g.,
my-component.tsx). - camelCase for hooks and utility functions (e.g.,
useMyHook,formatDate). - Prefix event handlers with
handle(e.g.,handleSubmit,handleClick).
Testing & QA
- Write tests using Vitest.
- Cover critical paths, edge cases, and user-facing logic.
- Provide fallback UI and error boundaries where appropriate.
REST API Best Practices
Shared Types
- Define shared types in:
packages/types/src/index.ts - Use them:
- To serialize data in API routes (backend).
- To deserialize and validate data on the frontend.
- This ensures type safety and consistency across backend and frontend.
Statelessness
- REST APIs must be stateless:
- Each request must be self-contained.
- The server must not depend on in-memory or session state.
- Clients manage session (e.g., cookies, auth headers, tokens).
- Use headers or tokens to communicate user context, not prior API calls.
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 · 59 lines · 546 tokens per session scan A 6577ed50a65e
04-code-implementation-guidelines is a cursor rule published in the GitHub repository dafthunk-com/dafthunk (119 stars, last pushed 5d ago), licensed MIT. It adds 546 tokens to every session, about $0.0027 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-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.