skills/code-standards/SKILL.md
Generates or updates docs/code-standards.md by scanning the codebase for actual conventions. Produces an example-rich standards file optimized for LLM consumers, grounded in the project's real patterns.
npx skillsauth add ryanthedev/code-foundations code-standardsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate or update docs/code-standards.md — a project-specific conventions file optimized for LLM consumers.
LLMs default to training-data averages. Without project-specific guidance, they produce generic code that passes tests but fails review. This skill extracts the patterns that matter: concrete examples, forbidden patterns, and exemplar file pointers.
Check for existing standards file:
1. Look for docs/code-standards.md (or legacy docs/code-patterns.md)
2. If legacy exists: migrate path (rename to docs/code-standards.md)
If file exists, read the <!-- base-commit: ... --> header and check staleness:
git rev-list <base-commit>..HEAD --count
| Commits since | Action |
|---------------|--------|
| 0 | Skip — file is current, return it as-is |
| 1–20 | Update — spot-check recent diffs (git diff <base-commit>..HEAD), update changed sections only |
| 21+ | Generate — full re-scan, regenerate entire file |
If file exists but has no <!-- base-commit: ... --> header, the sha is unknown, or the repo is not a git repo: treat as Generate.
If file missing, proceed to full Generate.
Search the codebase for conventions. Adapt searches to what the project actually contains — not every section applies to every codebase.
Search strategy per section:
| Section | What to grep/glob for |
|---------|----------------------|
| Forbidden Patterns | Linter configs, eslint-disable comments, TODO/HACK comments |
| Code Examples | Covered by other searches — select best do/don't pairs found |
| Error Handling | try/catch, Result types, error classes, .catch() |
| Imports & Dependencies | Import statements, barrel files, dependency direction |
| Testing Patterns | Test files, helpers, fixtures, mocks |
| Naming | Variable/function/file naming across 5+ files |
| File Organization | Directory structure, co-location patterns |
| Technology Decisions | Package files, config files, framework imports |
| Exemplar Files | Well-structured files that demonstrate multiple conventions |
Scan breadth over depth — sample across the codebase rather than exhaustively cataloging one directory.
For Update mode: Only search sections where recent diffs show changes to relevant patterns.
Read the section templates before writing: Read(${CLAUDE_PLUGIN_ROOT}/skills/code-standards/references/section-templates.md)
File format:
<!-- base-commit: [HEAD sha] -->
<!-- generated: [YYYY-MM-DD] -->
# Code Standards
[sections per templates]
Core rules:
Write to docs/code-standards.md. Do NOT commit the file.
After writing, self-check:
Nine sections. Contrastive sections (DO/DON'T) come first — they resist confirmation bias and anchor behavior more reliably than descriptive sections (2603.18740). Not all sections apply to every project — skip where you find no meaningful conventions.
See the templates file for detailed format per section.
| From | To |
|------|-----|
| plan (codebase scan step) | Returns docs/code-standards.md path |
| build-agent (discovery phase) | Reads the file directly |
devops
Implements the Standard/Full planning pipeline for Medium and Complex tasks: multi-step discovery, phase decomposition with skill matching, cross-cutting concerns, and plan emission with Gate fields.
development
Provides all 23 Gang of Four patterns as a decision guide: maps code symptoms to patterns, then loads the structural recipe for the selected pattern.
development
Applies Code Complete's scientific debugging method: STABILIZE → LOCATE → HYPOTHESIZE → EXPERIMENT → FIX → TEST → SEARCH. For active bug investigation, not QA process design or test coverage planning.
development
Safely modifies untested legacy code by getting it under test first: characterization tests, seam identification, sprout/wrap techniques, and pinch-point testing before any production changes.