Documentation
Last updated: 22 June 2026What is Diet Code
Diet Code is a rule/instruction set that makes AI coding agents climb a YAGNI-first ladder before writing any code. Instead of reaching straight for a new dependency or abstraction, the agent checks whether the feature needs to exist, whether the standard library or a native platform feature already does it, whether an already-installed dependency covers it, and whether it can be done in one line — only then does it write the minimum code that works.
The ladder
- Does this need to exist? Speculative need = skip it and say so in one line. (YAGNI)
- Stdlib does it? Use it before reaching for anything else.
- Native platform feature? e.g.
<input type="date">over a picker library, CSS over JS. - Already-installed dependency? Use it. Never add a new one for what a few lines handle.
- Can it be one line? One line.
- Only then, write code. The least code that works — boring over clever.
Safety floor
Diet Code is never lazy about: input validation at trust boundaries, error handling that prevents data loss, security, accessibility, hardware calibration, and anything you explicitly request. The ladder only applies to incidental complexity — not to correctness or safety.
Installing — npm CLI
The fastest path for Cursor, Windsurf, Cline, and AGENTS.md-aware agents. Published on npm as @diet-code/cli.
npm install -g @diet-code/cli
cd my-project
dietcode init cursor # or agents, windsurf, cline
dietcode init claude # prints Claude plugin steps
dietcode doctor # verify installInstalling — Claude Code
Requires the public kendrekaran/dietcode repo on GitHub.
/plugin marketplace add kendrekaran/dietcode
/plugin install dietcodeInstalling — Cursor
npm install -g @diet-code/cli
dietcode init cursorManual alternative: copy .cursor/rules/dietcode.mdc from github.com/kendrekaran/dietcode into your project.
Installing — Codex
Clone github.com/kendrekaran/dietcode, add the .codex-plugin/ directory as a plugin, then invoke @dietcode, @dietcode-review, and @dietcode-help.
Installing — Copilot CLI
Clone github.com/kendrekaran/dietcode and point Copilot at the .github/plugin/ directory — it ships commands, skills, and hooks/copilot-hooks.json.
Installing — Windsurf, Cline, Kiro, and AGENTS.md agents
npm install -g @diet-code/cli
dietcode init windsurf # .windsurf/rules/dietcode.md
dietcode init cline # .clinerules/dietcode.md
dietcode init agents # AGENTS.mdKiro: copy .kiro/steering/dietcode.md from GitHub. OpenCode and Gemini also read AGENTS.md via dietcode init agents.
Modes
Switch modes with /dietcode lite|full|off, or just say "stop dietcode" / "normal mode" in the conversation.
- LITE (
/dietcode lite) — builds what's asked, and the agent names a lazier alternative in one line. Stdlib-first suggestions, but the ladder isn't enforced and speculative abstractions aren't blocked. - FULL (
/dietcode full, default) — the ladder is enforced before writing: stdlib and native first, then minimum code, and speculative abstractions are blocked. - OFF (
/dietcode off) — disabled. Your agent behaves exactly as it would without Diet Code.
Benchmarks
Across measured sessions, Diet Code reduces the amount of code written by 80–94%, cuts token cost by 47–77%, and produces generations 3–6× faster, by stopping the agent from reaching for dependencies or abstractions a project doesn't need.
Privacy
Diet Code is a rule/instruction file your AI agent reads locally. We never see, log, or store your source code, prompts, or conversations. See the Privacy Policy for details.
FAQ
How do I install it? Run npm install -g @diet-code/cli, then dietcode init <host>. Package: @diet-code/cli on npm.
Does Diet Code see my code or prompts? No — see Privacy above.
Will it skip validation, error handling, or security? No. The safety floor above is never skipped.
Which agents does it support? Claude Code, Cursor, Codex, Copilot CLI, Windsurf, Cline, Kiro, OpenCode, Gemini, and any AGENTS.md-aware agent.
Is the free tier actually usable, or a teaser? It's the full ladder behavior via the AGENTS.md rule and Cursor rule, in lite and full modes.
Support
Questions or issues: karankendreg@gmail.com