# SonarQube CLI in agentic workflows

This page explains how to use SonarQube CLI in agentic workflows, including integration with Claude Code.

## Claude Code integration

The `sonar integrate claude` command integrates [SonarQube CLI](https://docs.sonarsource.com/sonarqube-cli/) with Claude Code so you can perform tasks from the command line, such as:

**Secrets scanning**: Set up hooks that run before Claude reads or writes files. Once set up, Claude Code automatically blocks operations that would expose secrets. For more information, see [Set up the Claude Code hook](/sonarqube-cli/integrations/claude-code.md).

**Code verification with Agentic Analysis**: Configure [Agentic Analysis](https://docs.sonarsource.com/sonarqube-cloud/analyzing-source-code/agentic-analysis) on SonarQube Cloud.

**Dependency analysis**: Scan your project's open-source dependencies for known vulnerabilities, malware, and prohibited licenses with `sonar analyze dependency-risks`. Available on SonarQube Cloud and on SonarQube Server 2026.4+ with Advanced Security and SCA enabled. See [sca.md](/sonarqube-cli/analysis/sca.md).

**Context Augmentation:** Provide context to your agent to make it generate better code. See [Add context to generate better code](/agent-centric-development-cycle/how-to-guides/add-context-to-generate-better-code.md).

## List of commands

For the full list of SonarQube CLI commands, see [Commands](https://cli.sonarqube.com/commands.html#sonar-auth-login).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/agent-centric-development-cycle/developer-tools/sonarqube-cli-in-agentic-workflows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
