Coding Discipline
Prime directive: clarity, safe change, bounded impact. Small localized
diffs. Investigate discoverable facts; ask when intent, authority, domain
semantics, or material impact remain unresolved.
Bias toward caution over speed. Use judgment on trivial tasks.
Project Fit Check
Before changing code:
- Read the repo's local instructions:
AGENTS.md, CLAUDE.md,
.cursor/rules/, README.md, contributing docs, or equivalents.
- Detect the package manager, formatter, linter, test runner, language level,
and branch/worktree conventions from project files before choosing commands.
- Match existing architecture, naming, test style, and error-handling patterns
in the touched area.
- If project rules conflict with this skill, follow the project rules and tell
the user about the trade-off when it matters.
- If expected agent docs are missing and the task is non-trivial, suggest
scaffold-harness or adapt to the repo's existing docs.
Think before coding
- State material assumptions explicitly.
- If multiple consequential interpretations remain after investigation, present
them with a recommendation - do not pick silently.
- Name simpler approaches and push back when warranted.
- Stop before the dependent change when uncertainty cannot be resolved safely.
Simplicity first
- Reuse the owning implementation or established repository pattern when it
already fits.
- Prefer the language standard library, native platform behavior, or an
installed dependency over new code or another dependency.
- Add only the minimum code for the requested problem. No speculative features,
abstractions, or configuration.
- Prefer correction, consolidation, or deletion over another layer.
- Do not simplify away input validation at trust boundaries, security,
accessibility, data integrity, necessary recovery, or error handling.
- Self-check: Would a senior engineer call this overcomplicated? If yes,
simplify.
End-to-end architecture
- Start from the product outcome, domain language, constraints, failure modes,
and required qualities. Frontend, backend, data, infrastructure, and
operations are one change system, not handoff departments.
- Treat languages, frameworks, database families, CQRS, and hexagonal or other
architecture styles as tools. Select them for the current context and
evidence, not as maturity badges.
- Keep user interfaces thin: presentation, interaction, local UI state, and
feedback stay close to the user; domain policy and durable decisions stay at
the strongest reusable boundary.
- Prefer task-shaped read models and intent-shaped mutation or command models
when generic CRUD or database repositories would hide domain language,
authorization, concurrency, transaction, or query semantics.
- Preserve cheap change through explicit boundaries and public contracts. Do
not pre-build speculative flexibility in the name of avoiding future
lock-in.
- When a material technology choice remains uncertain, run the smallest
disposable comparison with representative data shape and volume,
concurrency, failures, latency, memory, I/O, recovery, and operating cost.
Record the decision and discard the spike unless production hardening is an
explicit next investment.
Language
- Follow the target repository's language and audience rules.
- When no rule exists, preserve the language and terminology of the touched
area. Do not translate product copy, documentation, or tests incidentally.
Surgical changes
- Touch only what the request requires.
- One rule with several call sites is one unit of work. Fixing only the site the
request names leaves the rule half-applied. Extend the fix to its siblings and
say which ones, or name them when the extension is genuinely out of scope.
- Do not refactor, reformat, or "improve" adjacent code.
- Match existing style and patterns in the touched area.
- Unrelated dead code: mention it - do not delete unless asked.
- Remove only imports/symbols your diff made unused.
- Every changed line should trace to the user's request.
Goal-driven execution
| Request |
Success criteria |
| Add validation |
Tests for invalid inputs pass |
| Fix bug |
Failing test reproduces it, then passes |
| Refactor |
Tests pass before and after |
Multi-step work: brief plan as [Step] -> verify: [check].
TDD
Tests are design feedback, not a phase after implementation. Use vertical
slices - one behavior test, minimal implementation, repeat. Prefer the
harness-referenced or catalog coding-discipline Skill (or the consumer's
pinned release). Follow a project-local tdd Skill only when it is a thin
wrapper with real local deltas, not a duplicate of portable TDD.
- Test through public interfaces (API routes, package exports, user-visible behavior).
- Express each behavior with Given/When/Then semantics: preconditions and
context, one relevant stimulus, then an externally observable outcome. Use
the target framework's names and structure; comments or a GWT library are
not required.
- Name behavior in the target's domain language; keep examples, tests, code,
and public contracts aligned.
- Do not mock internals; do not test private helpers in isolation.
- Match test type to risk: unit for logic, integration/e2e for user flows (per
AGENTS.md).
- For a disposable spike whose purpose is learning, use a hypothesis, timebox,
and exit decision instead of pretending it is production code. Discard it or
restart the production slice from public behavior with tests.
Quality mindset
- Understand the problem before choosing a solution; assess value and risk
before estimating effort.
- For bugs, reproduce the failure, trace callers and shared ownership, and fix
the root cause at the narrowest common boundary.
- Quality at the start: acceptance criteria and tests - not late inspection.
- Readable over clever; abstractions only when they remove real complexity.
- Direct communication: name trade-offs, constraints, and next step.
Optional Complement
Use the upstream
ponytail Skill only when repeated
overengineering justifies a stronger implementation-style guardrail and the
target host has passed a representative pilot. It complements this workflow; it
does not override target instructions or the safeguards above.
Working signal
Fewer unnecessary diff lines, fewer rewrites from over-engineering, clarifying questions before implementation.
1---2name: coding-discipline3description: Enforces clarity, surgical diffs, simplicity, and goal-driven TDD for any codebase. Use when implementing features, fixing bugs, refactoring, or making any code change.4---56# Coding Discipline78**Prime directive:** clarity, safe change, bounded impact. Small localized9diffs. Investigate discoverable facts; ask when intent, authority, domain10semantics, or material impact remain unresolved.1112Bias toward caution over speed. Use judgment on trivial tasks.1314## Project Fit Check1516Before changing code:17181. Read the repo's local instructions: `AGENTS.md`, `CLAUDE.md`,19 `.cursor/rules/`, `README.md`, contributing docs, or equivalents.202. Detect the package manager, formatter, linter, test runner, language level,21 and branch/worktree conventions from project files before choosing commands.223. Match existing architecture, naming, test style, and error-handling patterns23 in the touched area.244. If project rules conflict with this skill, follow the project rules and tell25 the user about the trade-off when it matters.265. If expected agent docs are missing and the task is non-trivial, suggest27 **scaffold-harness** or adapt to the repo's existing docs.2829## Think before coding3031- State material assumptions explicitly.32- If multiple consequential interpretations remain after investigation, present33 them with a recommendation - do not pick silently.34- Name simpler approaches and push back when warranted.35- Stop before the dependent change when uncertainty cannot be resolved safely.3637## Simplicity first3839- Reuse the owning implementation or established repository pattern when it40 already fits.41- Prefer the language standard library, native platform behavior, or an42 installed dependency over new code or another dependency.43- Add only the minimum code for the requested problem. No speculative features,44 abstractions, or configuration.45- Prefer correction, consolidation, or deletion over another layer.46- Do not simplify away input validation at trust boundaries, security,47 accessibility, data integrity, necessary recovery, or error handling.48- Self-check: _Would a senior engineer call this overcomplicated?_ If yes,49 simplify.5051## End-to-end architecture5253- Start from the product outcome, domain language, constraints, failure modes,54 and required qualities. Frontend, backend, data, infrastructure, and55 operations are one change system, not handoff departments.56- Treat languages, frameworks, database families, CQRS, and hexagonal or other57 architecture styles as tools. Select them for the current context and58 evidence, not as maturity badges.59- Keep user interfaces thin: presentation, interaction, local UI state, and60 feedback stay close to the user; domain policy and durable decisions stay at61 the strongest reusable boundary.62- Prefer task-shaped read models and intent-shaped mutation or command models63 when generic CRUD or database repositories would hide domain language,64 authorization, concurrency, transaction, or query semantics.65- Preserve cheap change through explicit boundaries and public contracts. Do66 not pre-build speculative flexibility in the name of avoiding future67 lock-in.68- When a material technology choice remains uncertain, run the smallest69 disposable comparison with representative data shape and volume,70 concurrency, failures, latency, memory, I/O, recovery, and operating cost.71 Record the decision and discard the spike unless production hardening is an72 explicit next investment.7374## Language7576- Follow the target repository's language and audience rules.77- When no rule exists, preserve the language and terminology of the touched78 area. Do not translate product copy, documentation, or tests incidentally.7980## Surgical changes8182- Touch only what the request requires.83- One rule with several call sites is one unit of work. Fixing only the site the84 request names leaves the rule half-applied. Extend the fix to its siblings and85 say which ones, or name them when the extension is genuinely out of scope.86- Do not refactor, reformat, or "improve" adjacent code.87- Match existing style and patterns in the touched area.88- Unrelated dead code: mention it - do not delete unless asked.89- Remove only imports/symbols **your** diff made unused.90- Every changed line should trace to the user's request.9192## Goal-driven execution9394| Request | Success criteria |95| -------------- | --------------------------------------- |96| Add validation | Tests for invalid inputs pass |97| Fix bug | Failing test reproduces it, then passes |98| Refactor | Tests pass before and after |99100Multi-step work: brief plan as `[Step] -> verify: [check]`.101102## TDD103104Tests are design feedback, not a phase after implementation. Use vertical105slices - one behavior test, minimal implementation, repeat. Prefer the106harness-referenced or catalog `coding-discipline` Skill (or the consumer's107pinned release). Follow a project-local `tdd` Skill only when it is a thin108wrapper with real local deltas, not a duplicate of portable TDD.109110- Test through **public interfaces** (API routes, package exports, user-visible behavior).111- Express each behavior with Given/When/Then semantics: preconditions and112 context, one relevant stimulus, then an externally observable outcome. Use113 the target framework's names and structure; comments or a GWT library are114 not required.115- Name behavior in the target's domain language; keep examples, tests, code,116 and public contracts aligned.117- Do not mock internals; do not test private helpers in isolation.118- Match test type to risk: unit for logic, integration/e2e for user flows (per `AGENTS.md`).119- For a disposable spike whose purpose is learning, use a hypothesis, timebox,120 and exit decision instead of pretending it is production code. Discard it or121 restart the production slice from public behavior with tests.122123## Quality mindset124125- Understand the problem before choosing a solution; assess value and risk126 before estimating effort.127- For bugs, reproduce the failure, trace callers and shared ownership, and fix128 the root cause at the narrowest common boundary.129- Quality at the start: acceptance criteria and tests - not late inspection.130- Readable over clever; abstractions only when they remove real complexity.131- Direct communication: name trade-offs, constraints, and next step.132133## Optional Complement134135Use the upstream136[`ponytail`](https://github.com/DietrichGebert/ponytail) Skill only when repeated137overengineering justifies a stronger implementation-style guardrail and the138target host has passed a representative pilot. It complements this workflow; it139does not override target instructions or the safeguards above.140141## Working signal142143Fewer unnecessary diff lines, fewer rewrites from over-engineering, clarifying questions **before** implementation.