Code Consistency Skill
Enforces, detects, reviews, and generates consistent code across all registered
languages. Includes inline quality triage — lightweight checks that flag issues
for deeper analysis via the code-quality skill when warranted.
Language Registry
Each supported language has a reference file in references/. To add a new language,
create references/<lang>.md following the four-section template (see below).
| Language |
Reference File |
Status |
| Python |
references/python.md |
✅ Active |
| Golang |
references/golang.md |
✅ Active |
| Bash/Shell |
references/bash.md |
✅ Active |
| Rust |
references/rust.md |
✅ Active |
| PowerShell |
references/powershell.md |
✅ Active |
| Terraform (HCL) |
references/terraform.md |
✅ Active |
| Ansible (YAML) |
references/ansible.md |
✅ Active |
Adding a New Language
When encountering a language not in the registry:
- Create
references/<lang>.md with the four standard sections:
- Naming Conventions
- Error Handling
- Project Structure & Packaging
- Logging / Observability
- Add a row to the registry table above
- Update the skill description's language list
- Use authoritative style guides as baseline (official lang docs, widely adopted
community guides)
Core Philosophy
- Detect first, enforce second. Never impose external style onto a codebase with
its own conventions. Scan what's there and match it.
- Pragmatic strictness. Flag critical issues (bugs, ambiguity, maintenance traps).
Suggest minor issues. Never block progress over cosmetics.
- Quality triage. Surface obvious performance, security, testability, and
architecture smells inline. Recommend the
code-quality skill for deep analysis.
- Context-driven output. Match format to task:
- Inline comments → editing a specific file
- Numbered violation report → broad review
- Before/after diff → rewriting or refactoring
- Style guide doc → reference material request
Workflow
Step 1 — Detect the Language(s)
Identify which language(s) the task involves. Check the registry. If the language
isn't registered and the task is substantial, offer to create a reference file.
Step 2 — Load Reference Files
Before writing any code or review output, read the appropriate reference(s):
- Single language → read
references/<lang>.md
- Multi-language (e.g., Terraform + Bash) → read both
- IaC + config tasks → check if Ansible or Terraform references apply
Step 3 — Style Detection (when existing code is present)
Scan provided code to infer project conventions. Use the Style Detection Checklist
below. Record findings as a brief internal "style snapshot" before proceeding.
Step 4 — Execute the Task
| Mode |
When to use |
| Review |
User pastes code and wants issues flagged |
| Rewrite/Refactor |
User wants code cleaned up or made compliant |
| Generate |
User wants new code written in the project's style |
| Style Guide |
User wants a reference doc or cheat sheet |
Step 5 — Quality Triage (inline)
While executing, flag any of these if spotted:
- 🔴 Performance: O(n²)+ in hot paths, unbounded allocations, blocking I/O
in async contexts, missing index hints
- 🔴 Security: hardcoded secrets, injection vectors, path traversal,
missing input validation, permissive CORS/auth
- 🟡 Testability: god functions (>50 LOC with multiple concerns), hidden
dependencies, global state, untestable side effects
- 🟡 Architecture: circular imports, abstraction leaks, SRP violations,
inappropriate coupling between layers
If more than 2 quality flags fire, recommend: "Consider running the code-quality
skill for deep analysis on [performance|security|testability|architecture]."
Step 6 — Present Output
Use format appropriate to context. Always separate critical from suggested.
Style Detection Checklist
Run this mentally when existing code is provided.
Naming
Error Handling
Project Structure
Logging/Observability
IaC-Specific (Terraform/Ansible)
Severity Levels
| Level |
Label |
Meaning |
| 🔴 |
CRITICAL |
Bug risk, security issue, or serious maintainability problem. Must fix. |
| 🟡 |
SUGGEST |
Style deviation or improvement opportunity. Worth doing, not blocking. |
| 🔵 |
NOTE |
Observation or informational context. No action required. |
Reference Files
Read before working on language-specific tasks:
references/python.md — PEP 8 naming, error handling, packaging, logging, OpenTelemetry
references/golang.md — Effective Go + Uber naming, error handling, module layout, logging, OpenTelemetry
references/bash.md — Shell naming, error handling (set -euo, traps), script structure, logging
references/rust.md — RFC 430 naming, Result/Error handling, Cargo layout, tracing crate
references/powershell.md — Verb-Noun naming, error handling, module structure, logging
references/terraform.md — HCL naming, error handling, module layout, state management
references/ansible.md — YAML conventions, error handling, role structure, logging/verbosity
1---2name: code-consistency3description: Enforce, review, and generate consistent code across registered languages: Python, Golang, Bash/Shell, Rust, PowerShell, Terraform, Ansible. Auto-expands when new languages are encountered. Includes inline quality triage (performance, security, testability, architecture smells). Trigger on: "consistency", "style", "conventions", "review my code", "refactor", "clean up", "idiomatic", "linting", "best practices", "code review", "code smell", or when code is present and a consistency/quality task is implied. Also trigger when generating code alongside existing snippets. Do not wait to be asked explicitly — if code is present, use this skill.4---56# Code Consistency Skill78Enforces, detects, reviews, and generates consistent code across all registered9languages. Includes inline quality triage — lightweight checks that flag issues10for deeper analysis via the `code-quality` skill when warranted.1112---1314## Language Registry1516Each supported language has a reference file in `references/`. To add a new language,17create `references/<lang>.md` following the four-section template (see below).1819| Language | Reference File | Status |20|---|---|---|21| Python | `references/python.md` | ✅ Active |22| Golang | `references/golang.md` | ✅ Active |23| Bash/Shell | `references/bash.md` | ✅ Active |24| Rust | `references/rust.md` | ✅ Active |25| PowerShell | `references/powershell.md` | ✅ Active |26| Terraform (HCL) | `references/terraform.md` | ✅ Active |27| Ansible (YAML) | `references/ansible.md` | ✅ Active |2829### Adding a New Language3031When encountering a language not in the registry:321. Create `references/<lang>.md` with the four standard sections:33 - Naming Conventions34 - Error Handling35 - Project Structure & Packaging36 - Logging / Observability372. Add a row to the registry table above383. Update the skill description's language list394. Use authoritative style guides as baseline (official lang docs, widely adopted40 community guides)4142---4344## Core Philosophy4546- **Detect first, enforce second.** Never impose external style onto a codebase with47 its own conventions. Scan what's there and match it.48- **Pragmatic strictness.** Flag *critical* issues (bugs, ambiguity, maintenance traps).49 *Suggest* minor issues. Never block progress over cosmetics.50- **Quality triage.** Surface obvious performance, security, testability, and51 architecture smells inline. Recommend the `code-quality` skill for deep analysis.52- **Context-driven output.** Match format to task:53 - Inline comments → editing a specific file54 - Numbered violation report → broad review55 - Before/after diff → rewriting or refactoring56 - Style guide doc → reference material request5758---5960## Workflow6162### Step 1 — Detect the Language(s)63Identify which language(s) the task involves. Check the registry. If the language64isn't registered and the task is substantial, offer to create a reference file.6566### Step 2 — Load Reference Files67Before writing any code or review output, read the appropriate reference(s):68- Single language → read `references/<lang>.md`69- Multi-language (e.g., Terraform + Bash) → read both70- IaC + config tasks → check if Ansible or Terraform references apply7172### Step 3 — Style Detection (when existing code is present)73Scan provided code to infer project conventions. Use the **Style Detection Checklist**74below. Record findings as a brief internal "style snapshot" before proceeding.7576### Step 4 — Execute the Task7778| Mode | When to use |79|---|---|80| **Review** | User pastes code and wants issues flagged |81| **Rewrite/Refactor** | User wants code cleaned up or made compliant |82| **Generate** | User wants new code written in the project's style |83| **Style Guide** | User wants a reference doc or cheat sheet |8485### Step 5 — Quality Triage (inline)86While executing, flag any of these if spotted:87- 🔴 **Performance:** O(n²)+ in hot paths, unbounded allocations, blocking I/O88 in async contexts, missing index hints89- 🔴 **Security:** hardcoded secrets, injection vectors, path traversal,90 missing input validation, permissive CORS/auth91- 🟡 **Testability:** god functions (>50 LOC with multiple concerns), hidden92 dependencies, global state, untestable side effects93- 🟡 **Architecture:** circular imports, abstraction leaks, SRP violations,94 inappropriate coupling between layers9596If more than 2 quality flags fire, recommend: *"Consider running the `code-quality`97skill for deep analysis on [performance|security|testability|architecture]."*9899### Step 6 — Present Output100Use format appropriate to context. Always separate **critical** from **suggested**.101102---103104## Style Detection Checklist105106Run this mentally when existing code is provided.107108**Naming**109- [ ] Case convention per symbol type (snake_case, camelCase, PascalCase, kebab-case)110- [ ] Prefix/suffix patterns (e.g., `_internal`, `I`-prefix, `Err`-prefix, `$`-prefix)111- [ ] Constant casing112- [ ] Test naming patterns113114**Error Handling**115- [ ] Errors wrapped with context? What mechanism?116- [ ] Sentinel/custom error types?117- [ ] Boundary behavior (panics, exceptions, exit codes, trap handlers)118119**Project Structure**120- [ ] Flat vs nested layout121- [ ] Interface/trait placement122- [ ] Module system conventions123- [ ] Config file conventions124125**Logging/Observability**126- [ ] Which logging library/mechanism?127- [ ] Structured vs unstructured?128- [ ] Log level conventions129- [ ] Trace/span propagation?130131**IaC-Specific** (Terraform/Ansible)132- [ ] Resource naming conventions133- [ ] Module/role structure134- [ ] Variable/parameter organization135- [ ] State/inventory management patterns136137---138139## Severity Levels140141| Level | Label | Meaning |142|---|---|---|143| 🔴 | **CRITICAL** | Bug risk, security issue, or serious maintainability problem. Must fix. |144| 🟡 | **SUGGEST** | Style deviation or improvement opportunity. Worth doing, not blocking. |145| 🔵 | **NOTE** | Observation or informational context. No action required. |146147---148149## Reference Files150151Read before working on language-specific tasks:152153- **`references/python.md`** — PEP 8 naming, error handling, packaging, logging, OpenTelemetry154- **`references/golang.md`** — Effective Go + Uber naming, error handling, module layout, logging, OpenTelemetry155- **`references/bash.md`** — Shell naming, error handling (set -euo, traps), script structure, logging156- **`references/rust.md`** — RFC 430 naming, Result/Error handling, Cargo layout, tracing crate157- **`references/powershell.md`** — Verb-Noun naming, error handling, module structure, logging158- **`references/terraform.md`** — HCL naming, error handling, module layout, state management159- **`references/ansible.md`** — YAML conventions, error handling, role structure, logging/verbosity