pattern-engineer-coding-standard
Skill0 starsChanged 5 months agoMITView on GitHub
Language-agnostic coding standards. Contract is iron: implement the task's `Done criteria`, `docs/api-contract/*`, `docs/data-model/*`, and binding ADRs verbatim — halt on ambiguity, never invent. Priority: Readability → KISS → DRY → YAGNI. Verb-noun names; immutable data by default; narrow error handling at boundaries; parallel-by-default async; strongest types (no `any`); AAA tests; files 200–400 lines; feature/refactor in separate commits. Activate when writing or reviewing source code.
In this repository74 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- create-bug-issueSkill
- create-enhancement-issueSkill
- create-feature-issuesSkill
- dream-summary-memorySkill
- memory-conventionSkill
- operation-gitSkill
- pattern-architect-api-endpointSkill
- pattern-architect-data-modelSkill
- pattern-architect-deep-moduleSkill
- pattern-e2e-coding-standardSkill
- pattern-engineer-apiSkill
- pattern-engineer-backend-standardSkill
- pattern-engineer-containerSkill
- pattern-engineer-databaseSkill
- pattern-engineer-fastapiSkill
- pattern-engineer-frontend-standardSkill
- pattern-engineer-goSkill
- pattern-engineer-javaSkill
- pattern-engineer-kotlinSkill
- pattern-engineer-nodeSkill
- pattern-engineer-non-functionalSkill
- pattern-engineer-observabilitySkill
- pattern-engineer-pythonSkill
- pattern-engineer-rustSkill
- pattern-engineer-securitySkill
- pattern-engineer-ssrSkill
- pattern-engineer-swiftSkill
- pattern-engineer-typescriptSkill
- pattern-engineer-viteSkill
- pattern-exploratory-testingSkill
- pattern-reviewer-apiSkill
- pattern-reviewer-backend-standardSkill
- pattern-reviewer-coding-standardSkill
- pattern-reviewer-containerSkill
- pattern-reviewer-contractSkill
- pattern-reviewer-databaseSkill
- pattern-reviewer-fastapiSkill
- pattern-reviewer-frontend-standardSkill
- pattern-reviewer-goSkill
- pattern-reviewer-javaSkill
- pattern-reviewer-kotlinSkill
- pattern-reviewer-nodeSkill
- pattern-reviewer-non-functionalSkill
- pattern-reviewer-observabilitySkill
- pattern-reviewer-pythonSkill
- pattern-reviewer-rustSkill
- pattern-reviewer-securitySkill
- pattern-reviewer-ssrSkill
- pattern-reviewer-swiftSkill
- pattern-reviewer-test-coverageSkill
- pattern-reviewer-typescriptSkill
- pattern-reviewer-viteSkill
- pattern-test-coverageSkill
- principle-engineer-tddSkill
- scaffold-projectSkill
- workflow-architect-interviewSkill
- workflow-designer-sample-pagesSkill
- workflow-design-interviewSkill
- workflow-e2e-authorSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 9 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
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 14
After loading this skill, also check $MAIN_ROOT/.claude/memory/patterns/pattern-engineer-coding-standard.md in the consuming project …
- Distinctive: line 32
Halt and surface on ambiguity: If the contract is missing for a touched endpoint / entity, or is internally contradictory, or contradicts …
- Distinctive: line 33
Disagreement is a question, not a code change: If the contract looks wrong, open a question on the task.
- Distinctive: line 35
No invented endpoints, fields, error codes, or columns: If the contract doesn't declare it, it doesn't exist in this change.
- Distinctive: line 47
YAGNI: No hypothetical-future complexity.
- Distinctive: line 57
Default to immutable data.
- Very specific: line 58
Prefer const / final / readonly over reassignable bindings.
- Very specific: line 59
Prefer map / filter / reduce over loops that mutate accumulators.
- Distinctive: line 60
Treat function parameters as read-only.
- Distinctive: line 68
Don't add fallbacks for scenarios that can't happen.
- Distinctive: line 73
Don't bundle a refactor with a feature change — submit them as separate commits / PRs.
- Very specific: line 77
Run independent async work in parallel: Promise.all, asyncio.gather, errgroup, tokio::join!
- Distinctive: line 84
Prefer compile-time guarantees over runtime checks.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill 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
pattern-engineer-coding-standard
When to activate
Activate when writing, editing, refactoring, or reviewing any source file or test in any language. Skip for pure formatting, comment-only edits, or conceptual questions.
Project memory overlay
After loading this skill, also check $MAIN_ROOT/.claude/memory/patterns/pattern-engineer-coding-standard.md in the consuming project (resolve MAIN_ROOT="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"). If present, load it as an additive overlay to the rules below; if absent, skip silently. See memory-convention for the full contract (additivity, severity floor, conflict surfacing).
Patterns
Contract is iron (non-negotiable)
Published contracts decide shape; this skill (and language-specific patterns) decide how to express it. Code conforms to the contract, never the reverse.
The contract = whichever of these apply to the change:
- The task issue's
Done criteria(acceptance) andScenarios(behavior) — the unit-of-work spec. docs/api-contract/<entity>.yamlfor any API resource touched — path (including trailing-slash spelling), HTTP verb, request body schema, response body schema, status codes per outcome, error envelope shape +codevalues,Idempotency-Keypolicy, rate-limit budget, versioning notes.docs/data-model/<entity>.yamlfor any persistence entity touched — table / collection names, column types, constraints, indexes.docs/architecture-decision-record/<adr>.mdfor any decision that constrains the change (referenced from the ADR index).
Rules:
- Implement the contract verbatim. Match names, shapes, status codes, types, and constraints exactly — including spelling, casing, and trailing-slash conventions.
- Halt and surface on ambiguity. If the contract is missing for a touched endpoint / entity, or is internally contradictory, or contradicts the task body — stop and ask. Do not invent shape to keep moving.
- Disagreement is a question, not a code change. If the contract looks wrong, open a question on the task. Never silently ship code that contradicts a published contract.
- Code may be stricter than the contract, never looser. A contract-declared
max_length: 100may be enforced more tightly only if the task asks for it; it may not be relaxed. - No invented endpoints, fields, error codes, or columns. If the contract doesn't declare it, it doesn't exist in this change.
- The contract files are READ-ONLY to you.
docs/api-contract/*anddocs/data-model/*are inputs you implement against — never outputs you edit. If the contract is genuinely wrong, missing a status code/field, or self-contradictory, that is an architect decision: do not patch it — halt tostatus:need-attentionwith a contract-change request (see theworkflow-engineer-*lanes).
This rule overrides the priority hierarchy below. Readability / KISS / DRY / YAGNI choose between conforming implementations — they never license a deviation from the contract.
Priority
Apply in this order when principles conflict (and only within contract-conforming options): Readability → KISS → DRY → YAGNI.
- Readability first. Code is read more than written.
- KISS. Simplest solution that works. No clever code when straightforward works.
- DRY. Extract on the third occurrence, not the first.
- YAGNI. No hypothetical-future complexity. Three similar lines beat a premature abstraction.
Naming
- Variables: descriptive, no abbreviations (
createdAt, notd). - Functions: verb-noun (
getUserById,validateEmail). - Booleans: predicates (
isActive,hasPermission,canEdit,shouldRetry).
Immutability
- Default to immutable data; mutation is opt-in.
- Prefer
const/final/readonlyover reassignable bindings. - Prefer
map/filter/reduceover loops that mutate accumulators. - Treat function parameters as read-only.
- Mutate only when measurably necessary (hot path, large data) and document why.
Error handling
- Validate at system boundaries (user input, external APIs). Never trust external data — schema-check before use. Trust internal callers.
- Catch the narrowest exception that applies.
- Re-raise with cause (
raise ... from e); don't swallow. - Don't add fallbacks for scenarios that can't happen.
File + change sizing
- Many small files > few large files: high cohesion, low coupling. Target 200–400 lines per file; treat 800 as the hard cap.
- Don't bundle a refactor with a feature change — submit them as separate commits / PRs. Tiny cleanups (rename, dead-import delete) inside a feature change are fine.
Async
- Run independent async work in parallel:
Promise.all,asyncio.gather,errgroup,tokio::join!. - Sequential
awaitonly when each step depends on the previous.
Types
- Strongest types the language offers. No
any, no untyped dicts where a struct fits. - Make illegal states unrepresentable (union types, enums, branded types).
- Prefer compile-time guarantees over runtime checks.
Tests
- AAA structure: Arrange, Act, Assert — three clear sections.
- Descriptive names that state the behavior, not the function (
returns null when user does not exist, notgetUser). - One behavior per test.
Code smells (flag and fix as they appear)
- Long functions (>30–50 lines or >1 responsibility) → extract sub-functions.
- Deep nesting (>2–3 levels of
if/for) → early returns / guard clauses. - Magic numbers / strings → named constants whose name explains the meaning.
console.log/printleft behind → remove before commit.- Dead code (commented-out, unused imports, unreachable branches) → delete.
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.

