skills/coding-best-practices/SKILL.md
Use when developing code. Universal rules for TDD, self-review, quality timing, review format, security. Preloaded on developers.
npx skillsauth add lklimek/claudius coding-best-practicesInstall 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.
Universal rules for all developer agents. Language-specific guidance lives in each agent's own instructions.
Steps 3-5 of every developer workflow (after build environment and prior art check):
Only run formatting, linting, and tests right before committing (or when the user explicitly asks). Don't run them after every edit — it wastes time and tokens.
Never re-run a build, test, or lint command just to see more of its output. Capture full output on the first run using tee: f=$(mktemp /tmp/build-XXXXXX.txt) && <command> 2>&1 | tee "$f" | tail -80 && echo "Full output: $f". If the visible tail is insufficient, read the temp file — do not re-execute the command.
Use the report-format skill for output structure. IDs are provisional (consolidation reassigns them).
git blame. Acceptable exceptions are rare: citing an external constraint (upstream issue, RFC, kernel API quirk) that justifies a non-obvious current choice. Composes with rust-best-practices M-NO-TOMBSTONES — same principle, different framing.// comments, private/non-pub rustdoc, module headers that just rephrase the file name. The cap relaxes to 5–10 lines for public API rustdoc that genuinely teaches downstream callers — parameters, return values, preconditions, error semantics, panic conditions, one-line examples. Both tiers obey present-state. The relaxation is on length, not on history. (See rust-best-practices C-EXAMPLE, C-FAILURE, M-FIRST-DOC-SENTENCE, M-CANONICAL-DOCS.)CMT-001, SEC-014, CODE-007, RUST-123, PROJ-002, CALL-005, etc.) in source code, comments, READMEs, or any other committed file. These IDs are reassigned every time the consolidator runs and become dead references after merge. Allowed ID forms (permanent / standards-body / repo-permanent) include ADR-NNN, RFC-NNN, CWE-NNN, CVE-YYYY-NNNN, OWASP-A0N / OWASP-LLM0N / OWASP-API0N, ATT&CK IDs, GHSA-…, GitHub issue/PR refs (#1234, org/repo#1234), TODO / FIXME / XXX / HACK comments, and test-case IDs from a committed test-spec document. Rule of thumb: if the ID is born inside a regenerated JSON / triage report, it's forbidden in committed code; if the ID lives in a committed Markdown / YAML / standards-body doc, it's fine. Enforced advisory by scripts/lint_ephemeral_ids.py (reviewer-side) and by every developer agent that preloads this skill (write-side).search_standards MCP tool (if available) to check coding and security standards when facing unfamiliar patterns or compliance questions.Tests must never touch real user data. Override XDG_CONFIG_HOME/XDG_DATA_HOME/HOME/app-specific env vars to temp dirs. Use in-memory or temp-file DBs, mock external services, write only to tmp//mktemp paths, use fake credentials.
Rust: use the tracing crate (not log).
| Level | Use for |
|-------|---------|
| error | Important / fatal errors — things that need attention |
| warn | Less significant errors — degraded but recoverable |
| info | Business events — user-visible actions, state transitions, milestones |
| debug | Secondary execution paths — error handling branches, fallback logic |
| trace | Primary path execution — normal flow, detailed step-by-step progress |
Never log inside hot loops or frequently called code paths — even at trace level. Log before/after the loop, or log a summary (count, duration) once it completes.
Before finishing, commit all changes with a descriptive message. Never leave uncommitted work. Never commit to main/master. Run git status to confirm clean state before exiting.
testing
Coordinator-only LLM validation pass. Adds ai_assessment / ai_verdict / ai_verdict_confidence and, in the rare partial-producer case, re-estimates absent risk/impact/scope on a consolidated v3 report.
testing
Use for typos or single-line fixes (≤20 lines). Same mandatory phase order (Planning→Impl→QA→LL), minimal ceremony. Auto-retry on failure.
testing
Use for bug fixes or small changes (≤200 lines). Same phase order as workflow-feature (Planning→Impl→QA→LL) with lighter ceremony. Auto-retry on failure, unattended.
development
Use for new projects, features, or major refactoring. Phases: Planning (Req→UX→Test Spec→Dev Plan) → Implementation → QA → Lessons Learned. Auto-retry on failure, unattended.