sonar-duplication
Skill by SonarSource
Lists files with duplicated code in a SonarQube project and shows duplication blocks for a chosen file. It is for developers who use SonarQube through the MCP Server or the sonar CLI.
Install sonar-duplication
Built from the published package, never by AI.
git clone --depth 1 https://github.com/SonarSource/sonarqube-agent-plugins /tmp/sonarqube-agent-plugins && mkdir -p ~/.claude/skills && cp -r /tmp/sonarqube-agent-plugins/skills/sonar-duplication ~/.claude/skills/sonar-duplicationRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/SonarSource/sonarqube-agent-plugins /tmp/sonarqube-agent-plugins && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/sonarqube-agent-plugins/skills/sonar-duplication ~/.gemini/antigravity-cli/skills/sonar-duplicationAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
The sonar-duplication skill finds files that contain duplicated code in a SonarQube project. By default it calls the search_duplicated_files tool and fetches every page of results, up to 10,000 files. It can also scope the list to a pull request, use manual pagination, or skip the list and inspect one file with get_duplications.
For a single file, it returns duplication blocks that show where code repeats, such as line ranges and sibling copies. The skill requires the SonarQube MCP Server to be configured, and it falls back to the sonar api CLI when the MCP tools are unavailable. It is aimed at developers who want to find and review copy-pasted code in SonarQube projects.
Written from the project's SKILL.md and checked against it.
What it can do
- mcp__sonarqube__search_duplicated_filesLists files with duplications, auto-fetching all pages or one page at a time.
- mcp__sonarqube__get_duplicationsReturns the duplication blocks for a single file key.
- Pull request scopeLimits the duplicated-file list to a given pull request with the --pr flag.
- Manual paginationFetches one page of results with page size and page index settings.
- sonar api fallbackUses sonar api calls to list duplicated files or show blocks if the MCP tools are unavailable.
What you need
- SonarQube MCP Server configured for the agent
- Browse permission on the SonarQube project
- Docker, Podman or Nerdctl running for the MCP server
- sonar CLI (sonarqube-cli) for the fallback path
Try asking
- Which files in my SonarQube project have duplicated code?
- Show the duplication blocks for src/auth/login.py
- List duplicated files in pull request 42
Good to know
- Auto-fetch returns at most 10,000 duplicated files.
- Inspecting a file requires Browse permission on its project.
- The MCP server only starts when the container runtime is running.
- Manual page size must be an integer from 1 to 500.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/sonar-duplication/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
Allowed tools: ReadGrepBash(docker ps:*)Bash(podman ps:*)Bash(nerdctl ps:*)Bash(sonar:*)
Alternatives to sonar-duplication
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
sonar-duplication: common questions
Do I need to pass a project key?
Not if the MCP integration already sets a default project. Otherwise the skill reads sonar.projectKey from sonar-project.properties or uses a key the user provides.
What does the skill return for one file?
It returns duplication blocks from get_duplications, including ranges and the other locations where the code is copied, when the API provides them.
What happens if the SonarQube tools are not available?
The skill falls back to sonar api calls. If that also fails, it checks whether the MCP server is registered and whether the container runtime is running.
How do I install sonar-duplication?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is sonar-duplication free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is sonar-duplication safe to use?
It scores 66 of 100. Grades: maintenance A, licence F, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to sonar-duplication?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
