From code-foundations
Generates or updates docs/code-standards.md by scanning codebase conventions like naming, imports, testing patterns. Produces example-rich standards for consistent LLM code.
npx claudepluginhub ryanthedev/code-foundationsThis skill uses the workspace's default tool permissions.
Generate or update `docs/code-standards.md` — a project-specific conventions file optimized for LLM consumers.
Analyzes codebase to create or update .conventions/ directory with gold standards, anti-patterns, and checks for naming, imports, and patterns. Use for setting up coding standards or bootstrapping new projects.
Analyzes file(s) or folder(s) to generate coding standards document matching existing styles like indentation, naming, comments. Creates files like CONTRIBUTING.md, fixes inconsistencies.
Discovers coding standards, conventions, and best practices from project configs, code patterns, docs, PRs, and CI/CD sources. Aggregates with confidence scores for user approval and application.
Share bugs, ideas, or general feedback.
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 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 |
Time budget: 30 seconds of searching, not 5 minutes. 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($SKILL_DIR/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 $SKILL_DIR/references/section-templates.md for detailed format per section.
| From | To |
|---|---|
| whiteboarding (codebase scan step) | Returns docs/code-standards.md path |
| build-agent (discovery phase) | Reads the file directly |