Skip to main content
skill CX Codex

sonarqube · claude-dev-suite — Claude Code skill: what it does, how to install

Configures code quality tracking with SonarQube and SonarCloud. Sets up scanner properties, quality gates, and CI/CD pipelines.

MIT 106 installs ★ 50 updated 2026-10-23

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add claude-dev-suite/claude-dev-suite --skill sonarqube -a claude-code
Open on GitHub

What sonarqube does

This skill provides step-by-step guidance for connecting SonarQube or cloud-hosted SonarCloud to your repository. It covers configuring sonar-project.properties, launching a local instance via docker-compose.yml, plugging the Maven scanner into Java builds, and querying quality status via REST API.

The instructions intentionally bypass basic JavaScript linting, vulnerability audits, and test execution, leaving those to dedicated linters and test runners. Scans will fail immediately if your continuous integration environment lacks a valid SONAR_TOKEN.

What it helps with

  • generate a sonar-project.properties file with coverage report exclusions
  • spin up a self-hosted SonarQube instance using Docker Compose and PostgreSQL
  • integrate SonarCloud scanning into automated continuous integration workflows
  • configure custom quality gates to monitor debt and bugs on incoming code

Example prompts for the agent

  • Generate a sonar-project.properties file that excludes test files from coverage
  • Create a docker-compose.yml to run a local SonarQube instance connected to PostgreSQL
  • Configure an automated scanning step for SonarCloud inside our pipeline

How to install sonarqube

1Skills CLI (Vercel)

npx skills add claude-dev-suite/claude-dev-suite --skill sonarqube -a claude-code

2Manually: put the files in place

~/.claude/skills/sonarqube/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/sonarqube/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about sonarqube

How to install sonarqube in Claude Code?

Run npx skills add claude-dev-suite/claude-dev-suite --skill sonarqube -a claude-code in your terminal.

What does the sonarqube skill do?

It guides the assistant through configuring SonarQube or SonarCloud, adjusting quality gate rules, and creating scanner build scripts.

Does this skill replace local linters like ESLint or Biome?

No, fast frontend linting and direct test runs are handled by separate tools rather than SonarQube scanners.

Source text

SKILL.md · MIT
---
name: sonarqube
description: |
  SonarQube/SonarCloud integration for continuous code quality.
  Setup, configuration, quality gates, and CI/CD integration.

  USE WHEN: user mentions "SonarQube", "SonarCloud", "quality gates", asks about "code coverage", "technical debt", "code smells", "sonar-project.properties", "SonarScanner"

  DO NOT USE FOR: ESLint/Biome - use linting skills, OWASP security - use security skills, testing tools - use Vitest/Playwright skills
allowed-tools: Read, Grep, Glob
---

# SonarQube / SonarCloud

## When NOT to Use This Skill
- **JavaScript/TypeScript linting** - Use `eslint-biome` skill for faster feedback
- **Security scanning** - Use `owasp-top-10` or security-scanner MCP
- **Test execution** - Use Vitest/Playwright skills for running tests
- **Code coverage generation** - Use JaCoCo/Vitest skills for coverage

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `sonarqube` for comprehensive documentation.

## Official Documentation

| Resource | Link |
|----------|------|
| **SonarQube Docs** | https://docs.sonarsource.com/sonarqube/latest/ |
| **SonarCloud Docs** | https://docs.sonarsource.com/sonarcloud/ |
| **Rules Repository** | https://rules.sonarsource.com/ |
| **API Reference** | https://sonarcloud.io/web_api/ |

---

## Quick Setup

### SonarCloud (Recommended for Open Source)

```bash
# 1. Connect repo at sonarcloud.io
# 2. Create sonar-project.properties
```

```properties
# sonar-project.properties
sonar.projectKey=org_project
sonar.organization=your-org
sonar.sources=src
sonar.tests=tests
sonar.javascript.lcov.reportPaths=coverage/lcov.info
sonar.coverage.exclusions=**/*.test.ts,**/*.spec.ts
```

### SonarQube (Self-hosted)

```yaml
# docker-compose.yml
services:
  sonarqube:
    image: sonarqube:lts-community
    ports:
      - "9000:9000"
    environment:
      - SONAR_JDBC_URL=jdbc:postgresql://db:5432/sonar
    volumes:
      - sonarqube_data:/opt/sonarqube/data
```

---

## Quality Gates

### Default Quality Gate Conditions

| Metric | Condition | Target |
|--------|-----------|--------|
| Coverage | on new code | ≥ 80% |
| Duplicated Lines | on new code | ≤ 3% |
| Maintainability Rating | on new code | A |
| Reliability Rating | on new code | A |
| Security Rating | on new code | A |
| Security Hotspots Reviewed | on new code | 100% |

### Custom Quality Gate

```bash
# Create via API
curl -X POST "https://sonarcloud.io/api/qualitygates/create" \
  -H "Authorization: Bearer $SONAR_TOKEN" \
  -d "name=Strict"
```

---

## CI/CD Integration

### GitHub Actions

```yaml
# .github/workflows/sonar.yml
name: SonarCloud
on: [push, pull_request]

jobs:
  sonarcloud:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: SonarCloud Scan
        uses: SonarSource/sonarcloud-github-action@master
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
```

### Maven (Java)

```xml
<!-- pom.xml -->
<plugin>
    <groupId>org.sonarsource.scanner.maven</groupId>
    <artifactId>sonar-maven-plugin</artifactId>
    <version>3.10.0.2594</version>
</plugin>
```

```bash
mvn sonar:sonar \
  -Dsonar.projectKey=project \
  -Dsonar.host.url=https://sonarcloud.io \
  -Dsonar.token=$SONAR_TOKEN
```

---

## Key Metrics

| Metric | Description | Good Value |
|--------|-------------|------------|
| **Bugs** | Reliability issues | 0 |
| **Vulnerabilities** | Security issues | 0 |
| **Code Smells** | Maintainability issues | Minimize |
| **Coverage** | Test coverage % | > 80% |
| **Duplications** | Duplicated code % | < 3% |
| **Cognitive Complexity** | Code understandability | < 15/function |

---

## Language-Specific Rules

| Language | Rules | Link |
|----------|-------|------|
| JavaScript/TS | 422 | https://rules.sonarsource.com/javascript/ |
| Java | 733 | https://rules.sonarsource.com/java/ |
| Python | 300+ | https://rules.sonarsource.com/python/ |
| C# | 400+ | https://rules.sonarsource.com/csharp/ |
| Go | 100+ | https://rules.sonarsource.com/go/ |

---

## Excluding Files

```properties
# sonar-project.properties
sonar.exclusions=**/node_modules/**,**/dist/**,**/*.test.ts
sonar.coverage.exclusions=**/tests/**,**/__mocks__/**
sonar.cpd.exclusions=**/generated/**
```

---

## API Examples

```bash
# Get project status
curl "https://sonarcloud.io/api/qualitygates/project_status?projectKey=KEY" \
  -H "Authorization: Bearer $SONAR_TOKEN"

# Get issues
curl "https://sonarcloud.io/api/issues/search?componentKeys=KEY&types=BUG" \
  -H "Authorization: Bearer $SONAR_TOKEN"

# Get metrics
curl "https://sonarcloud.io/api/measures/component?component=KEY&metricKeys=coverage,bugs,vulnerabilities" \
  -H "Authorization: Bearer $SONAR_TOKEN"
```

---

## Anti-Patterns

| Anti-Pattern | Why It's Bad | Correct Approach |
|--------------|--------------|------------------|
| No quality gate on PRs | Merging bad code | Enable PR decoration, block on failure |
| Excluding all tests from coverage | Inflated coverage numbers | Only exclude test utilities |
| Ignoring code smells | Technical debt accumulates | Fix or justify with comments |
| No coverage reporting | Can't track quality trends | Configure coverage reports in CI |
| Using default quality gate | Too lenient for most projects | Create custom stricter gate |
| Not reviewing Security Hotspots | Potential vulnerabilities missed | Review all hotspots before release |

## Quick Troubleshooting

| Issue | Likely Cause | Solution |
|-------|--------------|----------|
| Quality gate failed unexpectedly | New code coverage < 80% | Add tests or adjust coverage target |
| Analysis not running | Missing SONAR_TOKEN | Add token to CI secrets |
| Coverage always 0% | Wrong report path | Check `sonar.javascript.lcov.reportPaths` |
| Duplicated code false positives | Boilerplate code | Add to `sonar.cpd.exclusions` |
| Too many issues reported | First scan on legacy code | Use "New Code" focus, fix incrementally |
| PR decoration not working | Missing GitHub App integration | Configure SonarCloud GitHub App |

---

## Related Skills
- [Quality Principles](../common/SKILL.md)
- [GitHub Actions](../../ci-cd/github-actions/SKILL.md)
- [JaCoCo](../jacoco/SKILL.md)

© claude-dev-suite · MIT · claude-dev-suite/claude-dev-suite

Similar skills

All skills for Code review and refactoring →

sonarqube by other authors comes first.

sonarqube DougTrajano Enables coding agents to operate SonarQube repositories via the sonar CLI: inspect quality gates, check issues, scan for secrets, and analyze code changes. CX Codex +1 ★ 381repo stars sonarqube-mcp giuseppe-trisciuoglio sonarqube-mcp is a Claude Code skill that connects agent workflows to SonarQube and SonarCloud checks. It responds to requests about quality gates, Sonar issues, code analysis, and rules. CX Codex +1 3,800installs SonarQube MCP Server SonarSource Wires SonarQube Server or Cloud into your AI assistant so the agent can read code quality and security findings and analyze a snippet in context. CX Codex +1 ★ 693repo stars sast-scanning devops-skills sast-scanning — a skill that walks through static application security testing, so flaws in source code surface before deployment. Handy when you wire a security gate into CI/CD. CX Codex +1 415installs ai-quality-gate mustafacagri ai-quality-gate runs AI-written code through ESLint and Prettier, fixes what it can and hands the leftovers back to the agent. CX Codex +1 ★ 31repo stars qe-quality-assessment proffesor-for-testing qe-quality-assessment reviews code quality through complexity, lint, code smells, and test health. Use it for release scoring, quality gates, and deployment checks. CX Codex +1 129installs fallow-setup fallow-rs fallow-setup sets up code-quality checks in a JavaScript or TypeScript repo: installs Fallow and adds a CI gate. Useful when starting a project. CX Codex +1 213installs

From the same set14

The whole set →

Project sponsors

Companies that keep this analytics open