L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Développement · SKILL.md

software-clean-code-standard

software-clean-code-standard

Defines CC-* code rules and waivers. Use when mapping lint findings to rule IDs or tracking complexity mass, erosion, and verbosity across changes.

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: software-clean-code-standard description: "Defines CC-* code rules and waivers. Use when mapping lint findings to rule IDs or tracking complexity mass, erosion, and verbosity across changes." compatibility: Portable core. Works on Claude Code and Codex. version: "1.3" last_validated: 2026-08-21

Clean Code Standard

This skill is the authoritative clean code standard for this repository's shared skills. It defines stable rule IDs (CC-*), how to apply them in reviews, and how to extend them safely via language overlays and explicit exceptions.

Judgment over dogma: This standard's CC-* rules are durable (coupling/cohesion, naming, small interfaces, explicit errors). Numeric folklore — hard function-length caps, "comments are a smell," DRY applied absolutely — is not. Robert C. Martin's Clean Code (2nd ed., 2025) and John Ousterhout's A Philosophy of Software Design disagree in a published, public debate on function size and commenting (see references/code-quality-operational-playbook.md § 14); apply the rule ID's intent, not a book's specific numeric prescription, and know when not to refactor (§ 14.3 of the same reference).


Quick Reference

TaskTool/FrameworkCommandWhen to Use
Cite a standardCC-* rule IDN/APR review comments, design discussions, postmortems
Categorize feedbackCC-NAM, CC-ERR, CC-SEC, etc.N/AKeep feedback consistent without "style wars"
Add stack nuanceLanguage overlayN/AWhen the base rule is too generic for a language/framework
Allow an exceptionWaiver recordN/AWhen a rule must be violated with explicit risk
Reuse shared checklistsassets/checklists/N/AWhen you need product-agnostic review/release checklists
Reuse utility patternsreferences/*-utilities.mdN/AWhen extracting shared auth/logging/errors/resilience/testing utilities

When to Use This Skill

  • Defining or enforcing clean code rules across teams and languages.
  • Mapping a concrete review or scanner finding to a CC-* ID; use software-code-review for the review workflow.
  • Building automation: map linters/CI gates to CC-* IDs.
  • Resolving recurring review debates: align on rule IDs, scope, and exceptions.

When NOT to Use This Skill

Workflow

  1. Decide whether the request is about a base rule, an overlay, or an exception.
  2. Route security, review-process, or refactoring mechanics to the adjacent skill if that is the real problem.
  3. Anchor the guidance in existing CC-* rules before proposing new wording or automation; map a tool finding by its failure mode, not by tool severity alone.
  4. Apply the relevant standard, overlay, or waiver pattern with explicit scope and rationale.
  5. Cross-check against the navigation references before adding or revising durable standards.

Rule Application Checklist

When citing or enforcing CC-* rules in a review:

  • Rule ID cited explicitly (not paraphrased) — e.g. CC-SEC-01, CC-ERR-03 (two-digit CC-<CAT>-<NN>; only IDs that exist in the catalog — python3 scripts/check_cc_ids.py [paths] fails on unknown IDs)
  • Scope stated: file, module, service, or whole repo
  • Language overlay applied if the repo is language-specific and the base rule is ambiguous
  • Blocking vs advisory: correctness/security findings block merge; style findings are advisory
  • Waiver path documented if the rule genuinely cannot be satisfied without architectural change

Decision Tree: Base Rule vs Overlay vs Exception

Feedback needed: [What kind of guidance is this?]
    ├─ Universal, cross-language rule? → Add/modify `CC-*` in `references/clean-code-standard.md`
    │
    ├─ Language/framework-specific nuance? → Add overlay entry referencing existing `CC-*`
    │
    └─ One-off constraint or temporary tradeoff?
        ├─ Timeboxed? → Add waiver with expiry + tracking issue
        └─ Permanent? → Propose a new rule or revise scope/exception criteria

Optional: AI/Automation

Refactor evidence gate.

Do not raise a rule violation solely because code looks unfashionable. Name the maintenance failure it causes: duplicated change, hidden side effect, unsafe coupling, unreadable control flow, or measured complexity hotspot. Preserve stable awkward code when the proposed rewrite lacks a behavior-preserving test or a concrete reduction in change risk; document a narrow exception instead of creating churn.

  • Map automation findings through the rule-level examples; inspect the code before assigning a priority.
  • Keep AI-assisted suggestions advisory; human reviewers approve/deny with rule citations (https://conventionalcomments.org/).
  • Gate new blocking violations against the repository baseline; track erosion and verbosity as reviewed trajectories rather than universal thresholds (metric guidance).

Reviewing AI-Generated Code

AI-generated code requires the same CC-* standards plus additional vigilance for these patterns:

PatternCC-* MappingDetection
Hallucinated importsCC-SEC-05npm info / pip index / type-check fails
Stale or deprecated APIsCC-DEP-01Compiler warnings, changelog checks
Missing error pathsCC-ERR-01, CC-ERR-04No catch/finally, no null guards, no timeout
Premature abstractionCC-FUN-06Wrappers with single call site, unused generics
Confident wrong commentsCC-DOC-01, CC-DOC-02Docstrings that don't match implementation
Security anti-patternsCC-SEC-08, CC-SEC-03String concatenation in queries, hardcoded tokens
Silent fallback or empty catchCC-ERR-01Error path returns a plausible default with no caller-visible failure
Weakened or deleted assertionCC-TST-01, CC-TST-03Requirement no longer makes a test fail when reversed
Duplicate helper or scope expansionCC-FUN-05, CC-FUN-06Parallel helper appears beside existing behavior or an abstraction has no second use

For agent change discipline and tests that detect regressions, use coding-behavior.md. For detailed hallucination checks, see references/code-quality-operational-playbook.md § 11.3.


Navigation

Resources

Templates

Utility Patterns

Related Skills


Freshness Protocol

  • For a named linter or scanner, check its official rule documentation and the version resolved by the project before mapping a finding to CC-*.
  • For a proposed CI gate, check the scanner's current baseline/new-code support and compare its rule coverage with the repository's existing checks.
  • Report the selected rule mapping, any unsupported rule or migration risk, and the source used to verify it.

Known Traps

  • Treating “clean code” as style preference only and ignoring correctness, observability, security, and change safety.
  • Enforcing blanket abstraction rules that increase indirection and reduce runtime clarity in the name of cleanliness.
  • Mixing language-specific formatter and linter opinions into universal guidance without preserving the stable CC rule intent.
  • Letting tool defaults silently redefine the team standard when the explicit repository rule IDs say otherwise.
  • Auditing code solely from static style output and missing failure-mode, data-boundary, and operability risks.

Common Anti-Patterns

  • Replacing concrete, understandable code with layered abstractions just to satisfy a cleanliness aesthetic.
  • Treating short functions, DRY, or naming rules as absolute even when they harm cohesion, locality, or domain clarity.
  • Using “clean code” to block pragmatic duplication that preserves boundaries or avoids premature frameworks.
  • Turning rule IDs into checklist theater with no explanation of why the rule matters for maintainability or safety.
  • Applying one language ecosystem’s conventions wholesale to another without adaptation for tooling, runtime, and team workflow.

Learnings Loop

When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present; use learnings.md only for needed history or as the available fallback. Otherwise skip both.

After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.

Skills enregistrées