universal-coding-standards
Skill1 starsChanged 46 days agoMITView on GitHub
Enforce clean, robust, and secure engineering standards across any programming language (Python, JavaScript, TypeScript, Go, Rust, Java, C#, PHP, Ruby, C/C++). Triggers whenever an agent writes, reviews, audits, or refactors code, generates pull requests, checks code quality, or answers questions like "is this good code?", "review this PR", "refactor this function", or "write clean code". Applies 10 universal pillars: naming, error handling, function design, comments, testing, security, dependencies, version control, formatting, and performance trade-offs.
- Reads credentials
In this repository15 other files it gives its agents.
- accessibility-auditSkill
- agent-skills-authoringSkill
- api-designSkill
- ci-cd-pipelineSkill
- code-reviewSkill
- design-system-adapterSkill
- docker-and-containersSkill
- docs-and-adrSkill
- git-commit-workflowSkill
- package-security-vettingSkill
- replicate-apiSkill
- secrets-and-config-managementSkill
- testing-strategySkill
- ui-cloneSkill
- ui-slop-remediationSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 27
Run through this checklist while authoring or evaluating any code changes:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Universal Coding Standards
A language-agnostic operational standard for writing, refactoring, and reviewing code.
Precedence Rule: Specific repository configurations (
.editorconfig,tsconfig.json,ruff.toml) and official ecosystem formatters (gofmt,rustfmt,black,dotnet format) always take precedence over generic aesthetic preferences.
The 10 Engineering Pillars (Operational Checklist)
Run through this checklist while authoring or evaluating any code changes:
1. Naming & Structure
- Idiomatic Casing: Apply the target language's standard casing (see
references/language-notes.md).- Python / Rust / Ruby:
snake_casefunctions and variables - JS / TS / Java:
camelCasefunctions and variables - C#:
PascalCasemethods,_camelCaseprivate fields - Go:
camelCaseprivate,PascalCaseexported
- Python / Rust / Ruby:
- Intention-Revealing Names: Use clear, descriptive names over cryptic abbreviations. Avoid single-letter variables outside tight loop counters (
i,j) or well-known coordinate math (x,y). - Single Responsibility per File: Organize modules so each file owns one cohesive concept or responsibility. Avoid "dumping-ground" utility files.
2. Error Handling & Resilience
- No Silent Swallowing: Never use empty
catchblocks or bareexcept: pass. At minimum, log the error with context or re-raise. - Actionable Errors: Error messages must identify what failed, the offending identifier or argument, and whether recovery is possible.
- Recoverable vs Fatal: Handle expected domain failures (e.g., missing record, validation error) explicitly; reserve panics, crashes, or unhandled exceptions for unrecoverable state corruption.
- Propagate Context: In Go, check
if err != niland wrap withfmt.Errorf("...: %w", err); in Rust, propagate with?; in JS/Python/Java/C#, preserve error causes or stack traces.
3. Function & Method Design
- Single Responsibility Principle (SRP): Each function does one thing well. If a function requires section comments to explain sequential phases, extract those phases into helper functions.
- Manageable Size: Keep functions short and readable (aim for under 40–50 lines).
- Guard Clauses Over Deep Nesting: Invert conditions and return early to keep the main happy path at the lowest possible indentation level.
- Explicit Inputs & Outputs: Prefer pure functions and explicit parameters over implicit modification of shared global state.
4. Comments & Documentation
- Document the "Why", Not the "What": Code describes how; comments explain why non-obvious constraints, business edge cases, or workarounds exist.
- Public API Docs: Exported functions, public classes, and HTTP endpoints must include docstrings/JSDoc/Rustdoc specifying purpose, parameters, return types, and thrown exceptions.
- Zero Dead Code: Delete commented-out code blocks immediately. Git history preserves past experiments.
5. Testing & Verification
- Test Coverage for New Logic: Every new feature, calculation, or bug fix must include corresponding unit or integration tests.
- Dual Coverage (Happy + Edge): Test both the successful path and at least one boundary/error condition (e.g. empty list, negative balance, timeout, invalid format).
- Deterministic Data: Avoid hardcoding volatile test data (timestamps like
Date.now(), live external endpoints) that causes flaky test failures.
6. Security Baseline
- Zero Hardcoded Secrets: Never commit API keys, database credentials, JWT secrets, or private keys. Load strictly from environment variables or secure vaults.
- Input Sanitization & Validation: Treat all external data (HTTP bodies, query params, files, headers) as untrusted. Validate schemas at system boundaries.
- Prevent Injection Vectors:
- SQL: Never concatenate SQL strings; use parameterized queries or ORM binding.
- Commands: Never pass unescaped user input to
shell=Trueorexec(). - Deserialization: Avoid unsafe object deserializers (
pickle.loads(),BinaryFormatter, unvalidatedYAML.load()).
7. Dependency & Version Hygiene
- Standard Library First: Do not install third-party packages for functionality already provided natively by the modern standard library.
- Locked Versions: Always maintain and commit package lockfiles (
package-lock.json,pnpm-lock.yaml,Cargo.lock,uv.lock,composer.lock,go.sum). - Security Audits: Avoid dependencies with unmaintained licenses or known high-severity CVEs.
8. Version Control Hygiene
- Atomic Commits: Bundle one logical change per commit with a concise, imperative commit message (
Add payment webhook handler). - Ignore Build Artifacts: Verify
.gitignoreexcludesnode_modules/,target/,dist/,__pycache__/,.env, and OS metadata (.DS_Store). - No Large Binary Blobs: Never commit compiled binaries, large SQLite files, or large video assets to Git without LFS justification.
9. Formatting & Linting
- Automated Tooling Compliance: Format code using project tools (
prettier,ruff,gofmt,rustfmt,dotnet format). - Clean Static Analysis: Code must pass all project linters (
eslint,ruff check,golangci-lint,cargo clippy,phpstan) with zero errors or unaddressed warnings. - Consistent Styling: Adhere to established whitespace, quote, and line-length conventions of the surrounding repository.
10. Performance & Readability Trade-Off
- Readability First: Clear, predictable, maintainable code trumps clever micro-optimizations by default.
- Measured Optimization: Optimize algorithms and memory only on verified hot paths with profiling data or concrete performance requirements.
- Avoid Obvious Anti-Patterns: Eliminate accidental $O(N^2)$ lookups (e.g., searching an unindexed array inside a loop instead of using a
SetorMap) and database N+1 queries.
Detailed References
references/language-notes.md: Per-language casing tables, canonical formatters/linters, idiomatic error handling, and ecosystem security footguns (Python, JS/TS, Go, Rust, Java, C#, PHP, Ruby, C/C++).references/review-checklist.md: Fast pass/fail checklist categorized by BLOCKER, WARNING, and NIT for code reviews and PR audits.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

