Define your architecture with your coding agent in SonarQube

Hello community,

Since launch, defining the intended architecture in SonarQube for automated checks has meant building it by hand in the Web UI editor. Your agent can do that work with you.

You can now ask your coding agent to explore your architecture and define the intended architecture with you, through the SonarQube CLI and the SonarQube MCP Server. Getting started with architecture takes one prompt.

Ask your agent about your architecture

Your agent reads the current architecture of your project straight from SonarQube Cloud. Ask it what you would ask a colleague who knows the codebase.

  • What are the top-level components of this project?
  • How does the billing component use the persistence component?
  • Which components depend on this component?

Your agent starts with a focused architecture view and can request more detail for specific components as needed.

Define the intended architecture together

Ask your agent to set up the intended architecture. It proposes components and allowed relationships based on the current architecture and what you tell it. You decide what to keep and what to leave out.

Ask your agent to preview the changes, review them together, and confirm before saving. It works with your own SonarQube permissions, so it can only change what you can change.

The result appears on the Intended architecture page, like a model built in the Web UI editor. The next analysis checks your code against it and raises deviations as issues. You can keep refining it with your agent, one level at a time.

Get started

  1. Install the SonarQube CLI and log in to SonarQube Cloud.

  2. If you use Claude Code or Cursor, run sonar architecture install-skill in your terminal. It teaches your agent how to explore the architecture via a skill and to confirm changes with you before saving.

  3. In your project, start a new agent session and ask “Show me the top-level architecture of this project”, then “Help me define the intended architecture”. With other agents, ask them to run sonar architecture --help to discover the commands.

If you use the SonarQube MCP Server instead, update to the latest release containing architecture support, add architecture to your existing SONARQUBE_TOOLSETS configuration, and restart the MCP connection.

Build your own integrations

The same capabilities are available as public, documented Web API endpoints. You can read the current architecture, and create, read, replace, or delete the intended architecture for a project.

Use them to set up the intended architecture in many projects from one template, or to bring architecture into your own tools. Reads need “Browse” permission on the project, and writes need the “Administer architecture” permission.

Availability

Available now in SonarQube Cloud. SonarQube Server support will come in next releases.

Supported languages: Java, C#, JavaScript, TypeScript, Python.

To learn more, see the documentation and the architecture resource center.

5 Likes