ffroliva/gflow-cli/skills/sonar/SKILL.md
sonar
Check the SonarCloud quality gate for a PR (or the current branch) and drive it to zero. Reports GREEN, or the exact PR-scoped new issues/hotspots/coverage gaps to fix.
- Source repository stars
- 96
- Declared platforms
- 0
- Static risk flags
- 0
- Last source update
- 2026-08-04
- Source checked
- 2026-08-04
Decision brief
What it does—and where it fits
The reusable Sonar primitive. /gflow:check is local and cannot see Sonar (it is server-side, post-push); /gflow:pr-council-review is an LLM diff review, not the gate verdict. This command answers one question: is the SonarCloud gate green (zero new issues) for this PR, and if no…
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/ffroliva/gflow-cli --skill "skills/sonar"Inspect the Agent Skill "sonar" from https://github.com/ffroliva/gflow-cli/blob/c64a8d8b246f9551e8a96c7fcf363d15e045c9b2/skills/sonar/SKILL.md at commit c64a8d8b246f9551e8a96c7fcf363d15e045c9b2. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Pipeline Continuation (Next Step Handoff)
Upon completing SonarCloud Quality Gate: 1. Gate 🟢 GREEN: Proactively announce: "SonarCloud quality gate passed (zero new issues). Next step: Phase 10 Release Pipeline (/gflow:release) or merge PR." 2. Gate 🔴 RED: Fix identified code smells/coverage gaps, push, and re-run /gfl…
Gate 🟢 GREEN: Proactively announce: "SonarCloud quality gate passed (zero new issues). Next step: Phase 10 Release Pipeline (/gflow:release) or merge PR."Gate 🔴 RED: Fix identified code smells/coverage gaps, push, and re-run /gflow:sonar .Upon completing SonarCloud Quality Gate: 1. Gate 🟢 GREEN: Proactively announce: "SonarCloud quality gate passed (zero new issues). Next step: Phase 10 Release Pipeline (/gflow:release) or merge PR." 2. Gate 🔴 RED: Fix… - 02
Steps
1. Check the GitHub check first (never trust the gate API while it's pending).
pass → gate is GREEN / zero new issues. Done. Report GREEN and stop.pending → the SonarCloud job (50s) runs after the 3.5min test matrix; waitfail → continue to step 2 to enumerate the exact failing conditions. - 03
Which gate conditions are ERROR:
GET /api/qualitygates/projectstatus?projectKey=ffrolivagflow-cli&pullRequest=
GET /api/qualitygates/projectstatus?projectKey=ffrolivagflow-cli&pullRequest= - 04
New issues (bugs/smells) with file:line + rule + creationDate:
GET /api/issues/search?componentKeys=ffrolivagflow-cli&pullRequest=&resolved=false
GET /api/issues/search?componentKeys=ffrolivagflow-cli&pullRequest=&resolved=false - 05
Unreviewed security hotspots:
GET /api/hotspots/search?projectKey=ffrolivagflow-cli&pullRequest=&status=TOREVIEW
newcoverage < 80% → add real unit tests for the uncovered new linesnewcodesmells / newmaintainabilityrating (e.g. S1192 duplicated literal,newsecurityhotspotsreviewed < 100% → only for a genuine false positive:
Permission review
Static risk signals and limitations
No configured static risk pattern was detected
This is not proof of safety. Runtime behavior, indirect dependencies, and hidden external systems are outside the static scan.
Evidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 83/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 96 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- ffroliva/gflow-cli
- Skill path
- skills/sonar/SKILL.md
- Commit
- c64a8d8b246f9551e8a96c7fcf363d15e045c9b2
- License
- MIT
- Collected
- 2026-08-04
- Default branch
- develop
View the original SKILL.md
/gflow:sonar [PR#] — SonarCloud quality gate
The reusable Sonar primitive. /gflow:check is local and cannot see Sonar (it
is server-side, post-push); /gflow:pr-council-review is an LLM diff review, not the
gate verdict. This command answers one question: is the SonarCloud gate green
(zero new issues) for this PR, and if not, exactly what must be fixed?
$ARGUMENTS is the PR number. If empty, resolve it from the current branch
(gh pr view --json number -q .number).
Project: key ffroliva_gflow-cli, org ffroliva-github (see sonar-project.properties).
The CI scan sets sonar.qualitygate.wait=true, so a green SonarCloud analysis
check means the gate genuinely passed — but the gate API is stale until that
check finishes, so always check the GitHub check FIRST.
Steps
1. Check the GitHub check first (never trust the gate API while it's pending).
gh pr checks <N> --json name,state,bucket | \
jq -r '.[] | select(.name=="SonarCloud analysis") | "\(.bucket) \(.state)"'
pass→ gate is GREEN / zero new issues. Done. Report GREEN and stop.pending→ the SonarCloud job (~50s) runs after the ~3.5min test matrix; wait (gh pr checks <N> --watch) before reading the API, or the API returns the previous commit's verdict.fail→ continue to step 2 to enumerate the exact failing conditions.
2. Enumerate the failing conditions (PR-scoped — this is the #1 gotcha).
New-code issues live on the PR branch, NOT main. Scope every call with
&pullRequest=<N> or the API reports 0 and you chase phantoms. Token is in
.env.local as SONAR_TOKEN — read it inside a sandbox so it never lands in chat.
curl may be blocked by the context-mode hook → use ctx_execute (javascript
fetch with Authorization: Basic base64(token+":")).
# Which gate conditions are ERROR:
GET /api/qualitygates/project_status?projectKey=ffroliva_gflow-cli&pullRequest=<N>
# New issues (bugs/smells) with file:line + rule + creationDate:
GET /api/issues/search?componentKeys=ffroliva_gflow-cli&pullRequest=<N>&resolved=false
# Unreviewed security hotspots:
GET /api/hotspots/search?projectKey=ffroliva_gflow-cli&pullRequest=<N>&status=TO_REVIEW
3. Fix by condition — no gaming.
new_coverage < 80%→ add real unit tests for the uncovered new lines (usually a new orchestration/_run_*/helper). There is NO mark-safe shortcut and NEVER widensonar.coverage.exclusionsto dodge it.new_code_smells/new_maintainability_rating(e.g. S1192 duplicated literal, S3776 cognitive complexity) → fix at source. For a duplicated literal your diff merely touched, collapse it to one module-scope alias so it falls under the threshold (pyright/tests prove it's safe). For S7497, re-raise swallowedasyncio.CancelledError.new_security_hotspots_reviewed < 100%→ only for a genuine false positive:POST /api/hotspots/change_statusform bodyhotspot=<key>&status=REVIEWED&resolution=SAFE&comment=<justification>(204 = ok), then re-run the SonarCloud job so it reposts the GitHub status (gh run rerun <run-id> --job <sonar-job-id>— the coverage artifact is reused). Never mark a real hotspot SAFE.
4. Push fixes, then re-verify from step 1 (the check must read pass).
Output
- Verdict: GREEN (gate passed, zero new issues) or RED with the exact failing
conditions and a fix list (
file:line · rule · what to do). - After any fix: re-confirm via step 1 — green check = gate passed.
Pipeline Continuation (Next Step Handoff)
Upon completing SonarCloud Quality Gate:
- Gate 🟢 GREEN: Proactively announce: "SonarCloud quality gate passed (zero new issues). Next step: Phase 10 Release Pipeline (
/gflow:release) or merge PR." - Gate 🔴 RED: Fix identified code smells/coverage gaps, push, and re-run
/gflow:sonar <PR#>.
See also
docs/GITHUB.md§ SonarCloud Quality Gate — full policy + coverage-exclusion rationale./gflow:check— the local pre-commit gates (coverage floor pre-emptsnew_coverage).- Memory: [[sonarcloud-pr-issues-scope-s7497]], [[sonarcloud-new-code-gotchas]], [[sonarcloud-hotspot-review-workflow]], [[sonarcloud-setup]].