architecture-compass
Architectural thinking partner for an existing repository — scans the codebase, conducts a structured interview, agrees on…
Apply clean code principles when generating or modifying implementation code. Enforces function focus, naming clarity, complexity management, error handling, and self-documenting style. Use when the user mentions 'clean code', 'code quality', 'coding guidelines', or
Claude Code
$ npx -y skills add techygarg/lattice --skill clean-code --agent claude-code
Codex
$ npx skills add techygarg/lattice --skill clean-code -a codex -y
Cursor
$ npx skills add techygarg/lattice --skill clean-code -a cursor -y
Gemini CLI
$ npx skills add techygarg/lattice --skill clean-code -a gemini-cli -y
GitHub Copilot
$ npx skills add techygarg/lattice --skill clean-code -a github-copilot -y
OpenCode
$ npx skills add techygarg/lattice --skill clean-code -a opencode -y
Windsurf
$ npx skills add techygarg/lattice --skill clean-code -a windsurf -y
name: clean-code description: "Apply clean code principles when generating or modifying implementation code. Enforces function focus, naming clarity, complexity management, error handling, and self-documenting style. Use when the user mentions 'clean code', 'code quality', 'coding guidelines', or 'implementation quality'. Loaded automatically by the code-generating molecules (code-forge, refactor-safely, bug-fix). This skill governs the craft of writing individual code units -- not architecture (see architecture), not security posture (see secure-coding), not test structure (see test-quality), and not refactoring workflows (see refactor-safely)."
Projects can customize this skill's standards. Resolution order:
1. Read `.lattice/config.yaml` in the repo root. 2. If found, check `paths.clean_code` for a custom document path. 3. If a custom document exists at that path, read it and check its YAML frontmatter for `mode`:
4. If a custom path is configured but no document exists at it → tell the user which configured path is missing, then fall back to `./references/defaults.md`. 5. If there is no config file or no `paths.clean_code` key, read `./references/defaults.md`. 6. **Language adaptation**: if `paths.language_idioms` is set in the config and the document exists, read it and adapt the defaults using these sections:
**STOP after generating each component. Verify ALL checks. Fix every failed check before presenting. Judgment calls → present options (see Ambiguity Signals).**
1. **SINGLE RESPONSIBILITY**: Can you describe each function without "and"? If not → extract a separate function. 2. **SIZE**: Is each function under the size threshold from the loaded doc (~20 lines default)? If not → extract a sub-operation into its own named function. 3. **COMPLEXITY**: Is cyclomatic complexity under the threshold from the loaded doc (~10 default)? If not → flatten with a guard clause or extract a branch. 4. **ABSTRACTION LEVEL**: Does each function operate at one level of abstraction? If high-level logic mixes with low-level detail → extract the detail. 5. **NAMING**: Does each function/variable name reveal intent without needing surrounding context? If not → rename to be self-documenting. 6. **PARAMETERS**: Is the parameter count under the threshold from the loaded doc (4 default)? If not → group parameters into an object. 7. **PRIMITIVE OBSESSION**: Would a string/number/boolean be clearer as a named type? If so → introduce a parameter object or typed wrapper. 8. **ERROR HANDLING**: Does every fail-able operation have explicit handling with an actionable message? Is it handled at the right level?
**Project-specific checks**: if the loaded doc (from Config Resolution) contains a Validation Checklist section (§10 from the clean-code-refiner template), apply those checks as additional project-specific validation after the checklist above.
All checks pass → state "Passes clean-code. [next step]."
After the checklist, scan for each of these. Any box you can check → fix before presenting.
Multiple valid outcomes exist. Present the options rather than silently choosing. If `framework:collaborative-judgment` is loaded, use its presentation format. See `./references/defaults.md` for resolution guidance on each signal below.
Composable AI skills that teach assistants structured thinking — design-first, context-aware, and architecture-guided.
Architectural thinking partner for an existing repository — scans the codebase, conducts a structured interview, agrees on…
Facilitate a structured conversation to define architecture principles for a repository. Supports multiple architecture styles:…
Enforce architectural rules when generating or modifying code, and validate proposed designs before approval (design mode).…
Investigate, reproduce, and safely fix a bug with regression protection. Composes context, diagnosis, architecture, code quality,…
Facilitate a structured conversation to define clean code principles for a repository. Produces a formal clean-code.md document…
Generate implementation code from an approved design blueprint or verbal requirements. Composes context anchoring, architecture,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.