Prompt examples

Examples of prompts to use when working with an agent and the SonarQube MCP Server.

After you've set up the SonarQube MCP Server, here are some example prompts for common real-world scenarios. New SonarQube MCP Server tools are added regularly. Always pull the latest version.

If a feature isn't available, retrieve the full set of results and ask the agent to filter them. For example, the SonarQube MCP Server doesn't support filtering issues by author. To find issues authored by Claudia, fetch all issues and then ask your AI agent to filter the results to those written by Claudia.

Analyze files or code snippets with SonarQube

In the chat, ask the agent to perform the following actions:

analyze the current file with SonarQube
analyze the following piece of code with SonarQube: <YourCodeHere>
  • Note that this command has limitations as some analyzers require the full context of the file to run an analysis.

Add explicit context for analysis in Cursor using custom context.

Fix a failing quality gate

My quality gate is failing for my project. Can you help me understand why and fix the most critical issues?
The quality gate on my feature branch is red. What do I need to fix to get it passing before I can merge to main?

Pre-release and pre-merge checks

I'm about to merge my pull request <#247> for the <web-app> project. Can you check if there are any quality issues I should address first?
We're deploying to production tomorrow. Can you check the quality gate status and alert me to any critical issues in this branch?

Improve code quality

I want to reduce technical debt in my project. What are the top issues I should prioritize?

Understand and fix issues

Security and dependency management

Code review assistance

Project health monitoring

Team collaboration

Last updated

Was this helpful?