agentleFS
AlexisBalayreAlexisBalayre/claude-code-config/.claude/skills/fix-sonar/SKILL.md

fix-sonar

Skill2 starsChanged 28 days agoMITView on GitHub

Orchestrate SonarQube issue resolution across the project using parallel agents and specific fix strategies.

  • Reads credentials

1 other project uses a version of this.

Adopted by

Most recently taken up by

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
  1. Distinctive:

    Constraint: Never mix rules or areas within a single batch to prevent merge conflicts and context bleeding.

    line 31

≈ “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.

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

SonarQube Issue Fixer

This agent automates the identification and resolution of SonarQube issues. It prioritizes high-signal mechanical fixes and structured refactoring for complex rules.

Setup: this skill talks to a SonarQube MCP server. Set SONAR_PROJECT_KEY in .env (see .env.example) to your project's key and enable the server in .claude/settings.local.json. The fix-strategy table below is a starting set of common rules: add the rules your project actually hits and record its systematic false positives.

Operation Modes

1. Status Check (--status)

  • Action: Retrieve all OPEN issues for project ${SONAR_PROJECT_KEY}.
  • Grouping: Aggregate by Rule ID and Codebase Area (the top-level components or directories of the repo).
  • Display: Present a summary table showing severity, count, and affected files.

2. Parallel Resolution (--parallel)

  • Batching: Group issues by Rule + Area. Create up to 3 independent batches targeting different files.
  • Isolation: Dispatch 3 parallel agents with isolation: "worktree".
  • Workflow: Fix -> format/lint -> typecheck -> test (FORMAT_FIX_CMD, LINT_CMD, TYPECHECK_CMD, TEST_CMD from .claude/project.env; skip an empty key) -> Commit -> Push -> PR.
  • Constraint: Never mix rules or areas within a single batch to prevent merge conflicts and context bleeding.

3. Targeted Fix (<rule> or <rule> <area>)

  • Action: Resolve all instances of a specific rule, optionally restricted to a sub-directory/area.

Fix Strategy & Batching Reference

RuleCategoryStrategyBatch Size
S3776ComplexityExtract helpers, early returns, flatten nesting.1-2 files
S107RefactorGroup parameters into a single options object.1 file
S1172UnusedRemove the unused parameter, or document why the signature must keep it.3-5 files
S1481UnusedRemove the unused local variable.5 files
S1192DuplicationExtract the repeated string literal into a constant.3-5 files
<!-- TODO(adapt): add the language-specific rules this project hits, and a `falsepositive` row (mark via `change_sonar_issue_status`, do NOT code-fix) for each systematic false positive. -->

Agent Dispatch Template

Each parallel agent is initialized with the following instruction set:

"Fix [COUNT] instances of SonarQube rule [RULE] in [AREA]. Context: Refer to [FILE:LINE] list. Verification: Run the project's format/lint, typecheck, and test commands (FORMAT_FIX_CMD, LINT_CMD, TYPECHECK_CMD, TEST_CMD in .claude/project.env). Commit: fix: resolve SonarQube [RULE] [DESCRIPTION] in [AREA]"

Exclusions & Constraints

  • Auto-generated Files: Skip paths matching GENERATED_PATHS_REGEX in .claude/project.env, and any build output directories (dist/, build/, target/).
  • Rule Mixing: Under no circumstances should one PR contain fixes for multiple SonarQube rules.

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.