sonarcloud-pr-audit

Fetches SonarCloud quality gate results for pull requests and fixes reported issues.

Updated May 11, 2026
One-click install
npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill sonarcloud-pr-audit-thachrocky12345
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sonarcloud-pr-audit
Source: https://github.com/thachrocky12345/local-agent-train-workstation/tree/main/.claude/skills/sonarcloud-pr-audit
Command: npx skills add https://github.com/thachrocky12345/local-agent-train-workstation --skill sonarcloud-pr-audit-thachrocky12345

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually checking SonarCloud quality gates after every push and triaging each reported issue is repetitive and error-prone. This Skill automates the full scan-evaluate-fix loop so pull requests stay clean without waiting for manual review of static analysis results. ## Core Features & Use Cases - Quality Gate Retrieval: Pulls quality gate status, issue lists, coverage, and duplication metrics from the SonarCloud API or from PR comments when no token is available. - Issue Triage and Auto-Fix: Classifies issues by severity and type, then applies rule-specific fixes for Python/Django and TypeScript/React code, committing and pushing the results. - Fallback Modes: Falls back to reading SonarCloud bot PR comments, waiting for pending checks, or running a static audit of changed files when API access is unavailable. - Use Case: After pushing code to a PR branch, automatically fetch the SonarCloud report, fix all BLOCKER and CRITICAL issues, and push a single commit resolving them before reviewers look at the PR. ## Quick Start Ask the assistant to run the SonarCloud audit on the current pull request and fix all fixable issues.

Frequently Asked Questions about sonarcloud-pr-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I check SonarCloud quality gate results for a pull request?

Run the audit with the repository and PR number, or let it infer both from the current git branch using the GitHub CLI. It queries the SonarCloud qualitygates API with your SONAR_TOKEN and reports gate status, conditions, and issue counts.

How to automatically fix SonarCloud issues in Python or TypeScript code?

The audit classifies each issue by severity and type, then applies rule-specific fixes such as extracting duplicated string literals, removing unused variables, or replacing hardcoded secrets. Fixes are committed in a single commit and pushed to the PR branch.

Can I get SonarCloud PR results without a SONAR_TOKEN?

Yes. The audit can parse the SonarCloud bot's PR comment via the GitHub CLI to get gate status, issue counts, coverage, and duplication. Without a token it cannot retrieve file and line details, so it falls back to a static audit of changed files.

What happens if the SonarCloud check is still pending on my PR?

The audit polls the PR checks with the GitHub CLI, waiting 30 seconds between retries for up to five attempts. Once the check completes, it reads the posted comment or queries the API for full results.

Which SonarCloud issues are fixed automatically versus skipped?

BLOCKER and CRITICAL issues are always fixed, MAJOR issues are fixed unless they require architectural decisions, and MINOR issues are fixed only when trivial. INFO issues and items needing human judgment are logged in the report instead.