sonar-analyze
Analyze a file for quality and security issues using SonarQube
Fix a specific SonarQube issue in code by rule key and location
$ npx -y skills add SonarSource/sonarqube-agent-plugins --skill sonar-fix-issue --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/sonar-fix-issueContext preview
The summary Claude sees to decide when to auto-load this skill.
Fix a specific SonarQube issue in code by rule key and location
name: sonar-fix-issue description: Fix a specific SonarQube issue in code by rule key and location argument-hint: "[rule-key] [file-path:line]" allowed-tools: Read, Edit, Bash(sonar:*)
Fix a code quality or security issue identified by SonarQube.
sonar-fix-issue java:S1481 src/main/java/MyClass.java:42 sonar-fix-issue python:S2077 src/auth/login.py sonar-fix-issue Remove unused variable in MyClass.java
Parse the user-provided arguments for:
If neither a rule key nor a file path can be determined, ask: *"Which rule and file should I fix?"*
Call `mcp__sonarqube__show_rule` with the rule key to retrieve the full rule description, rationale, and remediation guidance before touching any code. **Do not add extra parameters** (such as `projectKey`) unless the tool schema requires them — after integration, rule lookup usually needs only the rule key.
If the MCP tool is unavailable, fall back to `sonar api get "/api/rules/show?key=<rule-key>"`. If `sonar` is also unavailable or unauthenticated, rely on built-in knowledge of SonarQube rules.
Read the full file content. If a line number was given, focus analysis around that line but read the whole file to understand context.
After editing, briefly explain:
Made by Sonar SonarQube is the AI code quality and security verification platform used by millions of developers to catch bugs, vulnerabilities, and leaked secrets.
Analyze a file for quality and security issues using SonarQube
Find files with low test coverage and inspect uncovered lines in a SonarQube project (project key optional when MCP integration…
Search for software composition analysis (SCA) dependency risks in a SonarQube project (project key optional when MCP integration…
Find files with code duplications in a SonarQube project and inspect duplication blocks for a file (project key optional when MCP…
Installs sonarqube-cli if not already installed, authenticates, and integrates SonarQube with the current agent (installs…
Search and filter SonarQube issues for a project, branch, or pull request via sonarqube-cli (`-p` is always required on the CLI;…