From lattice
Facilitates structured conversation to define clean code principles for a repository, producing clean-code.md override for clean-code atom. Use for coding standards or quality rules.
npx claudepluginhub techygarg/lattice --plugin latticeThis skill uses the workspace's default tool permissions.
- **Output**: `.lattice/standards/clean-code.md` (or custom path from `.lattice/config.yaml` -> `paths.clean_code`)
Generates tailored Development Principles for CLAUDE.md by auto-detecting project structure, monorepo setup, tech stack including TypeScript, React, Python, Django, and user preferences via interactive questions.
Define and enforce coding standards that reduce cognitive load, prevent bugs, and make code maintainable. Use when establishing style guides or linting rules.
Applies universal code quality principles like KISS, DRY, single responsibility, descriptive naming, and clean code during writing or reviewing any code.
Share bugs, ideas, or general feedback.
.lattice/standards/clean-code.md (or custom path from .lattice/config.yaml -> paths.clean_code)mode: overlay): A slim document containing only sections that differ from the defaults. The clean-code atom reads its embedded defaults first, then applies this document's sections on top. This is the expected common case.mode: override): A comprehensive standalone document that fully replaces the atom's embedded defaults. For teams with fundamentally different coding standards.paths.clean_code in .lattice/config.yaml./assets/template.md for the full document structure, default content, and interview guidance commentsThis skill defines the rules of code craftsmanship -- how individual functions, classes, and modules should be written. It does not define architecture (that is the architecture-refiner) or domain modeling (that is the ddd-refiner). The boundaries:
Before starting the interview, check whether a custom document already exists:
.lattice/config.yaml -- does paths.clean_code point to a file?Look for signals that inform the conversation:
Share relevant findings with the user at the start: "I noticed your project has ESLint configured with max-complexity: 15 and uses Prettier for formatting. I'll use that as context."
If the project is new with no code, proceed with pure defaults as the starting point.
The first decision in the conversation. Present the three options:
"How would you like to define your clean code principles?
The defaults cover standard clean code practices well. Option 1 is recommended unless your coding standards are fundamentally different."
Map the choice:
mode: overlaymode: overrideThis should be fast. Many sections will be "keep as-is."
This is thorough. Every section gets attention and appears in the output.
Read ./assets/template.md and follow the <!-- INTERVIEW GUIDANCE: --> comments for each section. Those comments contain the specific questions to ask, probing questions, and what is customizable vs fixed.
Decisions in early sections affect later sections. When a user changes an early section, flag the dependent sections:
| Decision in | Affects | How |
|---|---|---|
| §1 -- SRP scope (classes vs functions-only) | §2 (extraction targets), §10 (checklist) | Functional codebases extract to functions only; class-based codebases also extract to classes |
| §2 -- Function size thresholds | §3 (complexity thresholds), §10 (checklist) | Shorter functions imply lower complexity budgets |
| §3 -- Complexity thresholds | §2 (function size) | Lower complexity limits may require stricter function size |
| §4 -- Naming conventions | §7 (comment necessity) | Better naming reduces the need for "what" comments |
| §5 -- Parameter design | §1 (SRP signals) | Long parameter lists often signal SRP violations |
| §8 -- Error handling strategy | §9 (testability patterns) | Result types vs exceptions change how error paths are tested |
When a dependency is triggered, inform the user: "Since you changed [X], we should also review [Y] -- it's affected by that decision."
For each of the 10 default sections:
For each of the 10 default sections:
mode: overlaydefaults.md exactly (the atom matches sections by heading)mode: overrideStrip all <!-- INTERVIEW GUIDANCE: --> comments from the output. The final document is a clean specification.
Determine output path:
.lattice/config.yaml exists and has paths.clean_code, use that path..lattice/standards/clean-code.md.Write the document:
.lattice/standards/ directory (and .lattice/ parent) if it does not exist.Update config:
.lattice/config.yaml does not exist, create it with:
paths:
clean_code: .lattice/standards/clean-code.md
.lattice/config.yaml exists but has no paths.clean_code, add the key. Preserve all existing content..lattice/config.yaml exists and already has the key, no config change needed.Confirm to user:
"Your clean code document has been written to [PATH] in [overlay|override] mode. The clean-code atom will now use it [on top of the defaults | instead of the defaults]."
Before writing the final document, verify:
defaults.md exactly (for section matching by the atom)<!-- INTERVIEW GUIDANCE: --> comments remainmode: overlay<!-- INTERVIEW GUIDANCE: --> comments remainmode: override.lattice/config.yaml) is correctly updated