---
name: "sonarqube-clean-code-quality-gate"
description: "Enforce clean code principles, code coverage thresholds, and security hotspots."
metadata:
  author: "SonarSource"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure sonarqube quality gate"
  - "fix sonarqube code smell"
  - "setup sonar-project.properties"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# SonarQube Quality Gate & Code Quality

Configures SonarQube / SonarCloud scanning: sonar-project.properties, Quality Gate definitions, bug/code smell triage, and branch coverage enforcement.

## When to Invoke
Invoke this skill whenever you need to:
- configure sonarqube quality gate
- fix sonarqube code smell
- setup sonar-project.properties

## Execution SOP & Rules
1. Define sonar.projectKey, sonar.sources, and sonar.tests inside sonar-project.properties.
2. Pass test execution and coverage report paths (e.g. lcov.info, coverage.xml) to the scanner.
3. Address high-severity vulnerabilities before merging feature branches into main.
4. Exclude auto-generated files and vendor packages using sonar.exclusions.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
