agentleFS
gvagogvago/unofficial-qodo-review-skills/skills/clang-format/SKILL.md

clang-format

Skill2 starsChanged 2 months agoApache-2.0View on GitHub

Use when a PR changes C or C++ formatting governed by clang-format or .clang-format, including indentation, braces, spacing, alignment, include ordering, line breaking, macro-sensitive layout, or formatting-only review.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read the changed file and the repository's .clang-format before judging style.

    line 13
  2. Distinctive:

    Do not replace an existing project configuration with a template unless explicitly requested.

    line 14
  3. Distinctive:

    Do not run tools or claim that a formatter was executed.

    line 15
  4. Distinctive:

    Treat bundled templates and integrations as reference material, not evidence that a changed line is invalid.

    line 17
  5. Distinctive:

    Read the authoritative config and the changed diff.

    line 22
  6. Distinctive:

    Read the current config and identify the smallest option change.

    line 30
  7. Very specific:

    Check version compatibility in references/complete/clang-format-style-options.md.

    line 31
  8. Distinctive:

    Every finding must include all of these fields:

    line 66
  9. Distinctive:

    If no Rule ID and exact Rule text can be established, do not report a clang-format rule violation.

    line 74
  10. Distinctive:

    Do not infer a formatting violation solely from a generic preference.

    line 96

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

clang-format

Review C and C++ formatting from the unified diff and the repository's committed .clang-format policy. This skill is an LLM review lens, not a formatter execution workflow.

Boundaries

  • Formatting review covers layout and clang-format behavior only. Do not report correctness, safety, security, API, or architecture findings unless the user separately asks for semantic review.
  • Read the changed file and the repository's .clang-format before judging style. The project configuration is authoritative over bundled templates.
  • Do not replace an existing project configuration with a template unless explicitly requested.
  • Do not run tools or claim that a formatter was executed. Review only changed lines and the context needed to establish the rule violation.
  • Preserve generated, vendored, excluded, or intentionally unformatted code. Check .clang-format-ignore and local project guidance.
  • Treat bundled templates and integrations as reference material, not evidence that a changed line is invalid.

Route the request

  1. Existing configuration analysis or formatting-only review:
    • Read the authoritative config and the changed diff.
    • Match the changed line to a rule in the Rule index below.
    • Report only violations that can be proven from the diff and rule text.
  2. New configuration:
    • Confirm no authoritative project config already exists.
    • Select the closest file under assets/configs/, then make minimal overrides.
    • Validate the proposed config change by reasoning through representative changed constructs. Do not claim execution.
  3. Configuration change:
    • Read the current config and identify the smallest option change.
    • Check version compatibility in references/complete/clang-format-style-options.md.
    • Compare the changed construct with the configured rule. Do not propose repository-wide reformatting.
  4. Troubleshooting:
    • State that runtime confirmation is outside this skill. Use the configured option and changed code as evidence.
    • Consult references/cli-usage.md and the relevant option guide only for interpretation.
  5. Editor or git integration:
    • Review examples under assets/integrations/.
    • Adapt them to the repository instead of installing or copying them blindly.

Option navigation

  • Alignment: references/01-alignment.md
  • Line breaking and wrapping: references/02-breaking.md
  • Braces: references/03-braces.md
  • Indentation: references/04-indentation.md
  • Spacing: references/05-spacing.md
  • Include handling: references/06-includes.md
  • Language-specific behavior: references/07-languages.md
  • Comments: references/08-comments.md
  • Penalties and advanced options: references/09-advanced.md
  • Working examples: references/quick-reference.md
  • CLI details: references/cli-usage.md
  • Complete CLI reference: references/complete/clang-format-cli.md
  • Complete style-options reference: references/complete/clang-format-style-options.md

Repository-specific review guidance

  • The repository's .clang-format is authoritative for reviewed C and C++ files. Inspect it rather than substituting assets/configs/linux-kernel.clang-format or another generic template.
  • For macro-heavy C, include representative headers and source files with ForEachMacros, IfMacros, AttributeMacros, and WhitespaceSensitiveMacros behavior when validating configuration changes.
  • Respect // clang-format off and // clang-format on regions. Do not remove markers or treat intentionally preserved layout inside them as a formatting defect.
  • Validate a focused change on representative files and inspect the diff for macro damage, preprocessor movement, include changes, and excessive churn.
  • In Qodo review, report formatting findings only when they are in scope and supported by the authoritative config. Route semantic C concerns to the appropriate semantic review skill instead of attaching them to clang-format findings.

Finding contract

Every finding must include all of these fields:

  • Rule ID: the stable ID from the Rule index, such as CF-001.
  • Rule text: the exact configuration line or rule text quoted below.
  • Evidence: changed file path and changed line. Never invent a line number.
  • Reason: why the changed text violates that rule.
  • Fix: the smallest source change that restores compliance.

If no Rule ID and exact Rule text can be established, do not report a clang-format rule violation.

Rule index for the repository configuration

These IDs are a local review adaptation because the source .clang-format has no rule IDs. The quoted text is the source rule text and must be preserved in findings.

  • CF-001: BreakBeforeBraces: Linux
  • CF-001 semantics: function, type, and namespace opening braces go on the next line. Control-statement braces stay on the same line. Never report an attached if, for, while, or switch brace as a CF-001 violation.
  • CF-002: ColumnLimit: 100
  • CF-003: ContinuationIndentWidth: 8
  • CF-004: IndentCaseLabels: false
  • CF-005: IndentGotoLabels: false
  • CF-006: IndentWidth: 8
  • CF-007: InsertNewlineAtEOF: true
  • CF-008: SpaceBeforeParens: ControlStatementsExceptControlMacros
  • CF-009: SortIncludes: Never
  • CF-010: UseTab: ForContinuationAndIndentation
  • CF-011: ForEachMacros includes the project macro being reviewed.
  • CF-012: IfMacros includes CHECKIF.
  • CF-013: WhitespaceSensitiveMacros includes COND_CODE_0, COND_CODE_1, IF_DISABLED, IF_ENABLED, LISTIFY, STRINGIFY, Z_STRINGIFY, and DT_FOREACH_PROP_ELEM_SEP.

Do not infer a formatting violation solely from a generic preference. Cite one of these IDs and its exact text.

Review scope

Review only changed C/C++ lines and necessary context. Respect clang-format off/on, generated or vendored paths, and macro-sensitive constructs. Do not claim that a candidate is confirmed when the diff does not show the relevant formatting.

Bundled resources

Seven configuration examples are under assets/configs/:

  • assets/configs/google-cpp-modified.clang-format
  • assets/configs/linux-kernel.clang-format
  • assets/configs/microsoft-visual-studio.clang-format
  • assets/configs/modern-cpp17-20.clang-format
  • assets/configs/compact-dense.clang-format
  • assets/configs/readable-spacious.clang-format
  • assets/configs/multi-language.clang-format

Integration examples are:

  • assets/integrations/pre-commit
  • assets/integrations/vimrc-clang-format.vim
  • assets/integrations/emacs-clang-format.el

Reporting

State the authoritative config, changed file and line, Rule ID, exact Rule text, evidence, and fix. Use the Maintainability category for formatting-only findings. Do not claim that clang-format or another CLI ran. Separate formatting findings from semantic review.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.