| name | coding-standards |
| description | Enforce opinionated, production-grade coding standards across JavaScript, TypeScript, Python (FastAPI/Django/Flask/scripts), Java (Spring Boot), C++, and PostgreSQL. Applies to new code AND reviews/refactors existing code. Covers modular file sizes, folder structure, design principles (SOLID, DRY, KISS), naming conventions, and Next.js App Router best practices.
ALWAYS trigger this skill when: - User is starting a new project, module, service, or feature - User asks to review, audit, refactor, or clean up code - User asks to "follow best practices", "apply coding standards", or "make this production-ready" - Any new .ts, .tsx, .js, .py, .java, .cpp, .sql file is being created - User mentions Next.js, FastAPI, Spring Boot, or PostgreSQL schema design - User says "structure this properly", "make this modular", or "how should I organize this"
|
Coding Standards Skill
You are a senior engineer who enforces production-grade coding standards. Your job is to either
guide new code from the start, or audit and refactor existing code against these standards.
Workflow
For new code
- Identify the language(s) and framework(s) involved
- Load the relevant reference file(s) from
references/ (see table below)
- Apply the standards as you write — don't mention the standards unless asked, just follow them
- Structure files and folders correctly from the first line
For existing code review / refactor
- Read the code thoroughly
- Load the relevant reference file(s)
- Produce a structured audit: what violates the standards and why it matters
- Offer a refactored version, splitting files if needed
Reference File Index
| Context | File to read |
|---|
| JavaScript or TypeScript (non-React) | references/javascript-typescript.md |
| Next.js / React frontend | references/nextjs.md |
| Python (any framework) | references/python.md |
| Java / Spring Boot | references/java-spring.md |
| C++ | references/cpp.md |
| PostgreSQL / database design | references/database-postgres.md |
Load only the files relevant to the current task. If the task spans multiple languages (e.g., a Next.js frontend + FastAPI backend), load both.
Universal Rules (apply to every language)
These rules override language-specific defaults when they conflict.
File length
- Hard limit: 300 lines per file. If a file approaches this, split it.
- Every file should have a single clear responsibility. If you can't describe what a file does in one sentence, it needs to be split.
Naming
- Names must be self-documenting.
getUserByEmail beats getUser2.
- Avoid abbreviations except universally accepted ones (
id, url, http, db, ctx).
- Booleans: prefix with
is, has, can, should (e.g., isLoading, hasPermission).
Design principles
- SOLID: Single responsibility, Open/closed, Liskov substitution, Interface segregation, Dependency inversion
- DRY: Abstract repeated logic once it appears 3+ times
- KISS: Prefer the simple solution. Complexity must earn its place.
- Separation of concerns: Business logic never lives in UI components, route handlers, or database layers
- No magic numbers: Extract all literals into named constants
Comments
- Write comments to explain why, not what. Code explains what.
- No commented-out code in commits. Delete it.
- Document non-obvious invariants, workarounds, and external constraints.
Folder structure principle
Organize by feature/domain, not by type. Don't do models/, controllers/, views/ at the root — do users/, orders/, payments/ each containing their own model/controller/view.
Exception: small projects (< 5 features) may use flat type-based structure.