code-discipline

code-discipline is a cursor rule for Cursor from eliranpv11/code-discipline-skills. It costs 1,900 tokens per session, scanned A, original, MIT.

A set of coding practices for software that needs to stay correct and maintainable beyond its first working version.

In plain words
What is it for?
Use it when writing, reviewing, or refactoring production code.
Why use it?
It reduces fragile changes and hidden assumptions by requiring risks, alternatives, affected parts, and verifiable success criteria to be considered first.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when writing, reviewing, or refactoring production code.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/eliranpv11/code-discipline-skills/code-discipline
Install

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.

Clone the repo
git clone --depth 1 https://github.com/eliranpv11/code-discipline-skills

Made for: Cursor.

Wrote 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.

agentmods badge for code-discipline

README.md
[![agentmods](https://agentmods.dev/badge/rules/eliranpv11/code-discipline-skills/code-discipline/github.svg)](https://agentmods.dev/rules/eliranpv11/code-discipline-skills/code-discipline)
Your own site
<a href="https://agentmods.dev/rules/eliranpv11/code-discipline-skills/code-discipline"><img src="https://agentmods.dev/badge/rules/eliranpv11/code-discipline-skills/code-discipline/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.

agentmods 80×15 button for code-discipline

Your own site · 80×15
<a href="https://agentmods.dev/rules/eliranpv11/code-discipline-skills/code-discipline"><img src="https://agentmods.dev/badge/rules/eliranpv11/code-discipline-skills/code-discipline.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,900 This file is loaded in full into every session.
When invoked 1,900 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.01900 $0.01900
Opus 5.5 $0.00760 $0.00760
Sonnet 5.5 $0.00380 $0.00380
Haiku 4.5 $0.00190 $0.00190

Measured 1mo ago against content hash 77922a61bdcc, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

code-discipline 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.

.cursor/rules/code-discipline.mdc · 195 lines

How it starts

The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Code Discipline

A coding methodology for production systems that must last. Not a communication standard. Not an honesty protocol. Purely: how to write code well.

Tradeoff: This discipline biases toward correctness and simplicity over speed and cleverness. For throwaway scripts, apply judgment. For production code — apply everything.


Priority Order

Every technical decision is evaluated in this order:

  1. Stability
  2. Reliability
  3. Readability
  4. Maintainability
  5. Scalability
  6. Performance
  7. Elegance

The goal is not "it works" — it is "it works correctly and reliably one year from now."


1. Think Before Coding

Don't assume. Surface tradeoffs. Map blast radius.

Before writing any code, present all four:

  1. Working assumptions — what are you assuming to be true?
  2. Constraints and risks — what could go wrong?
  3. Multiple valid solutions? — if yes, stop and present options; do not choose independently
  4. Dependencies and blast radius — what else is affected by this change?

Rules:

  • If uncertain — ask, don't assume and proceed
  • If multiple interpretations exist — present them, don't pick silently
  • If a simpler approach exists — say so and push back
  • If information is missing — stop and ask; do not proceed without answers

2. Verify Reality Before Acting

Don't code from memory. The codebase is the source of truth.

Before writing or changing code:

  • Read the actual files involved. Don't work from a remembered shape.
  • Don't invent APIs, function names, type names, field names, environment variables, configuration keys, or imports.
  • Don't assume a pattern, helper, or utility exists unless you verified it in the repository.
  • Don't assume a third-party library behaves a certain way without checking its documentation or signature.
  • If you cannot find evidence in the codebase, say so explicitly: "I couldn't find this in the code" — and stop. Do not fill the gap from memory.

Read the full file on GitHub · 195 lines

Changes

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.

  1. 1mo ago First seen · 195 lines · 1,900 tokens per session scan A 77922a61bdcc

Subscribe to this mod's changes

code-discipline is a cursor rule published in the GitHub repository eliranpv11/code-discipline-skills (2 stars, last pushed 2mo ago), licensed MIT. It adds 1,900 tokens to every session, about $0.0076 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-31.