global/skills/_internal/sonar-fix/SKILL.md
Parse sonarcloud[bot] PR comments, classify findings, codify whitelisted auto-fixes, escalate the rest.
npx skillsauth add kcenon/claude-config sonar-fixInstall 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.
The sonar-fix skill processes PR decoration emitted by SonarQube Cloud
via the sonarcloud[bot] GitHub account. It parses the bot's summary
and inline review comments, classifies each finding by rule and
severity, and follows a classify -> fix -> escalate flow. Whitelisted
rules (see reference/auto-fixable-rules.md) are eligible for codified
auto-fixes in later phases; everything else is escalated back to the
PR author as a single consolidated comment. No SonarQube REST API
tokens are required; the bot's PR comments are the only data source.
The skill reads two channels from the PR conversation:
sonarcloud[bot] summary comment, which carries the
Quality Gate verdict (PASS or FAIL).sonarcloud[bot] inline review comments, one per finding,
anchored to a diff line.For every inline comment, the parser extracts rule_id, severity,
file:line, and message, producing a (rule_id, severity) mapping
keyed by location. The parsing contract is captured in
reference/comment-format.md and must be treated as the single source
of truth for regex and field layout.
After classification the skill posts a single comment to the PR with a breakdown table: total findings, count per rule, count per severity, and which findings are eligible for auto-fix versus escalation. The comment is idempotent across runs so re-scans replace rather than append.
Findings that do not match an entry in the auto-fix whitelist are
reported using the body in reference/escalation-template.md. The
escalation comment is also idempotent: a single HTML marker comment
identifies prior escalations from this skill so subsequent runs update
the existing comment instead of stacking new ones.
The skill stops in three cases, paraphrased from the frontmatter:
sonarcloud[bot] summary reports Quality
Gate PASS, meaning no further action is needed.After classification, each finding is routed by whitelist match:
reference/auto-fixable-rules.md and apply the codified fix
exactly as specified in its Before/After section.reference/escalation-template.md and accumulate it for the single
consolidated escalation comment.All fixes must be idempotent — running the skill twice on the same
PR must produce the same tree on the second run as on the first. Rules
that declare a Safety section (S1481 RHS side-effect, S1128
side-effect import, S1854 RHS side-effect, S1192 semantic divergence /
naming ambiguity, S125 intentional-marker comments, S1116 intentional
empty body) MUST escalate rather than auto-fix when the safety predicate
cannot be evaluated with certainty. When in doubt, escalate.
When the skill is invoked with --dry-run:
git diff style) of the fixes it
would apply to stdout so the operator can review the change set
before re-running without --dry-run.<!-- sonar-fix:dry-run --> so subsequent dry-run invocations
replace the prior preview comment rather than stacking.After review, re-invoke the skill on the same PR without --dry-run
to apply the previewed diff.
Auto-fix commits authored by this skill follow:
fix(sonar): <rule-id> -- <short reason>
Examples:
fix(sonar): S1481 -- remove unused local in cli/main.pyfix(sonar): S1128 -- remove unused import in api/handlers.pyRefer to parent epic #635 for the full rationale.
Skill Aliases table in
global/CLAUDE.md: deferred to P5.security_hotspot or vulnerability findings: out of
scope by policy — these require human review and never qualify for
codified auto-fixes.This skill is loop_safe: false. It pushes fix commits to live PRs and replies to SonarCloud bot comments. Re-running would push duplicate commits or re-process already-handled findings. Run it once per PR review cycle; resume rather than re-invoke.
development
Generate and validate the bidirectional traceability matrix linking requirements, design, code, tests, risk records, and standard clauses. Consumes docs/.index/{manifest,bundles,graph,router}.yaml plus an optional compliance/ directory and produces docs/.index/traceability.yaml (machine-readable) and docs/.index/traceability.md (human-readable). Read-mostly: writes only the two trace artifacts and never mutates source documents. Opt-in — no-op when docs/.index/graph.yaml is absent so non-regulated repos are unaffected.
development
Maintain a SOUP (Software Of Unknown Provenance) register for every third-party software item the project depends on. Discovers candidates from lockfiles (package-lock.json, go.sum, Cargo.lock, requirements.txt, pyproject.toml, pom.xml, packages.lock.json), enriches with human-supplied risk class and verification refs, validates against a license allow-list and the requirements catalogue, and emits a per-supplier report. Outputs docs/.index/soup.yaml plus docs/.index/soup.md. Subcommands: discover | enrich | validate | list | report. Bidirectional linking with traceability via the soup_ids[] field on requirement rows. Opt-in: no-op when no lockfile is detected and docs/.index/soup.yaml is absent. Atomic writes (*.tmp + rename); idempotent (records sorted by id). Implements IEC 62304 sections 5.3.3 (SOUP requirements) and 8.1.1 (configuration items).
testing
Manage Hazard and Risk records for projects on the regulated-industry track. Maintains a single normalized risk file (docs/.index/risk-file.yaml) holding hazard identification, initial and residual risk estimates, control measures with verification links, and bidirectional Risk<->Requirement linking via the requirements[] field. Subcommands: add | edit | evaluate | validate | list. Output is consumed by the traceability skill (matrix risk_ids[] field) and the evidence-pack skill (risk_file kind). Opt-in: no-op when docs/.index/manifest.yaml is absent so non-regulated repos are unaffected. Atomic writes via *.tmp + rename; idempotent for diffability. Implements ISO 14971 sections 5-9 operationally.
development
Conduct structured research on any topic: web search, codebase analysis, and document synthesis into organized reports. Use when investigating technologies, analyzing alternatives, gathering reference materials, fact-checking claims, or producing technical documentation from research. Use this skill whenever the user asks to research, investigate, compare, or survey a topic.