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/04-code-implementation-guidelines)<a href="https://agentmods.dev/rules/dafthunk-com/dafthunk/04-code-implementation-guidelines"><img src="https://agentmods.dev/badge/rules/dafthunk-com/dafthunk/04-code-implementation-guidelines/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/04-code-implementation-guidelines"><img src="https://agentmods.dev/badge/rules/dafthunk-com/dafthunk/04-code-implementation-guidelines.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.00546 | $0.00546 |
| Opus 5.5 | $0.00218 | $0.00218 |
| Sonnet 5.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 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 — 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.
- 1mo ago 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 (137 stars, last pushed 1mo ago), licensed MIT. It adds 546 tokens to every session, about $0.0022 per session on Opus 5.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
cpp
Name methods (casing, etc) like "isvalid", "streamtext".
ai_docs
There is a folder called aidocs it contains useful resources for reference.
run-scripts
when running any thing in scripts dir do "uv run ".
turborepo
Turbo task-graph rationale, query graph primitives, and signed remote-cache key provisioning.
project-onboarding-rule
Automatically onboards existing projects into the AI-driven development workflow.
on-load-rule
This guide outlines the critical development principles for this Swift project.