/crewforth:sonarqube-checkfrom Crewforth
Runs SonarQube Community Build locally via Docker to produce real quality gate reports and fix issues by rule ID. Language-agnostic, no company server needed.
Ships in Crewforth. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Trigger phrases: "sonarqube", "quality gate", "code smell", "sonar scan", "sonar rapor", "A rating"
Only a SonarQube analysis can say "rating A, 0 findings". A clean build says the compiler was happy — a
different claim, about a different rule set. Passing one off as the other is how a team is told the code is clean
and then opens a report full of findings.
You do not need a company server or someone else's token to get the real thing: SonarQube Community Build is free, needs no licence key, and runs in one Docker container on this machine. That is the default path here — the gate is produced locally, offline, and it is a genuine SonarQube verdict, not a proxy for one.
Language-agnostic on purpose: SonarQube covers 20+ languages plus IaC (Terraform, Kubernetes, Dockerfile). Detect what the project actually uses; never assume a stack.
a) The project already has a SonarQube → use it, and skip to step 2.
b) It does not → stand one up locally. Docker one-liner, the Docker-free server zip, the first login and the
token: references/stand-up-server.md. No licence, no external account, nothing leaves the machine.
Restarting is not installing. Bringing an already-approved service back up on this machine — the same image, the same volumes — is resuming what the user already said yes to, and this skill's own advice to keep a named volume assumes exactly that. A NEW image, a new volume, or a tool this machine does not have is an install, and needs the answer below.
Nothing here is installed without the user saying so. Docker, Java, a scanner, a linter — each is a proposal with its cost stated, and the user picks. If they decline all of them, that is a valid answer: go to (c) and report "unverified" rather than installing anything to make a number appear.
Scan with whatever runner the project's stack uses — the scanner is the same product for every language:
The token is read from the SONAR_TOKEN environment variable (set it in your shell or an untracked env file) — never
pasted into chat, a command line literal, or a committed file.
| Project | Scan command |
|---|---|
| Any stack (generic) | sonar-scanner -Dsonar.projectKey=app -Dsonar.sources=. -Dsonar.host.url=http://localhost:9000 -Dsonar.token=$SONAR_TOKEN |
| Maven / Gradle | mvn sonar:sonar -Dsonar.host.url=… -Dsonar.token=$SONAR_TOKEN · gradle sonarqube … |
| .NET | dotnet sonarscanner begin /k:app /d:sonar.host.url=… /d:sonar.token=$SONAR_TOKEN → dotnet build → dotnet sonarscanner end /d:sonar.token=$SONAR_TOKEN |
| JS/TS, Python, Go, PHP, Ruby | the generic sonar-scanner above, with the coverage report below |
Coverage first: SonarQube runs no tests, it reads a report. Produce one before the scan and pass its path, or the analysis counts every line uncovered and prints 0.0%:
| Stack | Produce | Pass to the scanner |
|---|---|---|
| Python | pytest --cov=<package> --cov-report=xml (needs pytest-cov) | -Dsonar.python.coverage.reportPaths=coverage.xml |
| JS/TS | vitest run --coverage --coverage.reporter=lcov · jest --coverage | -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info |
| .NET | coverlet, OpenCover format | /d:sonar.cs.opencover.reportsPaths=… (reports, with an s) |
| Java | JaCoCo XML report | -Dsonar.coverage.jacoco.xmlReportPaths=… |
| Go | go test -coverprofile=coverage.out ./... | -Dsonar.go.coverage.reportPaths=coverage.out |
No report, no coverage figure. When none was produced (or lines_to_cover equals uncovered_lines), write
"coverage: not measured — no report was passed to the analysis", never "0%": a 0 there says the tests were not
read, not that there are none. Installing the coverage plugin is a proposal like any other tool.
c) No server is possible at all (no Docker, no Java, no permission to run one) → run the language's Sonar-rule
engine locally as a pre-check (references/local-engines.md — which engine per language, and how close it is
to Sonar's own rules) and say what that is worth, in these words rather than a
rating: "the local rule engine reports N issues, none open; the SonarQube rating and the gate were not produced —
no analysis ran." Then list what stays unverified: taint/injection, hotspot review state, coverage, duplication,
files outside the compiled language, and the project's own quality profile. Offer branch (b) — a local server, with
or without Docker — as the way to close it. Until one runs, a committed baseline keeps the numbers the project can
measure from getting worse: references/ratchet.md.
Never invent the verdict. A rating exists only where an analysis produced one; without it the honest output is "unverified", and that is the sentence that saves the user from promising a clean report they cannot back.
S=http://localhost:9000; K=app # or the project's own host/key
curl -sfu "$SONAR_TOKEN:" "$S/api/qualitygates/project_status?projectKey=$K" # pass / fail, and which condition failed
curl -sfu "$SONAR_TOKEN:" "$S/api/issues/search?componentKeys=$K&resolved=false&ps=500" # rule id + file + line per finding
curl -sfu "$SONAR_TOKEN:" "$S/api/hotspots/search?projectKey=$K&status=TO_REVIEW" # hotspots are a SEPARATE endpoint
curl -sfu "$SONAR_TOKEN:" "$S/api/measures/component?component=$K&metricKeys=alert_status,bugs,vulnerabilities,security_hotspots,code_smells,coverage,duplicated_lines_density,reliability_rating,security_rating,sqale_rating"
Also read the gate's definition (/api/qualitygates/show): most gates judge new code, not the whole project.
Chasing overall counts while the gate measures new code burns days and still fails; the reverse leaves real debt.
Know which one applies before planning the work.
An empty new-code period makes "Passed" mean nothing. On a first analysis, or under PREVIOUS_VERSION while
the version has not changed, project_status returns "period": null and every new_* condition comes back
actualValue: null, status: OK — the gate passes because there is no new code to judge, while the project may
carry an E rating. When that is what you read:
measures call above) as the verdict, and say the gate had no new
code to evaluate — never "the gate passed";curl -sfu "$SONAR_TOKEN:" -X POST "$S/api/new_code_periods/set?project=$K&type=NUMBER_OF_DAYS&value=30" (or REFERENCE_BRANCH with the main branch).
It changes the project's settings, so it is the user's yes, like any other change.Group findings by rule (csharpsquid:S1481, typescript:S3776, python:S5852, …) and take one rule at a time,
all occurrences together. Read what the rule actually asks, fix the cause, cite the rule id in the change. The
domain owner does the fixing — a security rule is crew-security-expert's, a query/index rule is
crew-database-expert's.
Never close a finding by silencing it. #pragma warning disable, // NOSONAR, eslint-disable, an exclusion in
sonar-project.properties — each one changes the report without changing the code. It needs a written reason and
the user's approval, every time.
Security Hotspots do not close by editing code. Each is reviewed in the UI and marked safe (with a rationale)
or fixed. Code changes alone leave it TO_REVIEW and the gate keeps failing.
Re-run step 1's scan, re-read step 2, and report the difference: counts before → after, which rule ids
disappeared, which remain, which are new. "It should be clean now" is not a result — a second analysis is.
Repeat until the gate says OK, or every remaining finding has a user-approved suppression. Nothing here closes on a first pass.
A verdict is about the code that was analysed. Record it, with the code it covers, after step 2 and again after the final re-scan of step 4 — and for path (c), record why no analysis ran (Bash tool, not PowerShell):
bash "${CLAUDE_PLUGIN_ROOT}/skills/sonarqube-check/scripts/record.sh" <clean|unverified> "<gate status + analysis date, or why no analysis ran>"
/crew-ship runs scripts/freshness.sh before it proposes a commit: an edit made after the analysis (staged or
not, a new file too) makes the record stale and stops the ship until a re-scan is recorded. declined in
Quality analysis: passes as "no analysis ran — unverified". A failing gate is not recorded — it is step 3's list.
Community Build has no taint/injection analysis (data flow from user input to a dangerous sink — SQLi, XSS,
command injection); that engine is in the paid editions. It also has no branch/PR analysis. So a clean local gate
is not proof of injection safety: cover that with the security-scan and threat-model skills plus a
crew-security-expert review, and say which of the two verdicts you are reporting.
scripts/record.sh) for the code as it stands."period": null is reported by its overall ratings, not as "passed".## Stack → Quality analysis: line says which path ran (sonarqube-local, sonarqube-server,
or declined); an empty one is asked once and written there.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub crewforth/crewforth --plugin crewforth60 skills in this plugin
/a11yUse when building or changing UI, before shipping a user-facing screen, and when something cannot be
reached with a keyboard, read by a screen reader, or seen at low contrast.
/adrArchitecture Decision Record: context-decision-consequences, for decisions that are expensive to reverse.
Written under docs/adr/.
/api-designUse when an API contract is designed or changed: a new endpoint or resource, how its errors and pages
are returned, a field to add or remove, or a version to cut without breaking a consumer.
/automode-policyAuto-mode classifier config: inspect what the classifier that answers permission prompts is configured
with, and catch the silent case where a custom autoMode block drops the built-in block rules.
/backend-architectureDecide, record and apply the backend stack and architecture pattern.
Use when backend work starts with no recorded stack, or a framework/DB/pattern must be chosen.
/brainstormUse when the ask is still fuzzy and no direction is chosen yet: "not sure what we want", several ways to go,
or a scope to settle before any plan is written.
Other plugins' skills for the same job