SonarCloud Query

VerifiedCaution

Query SonarCloud code quality data via the /sonarcloud slash command. Supports issues, metrics, quality gate, PR, hotspots, and history with filters.

Sby Skills Guide Bot
DevelopmentIntermediate
7/24/2026
Claude Code
#sonarcloud#code-quality#quality-gate#static-analysis#pull-requests

Recommended for

Automated summary

Queries SonarCloud through the /sonarcloud command to report issues, metrics, quality gate status, PR analysis, hotspots, and history for a project or branch.

Strengths

  • Provides a single command surface for common SonarCloud lookups: issues, metrics, gate, health, PR, hotspots, and history.
  • Supports branch, severity, type, and new-code filters with grouped, tabular, or summary output.
  • Explicitly read-only, making it suitable for quick pre-ship checks and PR snapshots.
  • Can suggest contextual follow-ups such as showing issues in a specific file, detailing an issue, or comparing branches.

Limitations

  • Requires SONARCLOUD_TOKEN and an organization key from the environment or user input; it cannot operate without access.
  • Does not fix findings, resolve PR review threads, or perform deep correlation with local source or history trends.
  • Is not a local SAST scanner or the Forge issue tracker; deeper analysis belongs to a separate dedicated skill.
When to use it

Use it when you need a fast in-context SonarCloud status check for a project, branch, or PR before shipping or during review.

When not to use it

Do not use it to fix SonarCloud findings, resolve PR review threads, run local SAST, or query Forge issues; use the dedicated review, analysis, or Forge workflows instead.

Security analysis

Caution
Quality score86/100

The skill performs legitimate read-only SonarCloud queries against the official API and contains no destructive, obfuscated, or secret-exfiltrating behavior. Because it requires Bash, network calls, and a bearer token, it warrants ordinary caution rather than being risk-free.

Findings
  • •Uses Bash/curl and network access to call the SonarCloud REST API.
  • •Reads SONARCLOUD_TOKEN from the environment and sends it in an Authorization header to sonarcloud.io; token should be scoped read-only and protected from logs.
How this analysis is made

Examples

Pre-ship quality gate
/sonarcloud gate my-project --branch develop
Critical issues on develop
Check the SonarCloud quality gate before I ship and show blocker or critical bugs on develop.
New-code issues on a PR
What new-code SonarCloud issues are on PR 214 for my-project?

name: sonarcloud description: > Query SonarCloud code-quality data via the /sonarcloud slash command — the fast in-context lookup for a project, branch, or PR. Handles issues, metrics, gate (pass/fail + failed conditions), health, pr <number>, hotspots, history, plus --branch, --severity, --type, --new-code filters. Use the moment the user types /sonarcloud ... or asks in plain language: "what does SonarCloud say about this PR", "check the SonarCloud quality gate before I ship", "SonarCloud blocker/critical bugs on develop", "new-code SonarCloud issues on PR 214". Only READS/reports — does NOT fix findings or reply-to/resolve PR threads (that is review); it is the lightweight command surface, NOT the deep-analysis session correlating findings with local source or history trends (that is sonarcloud-analysis). Not for local SAST scans of your own code, nor the Forge issue tracker (forge issue ..., "open/ready issues") — here those bare words always mean SonarCloud. allowed-tools: Bash, Read, Grep, Glob, WebFetch terminal: true

SonarCloud Query Command

Pull code quality data from SonarCloud. Requires SONARCLOUD_TOKEN environment variable.

Arguments

  • $ARGUMENTS - Query type and parameters

Query Types

| Query | Description | Example | |-------|-------------|---------| | issues <project> | Get open issues | /sonarcloud issues my-project | | metrics <project> | Get code metrics | /sonarcloud metrics my-project | | gate <project> | Quality gate status | /sonarcloud gate my-project | | health <project> | Full health report | /sonarcloud health my-project | | pr <project> <pr#> | PR analysis | /sonarcloud pr my-project 123 | | hotspots <project> | Security hotspots | /sonarcloud hotspots my-project | | history <project> | Analysis history | /sonarcloud history my-project |

Filters (append to query)

| Filter | Description | Example | |--------|-------------|---------| | --branch <name> | Filter by branch | --branch develop | | --severity <levels> | Filter severity | --severity BLOCKER,CRITICAL | | --type <types> | Filter issue type | --type BUG,VULNERABILITY | | --new-code | Only new code issues | --new-code |

Instructions

  1. Parse the query from $ARGUMENTS to determine:
    • Query type (issues, metrics, gate, health, pr, hotspots, history)
    • Project key
    • Optional filters (branch, severity, type, new-code, etc.)
  2. Check for SONARCLOUD_TOKEN environment variable. If not set, inform user.
  3. Check for SONARCLOUD_ORG environment variable or ask user for organization key.
  4. Execute the appropriate API call against the SonarCloud REST API (see the API Reference section below for endpoints)
  5. Format and present results clearly:
    • For issues: Group by severity/type, show file, line, message
    • For metrics: Show as table with metric name and value
    • For quality gate: Show pass/fail with failed conditions
    • For health: Comprehensive summary with all data
  6. Offer follow-up actions:
    • "Show issues in specific file?"
    • "Get more details on a specific issue?"
    • "Compare with another branch?"

Example Outputs

Issues Query

📋 Open Issues for my-project (branch: main)

Total: 45 issues

By Severity:
  🔴 BLOCKER: 2
  🟠 CRITICAL: 5
  🟡 MAJOR: 18
  ⚪ MINOR: 15
  ⚫ INFO: 5

By Type:
  🐛 BUG: 8
  🔓 VULNERABILITY: 3
  💩 CODE_SMELL: 34

Top Issues:
1. [CRITICAL] src/auth/login.ts:42 - SQL injection vulnerability
2. [BLOCKER] src/api/users.ts:156 - Null pointer dereference
...

Metrics Query

📊 Metrics for my-project

| Metric | Value |
|--------|-------|
| Lines of Code | 51,234 |
| Coverage | 78.5% |
| Duplications | 3.2% |
| Bugs | 8 |
| Vulnerabilities | 3 |
| Code Smells | 34 |
| Technical Debt | 4d 2h |
| Maintainability | A |
| Reliability | B |
| Security | A |

Quality Gate Query

🚦 Quality Gate: ❌ FAILED

Failed Conditions:
| Metric | Threshold | Actual |
|--------|-----------|--------|
| Coverage on New Code | ≥ 80% | 65.3% |
| New Bugs | = 0 | 2 |

Passed Conditions:
| Metric | Threshold | Actual |
|--------|-----------|--------|
| New Vulnerabilities | = 0 | 0 |
| Duplicated Lines | ≤ 3% | 1.2% |

API Reference

Base URL: https://sonarcloud.io/api

Key Endpoints

# Issues
curl -H "Authorization: Bearer $TOKEN" \
  "https://sonarcloud.io/api/issues/search?organization=$ORG&componentKeys=$PROJECT&resolved=false"

# Metrics
curl -H "Authorization: Bearer $TOKEN" \
  "https://sonarcloud.io/api/measures/component?component=$PROJECT&metricKeys=bugs,vulnerabilities,coverage"

# Quality Gate
curl -H "Authorization: Bearer $TOKEN" \
  "https://sonarcloud.io/api/qualitygates/project_status?projectKey=$PROJECT"

# Hotspots
curl -H "Authorization: Bearer $TOKEN" \
  "https://sonarcloud.io/api/hotspots/search?projectKey=$PROJECT&status=TO_REVIEW"

Full Skill Reference

See skills/sonarcloud-analysis/SKILL.md for complete API documentation including:

  • All endpoints and parameters
  • Response structures
  • Pagination handling
  • Advanced filtering
  • Integration patterns

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/sonarcloud-query-mryiqgl9/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/sonarcloud-query-mryiqgl9' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/sonarcloud-query-mryiqgl9/download' --output '.skill-downloads/sonarcloud-query-mryiqgl9/SKILL.md.part' && mv '.skill-downloads/sonarcloud-query-mryiqgl9/SKILL.md.part' '.skill-downloads/sonarcloud-query-mryiqgl9/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Bash, Read, Grep, Glob, WebFetch

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/sonarcloud-query-mryiqgl9/SKILL.md' && test -s '.skill-downloads/sonarcloud-query-mryiqgl9/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/sonarcloud' && cp -R '.skill-downloads/sonarcloud-query-mryiqgl9' '.claude/skills/sonarcloud'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/sonarcloud-query-mryiqgl9'

openskills read 'sonarcloud-query-mryiqgl9'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/sonarcloud-query-mryiqgl9/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills