coding-standards
Skill4 starsChanged 3 months agoApache-2.0View on GitHub
Apply the repository's Python coding standards whenever creating, modifying, refactoring, fixing, or reviewing Python source code. Enforce repository configuration, project-specific data-contract, scoring, precision, async and observability requirements, modern typing, simple Pythonic design, authoritative contract migrations, minimum total complexity, and root-cause fixes. Use for any task that writes or changes Python files.
120 other projects use a version of this.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codetheir own version, first seen Nov 8, 2026
- lhbsaa/apex-unifiedtheir own version, first seen Nov 8, 2026
- ahmadvahidi/skill-atlastheir own version, first seen Nov 8, 2026
- n1kben/agentstheir own version, first seen Nov 8, 2026
- advait/effect-durable-agenttheir own version, first seen Nov 8, 2026
- shinpr/ai-coding-project-boilerplatetheir own version, first seen Nov 8, 2026
Used with
Projects with it also use everything-claude-code, everything-claude-code-conventions and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
InfopibeSkilleverything-claude-code
Also in 9 projects that use this
mryeastcodeSkilleverything-claude-code-conventions
Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.
Also in 8 projects that use this
niloykumarbarmanSkillagent-sort
Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.
Also in 8 projects that use this
tpavanipradeepSkillnextjs-turbopack
Next.js 16+ and Turbopack — incremental bundling, FS caching, dev speed, and when to use Turbopack vs webpack.
Also in 15 projects that use this
CodeWithBehnamSkilldmux-workflows
Multi-agent orchestration using dmux (tmux pane manager for AI agents). Patterns for parallel agent workflows across Claude Code, Codex, OpenCode, and other harnesses. Use when running multiple agent sessions in parallel or coordinating multi-agent development workflows.
Also in 17 projects that use this
InfopibeSkillinvestor-outreach
Draft cold emails, warm intro blurbs, follow-ups, update emails, and investor communications for fundraising. Use when the user wants outreach to angels, VCs, strategic investors, or accelerators and needs concise, personalized, investor-facing messaging.
Also in 22 projects that use this
- +1 more from Infopibe
Other versions120 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 120
- affaan-m/ECC★ 246ksame name
- dotnet/winforms★ 4.9ksame name
- zereight/gitlab-mcp★ 2.1ksame name
- xu-xiang/everything-claude-code-zh★ 1.9ksame name
- sjjian/openhare★ 816same name
- dmmulroy/skills★ 428same name
- nanvix/nanvix★ 318same name
- loulanyue/awesome-claude-notes★ 272same name
- shinpr/ai-coding-project-boilerplate★ 236same name
- kid-sid/claude-spellbook★ 190same name
110 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- architecture-remediationSkill
- attentionSkill
- classify-docSkill
- codebase-designSkill
- codebase-memory-mcpSkill
- codegraphSkill
- contract-ledgerSkill
- conventional-commitsSkill
- database-migrationsSkill
- deduplicate-codeSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- format-codeSkill
- github-issue-dependenciesSkill
- graphifySkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- implement-ticketSkill
- improve-codebase-architectureSkill
- project-delivery-managementSkill
- project-trackingSkill
- prototypeSkill
- repowiseSkill
- researchSkill
- resolving-merge-conflictsSkill
- review-architectureSkill
- review-specSkill
- setup-matt-pocock-skillsSkill
- spec-contractSkill
- spec-merge-cleanupSkill
- tddSkill
- teachSkill
- to-adr-docSkill
- to-docSkill
- to-specsSkill
- to-ticketsSkill
- triageSkill
- verify-architectureSkill
- verify-codeSkill
- verify-spec-closureSkill
- verify-specSkill
- verify-ticket-closureSkill
- verify-ticket-decompositionSkill
- wayfinderSkill
- wiki-lintSkill
- wiki-syncSkill
- wiki-synthesizeSkill
- writing-great-skillsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
76 rules. 0 are common, 70 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 104 edited versions we read keep these.
70
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Read applicable repository instructions such as AGENTS.md.
- Distinctive: line 21
Follow repository-configured Python, Ruff, Mypy, formatting, and testing rules over generic defaults in this skill.
- Very specific: line 22
Follow authoritative ADRs and docs/current/ sources when a coding rule depends on project architecture or semantics.
- Distinctive: line 24
Do not modify lint, formatting, typing, or test configuration merely to make code pass unless changing that policy is itself part of the …
- Distinctive: line 34
When changing domain, application, infrastructure, interface, persistence, runtime, or other contract boundaries, read:
- Distinctive: line 42
Follow current greenfield authority:
- Very specific: line 49
Do not treat legacy/v0_1/, quarantined historical documents, or a removed pre-greenfield contract inventory as current semantic authority.
- Distinctive: line 51
If a concrete representation, range, polarity, fallback meaning, authority meaning, or other material contract is not established by …
- Distinctive: line 57
When creating, modifying, or reviewing scoring code:
- Distinctive: line 68
If the exact semantics required by new scoring code are absent from current authority, treat that as a design gap rather than choosing a …
- Distinctive: line 80
Use modern built-in typing syntax supported by the configured Python version.
- Very specific: line 86
Treat # type: ignore as a last resort and specify the exact error code when required.
- Very specific: line 88
Do not use cast() merely to hide a legitimate type error.
- Distinctive: line 98
Do not introduce another model merely to satisfy this preference when an existing type already owns the concept.
- Very specific: line 106
Do not make pure deterministic domain calculations async when they perform no concurrent I/O or waiting.
- Distinctive: line 118
When creating or modifying an operational boundary, consult the applicable current observability and platform architecture documents.
- Distinctive: line 130
create parallel telemetry systems.
- Distinctive: line 132
create competing instrumentation ownership.
- Distinctive: line 134
consider operational behavior complete when required observability has been lost.
- Distinctive: line 144
Use repository-configured Ruff, formatting, and Mypy rules as the source of truth.
- Distinctive: line 146
Prefer clear, idiomatic Python over cleverness.
- Distinctive: line 150
Use names that communicate domain meaning:
- Distinctive: line 156
Do not encode incidental implementation details into names.
- Distinctive: line 178
Use context managers where appropriate.
- Distinctive: line 180
Do not impose per-call lifecycle management on long-lived resources intentionally owned elsewhere.
- Distinctive: line 190
Every abstraction, type, option, representation, execution path, dependency, indirection layer, and file carries maintenance cost.
- Distinctive: line 194
After understanding the real execution and data flow, evaluate these in order.
- Distinctive: line 196
Stop at the first rung that cleanly satisfies the requirement.
- Distinctive: line 200
If it serves only a speculative future requirement, do not implement it.
- Distinctive: line 206
Search for existing helpers, types, services, models, and patterns before creating another implementation.
- Distinctive: line 208
Do not duplicate behavior the repository already owns.
- Distinctive: line 212
Prefer clear built-ins and standard-library primitives.
- Distinctive: line 214
Do not replace obvious control flow with clever expressions merely to save lines.
- Distinctive: line 220
Do not add a dependency merely to avoid a few clear native lines.
- Distinctive: line 224
Prefer existing domain objects and straightforward control flow over new wrappers, helpers, configuration, or layers.
- Distinctive: line 228
Write only what the current requirement actually needs.
- Distinctive: line 230
If multiple solutions are equally correct, choose the one with fewer concepts and less machinery.
- Distinctive: line 234
Before finalizing, remove anything newly introduced that is not required.
- Distinctive: line 248
Do not use subtraction as justification for unrelated cleanup.
- Distinctive: line 256
Do not introduce an interface, factory, base class, strategy, adapter, registry, plugin point, hook, configuration option, or extension …
- Distinctive: line 262
Do not create wrappers, services, managers, adapters, or helpers that merely rename or forward an existing operation.
- Distinctive: line 272
If it only delegates, remove it.
- Distinctive: line 276
Do not introduce another DTO, model, wrapper, context object, enum, state container, or intermediate representation when an existing type …
- Distinctive: line 282
Treat file length as an attention signal, not a defect.
- Distinctive: line 284
Do not impose or satisfy arbitrary line-count limits unless repository configuration or an explicit requirement establishes one.
- Distinctive: line 297
When splitting, split along real domain, ownership, dependency, or behavioral boundaries.
- Distinctive: line 299
Do not split code merely to reduce line count when doing so would:
- Distinctive: line 302
create circular imports or unnecessary indirection.
- Distinctive: line 306
Prefer the smallest number of cohesive modules that make ownership and navigation clear.
- Distinctive: line 314
When ownership, an internal contract, an API, or an invariant changes:
- Distinctive: line 317
update every affected caller, implementation, protocol, adapter, fake, fixture, test, configuration surface, registry/bootstrap path, and …
- Distinctive: line 318
remove the superseded internal contract and representation in the same change.
- Distinctive: line 320
Do not preserve obsolete internal behavior by:
- Distinctive: line 328
If genuine compatibility is explicitly required, isolate it at the compatibility boundary, identify the authority requiring it, and keep …
- Distinctive: line 330
If the correct implementation is blocked by unresolved architecture or an external requirement, surface the blocker.
- Distinctive: line 336
Before fixing shared behavior:
- Distinctive: line 343
Prefer one root-cause correction over repeated downstream guards.
- Distinctive: line 351
Do not scatter defensive checks for impossible internal states.
- Distinctive: line 363
Do not narrate mechanics already clear from the code.
- Distinctive: line 367
Use docstrings to preserve non-obvious semantic information, not to satisfy a documentation quota.
- Distinctive: line 380
Do not add docstrings that merely:
- Distinctive: line 388
Keep docstrings behavior- and contract-oriented so they remain valid when implementation details change.
- Distinctive: line 396
Do not add machinery merely to demonstrate SOLID, DRY, dependency injection, or another design pattern.
- Distinctive: line 408
Do not interpret this as one tiny operation per function.
- Distinctive: line 412
Do not pre-build extension mechanisms.
- Distinctive: line 414
Use polymorphism, protocols, strategies, or registries only when there are real implementations, an established extension boundary, …
- Very specific: line 428
Prefer composition over inheritance unless a genuine substitutable is-a relationship exists.
- Distinctive: line 434
Test behavior and contracts, not implementation details.
- Distinctive: line 443
Prefer existing test modules and infrastructure.
- Distinctive: line 453
Use integration tests when the real contract depends on wiring, persistence, component interaction, framework behavior, or an external …
- Distinctive: line 455
Do not distort production architecture merely to make everything unit-testable.
- Distinctive: line 459
When scoring behavior changes, verification must cover canonical score semantics and precision.
- Distinctive: line 461
When an operational boundary changes, verification must cover required observability through the established telemetry path.
- Distinctive: line 473
Do not duplicate issues that Ruff, Mypy, formatting, or tests already reliably detect.
- Distinctive: line 490
Never apply a textbook refactoring mechanically.
- Distinctive: line 498
Never simplify away required:
“Common” is measured: kept by at least 6 in 10 of the 104 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Coding Standards
Apply these standards whenever creating, modifying, refactoring, fixing, or reviewing Python source code.
Optimize for correct, readable, maintainable Python with the minimum total complexity necessary.
Scope and Precedence
These rules apply to Python source and tests.
Before changing code:
- Read applicable repository instructions such as
AGENTS.md. - Inspect relevant code, callers, tests, and established patterns.
- Inspect repository configuration such as
pyproject.toml,ruff.toml, andmypy.ini. - Follow repository-configured Python, Ruff, Mypy, formatting, and testing rules over generic defaults in this skill.
- Follow authoritative ADRs and
docs/current/sources when a coding rule depends on project architecture or semantics.
Do not modify lint, formatting, typing, or test configuration merely to make code pass unless changing that policy is itself part of the task.
A direct user requirement or documented repository rule overrides a design preference here. Required correctness, security, data integrity, domain contracts, scoring semantics, and observability are not optional simplifications.
Polaris Non-Negotiables
Contract Boundaries
When changing domain, application, infrastructure, interface, persistence, runtime, or other contract boundaries, read:
docs/current/platform-architecture-0.2.0.mdand the current Spec, accepted ADR/design source, or domain contract that owns the concrete semantics being changed.
Follow current greenfield authority:
- inward-owned ports express the semantics Polaris requires rather than mirroring vendor APIs;
- vendor, ORM, driver, transport, and other replaceable implementation types stay behind their owning adapter boundary unless current authority explicitly makes the representation semantic;
- externally sourced facts are normalized into Polaris-owned contracts with their required identity, time, provenance, and authority meaning;
- application/domain contracts remain independent of incidental runtime or infrastructure mechanics.
Do not treat legacy/v0_1/, quarantined historical documents, or a removed pre-greenfield contract inventory as current semantic authority.
If a concrete representation, range, polarity, fallback meaning, authority meaning, or other material contract is not established by current authority and reasonable implementations could differ materially, surface a design/authority gap instead of reviving a legacy rule or inventing one locally.
Score Semantics and Precision
The current greenfield architecture does not define one repository-wide canonical score-family table. Do not resurrect the retired pre-greenfield score inventory or infer score direction, range, sign, normalization, or meaning from a field name.
When creating, modifying, or reviewing scoring code:
- identify the current Spec/domain/ADR authority that owns the score or quantitative contract;
- preserve and validate that field's exact range, polarity, units, neutral/default meaning, and unresolved/fallback semantics;
- convert between materially different quantitative meanings only through an explicit formula whose intent is evident at the boundary.
Current product authority also requires:
- Portfolio Risk to remain multidimensional; a single generic Risk Score is not the universal Portfolio Risk representation (
PRT-006); - materially unknown Portfolio consequence or risk to remain unresolved rather than manufacturing precision (
PRT-012).
If the exact semantics required by new scoring code are absent from current authority, treat that as a design gap rather than choosing a legacy or conventional score family during implementation.
As a coding-policy precision rule, preserve full numerical precision internally. Use rounding only in human-facing presentation or where an explicit external contract requires fixed precision.
Changing established score semantics is a contract/design change, not a local implementation decision.
Typing and Internal Models
Type public functions and methods explicitly, including return types.
Type private interfaces when repository Mypy policy requires it or when doing so materially improves correctness.
Use modern built-in typing syntax supported by the configured Python version.
Represent nullable values honestly.
Contain Any at genuinely dynamic or untyped boundaries and narrow it before typed domain logic.
Treat # type: ignore as a last resort and specify the exact error code when required.
Do not use cast() merely to hide a legitimate type error.
Prefer:
@dataclass(frozen=True, slots=True)for immutable internal models when a dataclass is the appropriate representation.
Do not introduce another model merely to satisfy this preference when an existing type already owns the concept.
Async and Parallel Execution Boundaries
Polaris treats asynchronous I/O and multi-core execution as first-class runtime capabilities. Follow docs/current/platform-architecture-0.2.0.md and the accepted runtime-concurrency ADR for the governing execution model.
Use established asynchronous provider and client interfaces consistently. Do not introduce synchronous alternatives to canonical async boundaries, sync/async compatibility branches, or duplicate execution paths unless a real boundary requirement exists and is supported by the applicable architecture source. Do not preserve an incorrect synchronous path merely for compatibility.
Do not make pure deterministic domain calculations async when they perform no concurrent I/O or waiting. Keep async at boundaries that own waiting, orchestration, or concurrent I/O.
For CPU-bound work, choose the smallest execution mechanism that satisfies the real isolation and sharing requirements: free-threaded threads for safe shared-memory parallelism, subinterpreters for isolated in-process parallelism, and processes only when hard isolation or dependency constraints require them. Do not leak that mechanism into domain/application contracts.
No correctness guarantee may depend on the CPython GIL serializing access. Shared mutable state must have explicit ownership, synchronization, immutability, isolation, or another race-safe invariant that remains correct under genuinely parallel execution. Treat code that is only safe because ordinary CPython happens to serialize bytecode as defective.
When adding or changing runtime dependencies, concurrency-sensitive code, worker execution, or application bootstrap/import surfaces, preserve free-threaded compatibility and run the repository's free-threaded qualification gate. A dependency that re-enables the GIL makes the free-threaded target fail until the dependency or design is corrected or explicitly re-architected.
Observability
Observability is required operational behavior, not an optional enhancement.
When creating or modifying an operational boundary, consult the applicable current observability and platform architecture documents.
Preserve established conventions for applicable:
- structured logs;
- trace spans;
- trace-context propagation;
- metrics;
- failure visibility.
Do not:
- create parallel telemetry systems;
- duplicate lifecycle emission paths;
- create competing instrumentation ownership;
- bypass canonical telemetry boundaries;
- consider operational behavior complete when required observability has been lost.
Extend the canonical observability path instead of creating local alternatives.
Pure helpers and internal calculations do not need ceremonial telemetry. Instrument the operational boundary that owns the behavior.
Core Python Standards
Use repository-configured Ruff, formatting, and Mypy rules as the source of truth.
Prefer clear, idiomatic Python over cleverness.
Naming
Use names that communicate domain meaning:
snake_casefor functions, variables, methods, modules, and packages;PascalCasefor classes;UPPER_SNAKE_CASEfor module constants.
Do not encode incidental implementation details into names.
Exception Handling
Catch the narrowest exception the current layer can meaningfully handle.
Do not:
- use bare
except:; - silently swallow failures;
- catch broad exceptions merely to continue;
- turn failures into misleading success values;
- log an exception and then pretend the operation succeeded.
A deliberate except Exception is appropriate only at a genuine boundary that owns failure reporting, translation, cleanup, or isolation.
Preserve the original cause when translating exceptions where useful.
Resources
Give files, connections, transactions, locks, streams, and similar resources deterministic ownership and lifecycle.
Use context managers where appropriate.
Do not impose per-call lifecycle management on long-lived resources intentionally owned elsewhere.
Efficient Coding
The best code is the code never written.
Optimize for minimum total complexity, not minimum line count.
Every abstraction, type, option, representation, execution path, dependency, indirection layer, and file carries maintenance cost.
The Coding Ladder
After understanding the real execution and data flow, evaluate these in order.
Stop at the first rung that cleanly satisfies the requirement.
Does this need to exist at all?
If it serves only a speculative future requirement, do not implement it.
Apply YAGNI. Do not leave speculative hooks, TODOs, extension points, or scaffolding behind.
Does the codebase already solve it?
Search for existing helpers, types, services, models, and patterns before creating another implementation.
Do not duplicate behavior the repository already owns.
Does Python already express it directly?
Prefer clear built-ins and standard-library primitives.
Do not replace obvious control flow with clever expressions merely to save lines.
Does an installed dependency naturally own it?
Reuse an existing dependency when it eliminates meaningful custom logic without disproportionate coupling.
Do not add a dependency merely to avoid a few clear native lines.
Can the requirement be solved directly?
Prefer existing domain objects and straightforward control flow over new wrappers, helpers, configuration, or layers.
Only then write custom machinery.
Write only what the current requirement actually needs.
If multiple solutions are equally correct, choose the one with fewer concepts and less machinery.
Subtract Before Finishing
Before finalizing, remove anything newly introduced that is not required.
Ask:
- Did this duplicate something the codebase already owns?
- Did it create another representation of an existing concept?
- Is every new abstraction or layer performing meaningful work?
- Did obsolete behavior remain after being superseded?
- Does every input accepted by a changed internal contract still have real semantic effect?
- Did defensive validation spread beyond the boundary that owns it?
- Can the same behavior remain clear and correct with fewer concepts?
Simplify when the answer is yes.
Do not use subtraction as justification for unrelated cleanup.
Structural Design Rules
No Speculative Abstractions
Do not introduce an interface, factory, base class, strategy, adapter, registry, plugin point, hook, configuration option, or extension mechanism for hypothetical future consumers.
An abstraction must solve a current structural problem.
No Pass-Through Layers
Do not create wrappers, services, managers, adapters, or helpers that merely rename or forward an existing operation.
A layer should perform meaningful work such as:
- owning a domain responsibility;
- enforcing a real boundary;
- translating representations;
- applying policy or invariants;
- coordinating behavior that belongs together.
If it only delegates, remove it.
One Concept, One Representation
Do not introduce another DTO, model, wrapper, context object, enum, state container, or intermediate representation when an existing type already represents the concept adequately.
Convert representations at genuine boundaries.
File Size and Module Cohesion
Treat file length as an attention signal, not a defect.
Do not impose or satisfy arbitrary line-count limits unless repository configuration or an explicit requirement establishes one. A large cohesive module is preferable to several artificial micro-modules that scatter one responsibility.
Review a growing module for separation when size reveals structural evidence such as:
- multiple independently meaningful domain concepts;
- different sections changing for different reasons;
- clearly separate dependency or import clusters;
- tests naturally dividing into independent behavioral surfaces;
- substantial navigation burden when understanding one operation;
- a section that has earned a clear, purpose-specific module name of its own.
A module in the high hundreds of lines merits a cohesion review; crossing roughly 1,000 lines is a stronger review signal, not an automatic split requirement. Generated, declarative, table-driven, or tightly coupled state-machine modules may legitimately be larger.
When splitting, split along real domain, ownership, dependency, or behavioral boundaries.
Do not split code merely to reduce line count when doing so would:
- scatter one invariant or state transition across modules;
- create circular imports or unnecessary indirection;
- introduce vague
utils,helpers,common, ormiscmodules; - separate value objects or operations that are easier to understand together.
Prefer the smallest number of cohesive modules that make ownership and navigation clear.
Authoritative Contract Changes and Compatibility
Internal source compatibility is not a default Polaris requirement.
Compatibility exists only when an explicit user requirement, accepted architecture, versioned migration contract, or genuine external/public compatibility obligation requires it. Existing internal callers, tests, or implementation history do not by themselves establish a compatibility requirement.
When ownership, an internal contract, an API, or an invariant changes:
- make the authoritative layer correct first, even when downstream callers break;
- update every affected caller, implementation, protocol, adapter, fake, fixture, test, configuration surface, registry/bootstrap path, and other consumer;
- remove the superseded internal contract and representation in the same change.
Do not preserve obsolete internal behavior by:
- accepting and ignoring, discarding, overwriting, or neutralizing obsolete inputs;
- absorbing stale calls through
*argsor**kwargs; - retaining stale aliases, compatibility shims, wrappers, flags, or no-op parameters;
- maintaining parallel old/new execution paths;
- falling back to behavior that the authoritative contract replaced.
If genuine compatibility is explicitly required, isolate it at the compatibility boundary, identify the authority requiring it, and keep the canonical internal contract free of compatibility residue.
If the correct implementation is blocked by unresolved architecture or an external requirement, surface the blocker. Do not substitute a hack, workaround, bypass, compromise design, or silent behavioral degradation.
Root-Cause Fixes
A reported symptom is not necessarily the defect location.
Before fixing shared behavior:
- identify the violated invariant;
- inspect relevant callers;
- identify the layer that owns the invariant;
- fix the narrowest authoritative point.
Prefer one root-cause correction over repeated downstream guards.
Validate at Boundaries
Validate untrusted, serialized, external, or loosely typed data where it enters the trusted system.
Once an invariant is established, trust it internally unless the domain permits it to become invalid again.
Do not scatter defensive checks for impossible internal states.
Comments
Comments should explain non-obvious:
- constraints;
- invariants;
- tradeoffs;
- compatibility requirements;
- reasons.
Do not narrate mechanics already clear from the code.
Docstrings
Use docstrings to preserve non-obvious semantic information, not to satisfy a documentation quota.
A useful docstring may explain:
- domain meaning or business semantics;
- invariants, preconditions, or postconditions not evident from the signature;
- side effects or ownership boundaries;
- failure semantics that callers must understand;
- temporal, authority, trust, or concurrency behavior;
- a public API contract whose meaning is not obvious from names and types.
For public or domain-facing APIs, add a docstring when there is meaningful contract information that the signature, type hints, and name do not already communicate. For private helpers, add one only when the helper has a non-obvious invariant, algorithm, or behavioral contract worth preserving.
Do not add docstrings that merely:
- restate the function, class, or field name;
- paraphrase parameters already clear from names and type hints;
- narrate straightforward implementation mechanics;
- duplicate nearby comments or authoritative documentation;
- exist only to satisfy a docstring coverage metric.
Keep docstrings behavior- and contract-oriented so they remain valid when implementation details change.
Architecture Heuristics
Named design principles are heuristics, not abstraction quotas.
Do not add machinery merely to demonstrate SOLID, DRY, dependency injection, or another design pattern.
DRY
Centralize duplicated knowledge, policy, invariants, and business rules, not merely similar syntax.
A small amount of obvious syntactic duplication is cheaper than the wrong abstraction.
Responsibility
A function, class, or module should own one coherent responsibility.
Do not interpret this as one tiny operation per function. Keep sequential steps together when they form one domain operation.
Extensibility
Do not pre-build extension mechanisms.
Use polymorphism, protocols, strategies, or registries only when there are real implementations, an established extension boundary, repeated variation, or an explicit requirement.
Interfaces and Dependency Injection
Introduce abstract boundaries when they provide real value, such as:
- isolating infrastructure from domain logic;
- supporting multiple actual implementations;
- establishing a stable external boundary;
- replacing an unstable dependency;
- creating a necessary test seam.
Depending directly on a stable concrete implementation is acceptable when no meaningful abstraction boundary exists.
Prefer composition over inheritance unless a genuine substitutable is-a relationship exists.
Testing Expectations
Test behavior and contracts, not implementation details.
For non-trivial changed behavior, add the smallest number of tests necessary to prove:
- the required behavior; and
- its important failure boundary.
A defect fix should ordinarily include a focused regression test that would have failed before the fix.
Prefer existing test modules and infrastructure.
Avoid:
- elaborate fixture hierarchies;
- unnecessary mocks;
- redundant permutations;
- ceremonial tests;
- production abstractions created solely for unit-test convenience.
Use integration tests when the real contract depends on wiring, persistence, component interaction, framework behavior, or an external boundary.
Do not distort production architecture merely to make everything unit-testable.
For procedural testing workflow, use the applicable $tdd, $verify-code, or $verify-spec skill rather than duplicating those workflows here.
When scoring behavior changes, verification must cover canonical score semantics and precision.
When an operational boundary changes, verification must cover required observability through the established telemetry path.
Code-Smell Review
Smells are diagnostic signals, not automatic violations.
Repository architecture and explicit standards take precedence.
Smells are Advisory by default unless a documented rule makes the condition a violation.
Do not duplicate issues that Ruff, Mypy, formatting, or tests already reliably detect.
Watch for:
- Mysterious Name — names conceal domain intent.
- Duplicated Code — the same knowledge or business rule has multiple owners.
- Feature Envy — behavior appears to belong with another component's state.
- Data Clumps — a repeated value group may represent a real domain concept.
- Primitive Obsession — primitives repeatedly reconstruct meaningful domain invariants.
- Repeated Switches — repeated dispatch may indicate fragmented ownership.
- Shotgun Surgery — one concept requires changes across many unrelated locations.
- Divergent Change — one module owns unrelated reasons to change.
- Speculative Generality — abstractions exist for requirements that do not.
- Message Chains — callers navigate another component's internal structure.
- Middle Man — a layer delegates without adding meaningful responsibility.
- Refused Bequest — inheritance does not satisfy true substitutability.
Never apply a textbook refactoring mechanically.
Refactor only when the result is simpler and more correct for the actual system.
Required Correctness
Never simplify away required:
- trust-boundary validation;
- authentication or authorization;
- security and accessibility controls;
- transaction, rollback, concurrency, or idempotency behavior;
- domain invariants;
- external contracts;
- canonical data-contract semantics;
- canonical score semantics;
- numerical precision;
- observability;
- explicitly required architecture.
The goal is not the smallest diff or fewest lines.
The goal is the smallest correct resulting system.
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.

