clean-principles
AGENTS.md0 starsChanged 29 days agoMITView on GitHub
STATUS: ALWAYS ACTIVE ON EVERY PROMPT & CODE TASK This ruleset governs all code generation, refactoring, architecture, and review across every session. Never drift back to unprincipled, bloated, or unverified code. Stop and ask before writing code when requirements are ambiguous. - Trigger words: "simple", "quick", "basic", "clean", "proper", "production-ready". - Action: Ask 1 targeted clarifying question to disambiguate scope before writing code, OR explicitly state the minimal assumptions chosen before providing code. Read skills/clarify-before-build/SKILL.md. - Prevent over-engineering: Never assume…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .cursor/rules/clean-principles.mdcCursor rule
- architecture-principlesSkill
- clarify-before-buildSkill
- clean-codeSkill
- design-patternsSkill
- dry-kiss-yagniSkill
- solid-principlesSkill
- testing-principlesSkill
The file
We split this AGENTS.md into the rules it gives an agent
8 rules. About 0 are common, 4 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Action: Ask 1 targeted clarifying question to disambiguate scope before writing code, OR explicitly state the minimal assumptions chosen …
- Distinctive: line 13
Prevent over-engineering: Never assume "production-ready" justifies adding unrequested frameworks, complex layers, or unneeded dependencies.
- Very specific: line 21
No boolean flag parameters: Never pass process(true). Use two named functions (processSync() / processAsync()).
- Distinctive: line 22
Small & focused: Keep functions small enough to understand in one glance.
- Distinctive: line 56
No commented-out code: Delete dead code immediately.
- Very specific: line 59
Specific exception handling: Always catch specific exceptions.
- Very specific: line 88
Do not rely on memory or general LLM training weights: When a task enters any of the following domains, the agent MUST read the …
- Distinctive: line 109
Before completing any code generation or edit, verify:
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Clean Principles — Active Coding Standards & Quality Gates
STATUS: ALWAYS ACTIVE ON EVERY PROMPT & CODE TASK This ruleset governs all code generation, refactoring, architecture, and review across every session. Never drift back to unprincipled, bloated, or unverified code.
1. Ambiguity Gate (Clarify Before Build)
Stop and ask before writing code when requirements are ambiguous.
- Trigger words:
"simple","quick","basic","clean","proper","production-ready". - Action: Ask 1 targeted clarifying question to disambiguate scope before writing code, OR explicitly state the minimal assumptions chosen before providing code. Read
skills/clarify-before-build/SKILL.md. - Prevent over-engineering: Never assume "production-ready" justifies adding unrequested frameworks, complex layers, or unneeded dependencies.
2. Functions & Methods
- ≤ 3 parameters: Any function requiring > 3 parameters must use a parameter object, options map, or dataclass.
- One responsibility (SRP): One task per function. If you need "and" to describe what it does, split it.
- No boolean flag parameters: Never pass
process(true). Use two named functions (processSync()/processAsync()). - Small & focused: Keep functions small enough to understand in one glance.
- No hidden side effects: Functions do what their name promises and nothing else.
3. File Sizing & Modularity
- ≤ 300 lines per file (soft limit 200, hard limit 400) — split larger files into cohesive modules.
- Avoid junk-drawer files (
utils.ts,helpers.py,Common.java).
4. Human-Readable Code (Senior 10+ YoE Mindset)
- Write for humans first, compiler second — optimize for the engineer on-call at 2 AM.
- Guard clauses over nested
if/else— return early on invalid conditions (max indentation level ≤ 2). - No clever one-liners — split complex expressions into obvious, named steps.
- Self-documenting conditionals — encapsulate predicates into named booleans/functions.
- Command-Query Separation (CQS) — never mutate state inside getters/queries.
5. Naming Standards
- Intention-revealing:
elapsedDaysnotd,isUserActivenotflag. - Functions = Verb phrases:
calculateTotal(),sendEmail(),validateInput(). - Classes = Noun phrases:
UserAccount,OrderProcessor,InvoiceGenerator. - No cryptic abbreviations: Standard acronyms (
url,id,api) are fine; avoidusrActFlgorctxObj.
6. Code Quality & Hygiene
- No magic numbers or strings: Extract to named constants (
MAX_RETRIES = 3,DEFAULT_TIMEOUT_MS = 5000). - No commented-out code: Delete dead code immediately; version control preserves history.
- Comments explain WHY, not WHAT: The code explains what is happening; comments explain non-obvious rationale or trade-offs.
- No null/nil/None returns for collections: Return empty arrays/lists/sets/maps instead.
- Specific exception handling: Always catch specific exceptions; never use bare
except:orcatch (Exception e).
7. Design & Architecture (SOLID · DRY · KISS · YAGNI)
- DRY: One single source of truth per business rule.
- KISS: Simple over clever. Simplicity requires justification before adding complexity.
- YAGNI: Build only what is requested right now. No speculative generalizations or premature wrappers.
- SOLID:
- Single Responsibility: One class/module = one reason to change.
- Open/Closed: Open for extension, closed for modification.
- Liskov Substitution: Subtypes must fulfill base type contracts without unexpected exceptions.
- Interface Segregation: Clients must not be forced to depend on interfaces they do not use.
- Dependency Inversion: High-level modules depend on abstractions, not concrete details.
8. Ecosystem Idioms & Conventions
- Adhere to the target language's idiomatic style — write native-feeling code, not transplanted paradigms.
- Follow framework & community standards (PSR-12/Laravel, PEP 8, Effective Go, React Rules of Hooks, Rust API Guidelines).
- Respect local toolchain configs (
tsconfig.json,phpstan.neon,.eslintrc,pyproject.toml). - Consistency over personal preference — existing codebase conventions always win.
9. Mandatory Full-Skill Reading (Read Full Skill When Needed)
Do not rely on memory or general LLM training weights. When a task enters any of the following domains, the agent MUST read the corresponding full SKILL.md using the file-reading tool (read_file, View, etc.) BEFORE generating code or making architectural decisions:
| Domain / Task Trigger | When to Read Full Skill | Relative File Path |
clarify-before-build | Requirements contain ambiguous scope words ("simple", "quick", "clean", "production-ready"). | skills/clarify-before-build/SKILL.md |
solid-principles | Designing/refactoring classes, interfaces, inheritance, or high coupling. | skills/solid-principles/SKILL.md |
architecture-principles | Designing system structure, service/module boundaries, layers, or hexagonal arch. | skills/architecture-principles/SKILL.md |
testing-principles | Writing, fixing, or designing unit/integration tests or test doubles. | skills/testing-principles/SKILL.md |
design-patterns | Evaluating or implementing design patterns (Factory, Strategy, Observer, Repository, etc.). | skills/design-patterns/SKILL.md |
dry-kiss-yagni | Eliminating duplication, over-engineering, unnecessary abstractions, or boilerplate. | skills/dry-kiss-yagni/SKILL.md |
clean-code | Naming, small functions, formatting, and readability refactors. | skills/clean-code/SKILL.md |
Rationalization Red Flags (STOP and READ the skill file):
- ❌ "I already know SOLID/KISS/YAGNI definitions" → The skills contain specific project contracts, smell checklists, and anti-patterns.
- ❌ "The task is small, so I can skip reading" → Small tasks are where premature abstractions and flag parameters slip in.
- ❌ "I will write code first and check the skill later" → Code written without the skill causes avoidable rework. Read first.
10. Pre-Output Verification Gate
Before completing any code generation or edit, verify:
- Does every function have ≤ 3 parameters?
- Is each function's purpose explainable in a single sentence?
- Are there magic numbers or unrequested abstractions?
- Is any file exceeding 300 lines or any function nested more than 2 levels deep?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

