CppDepend AI
Quick start: your first review
Goal: get a CppDepend review of your change in a few minutes of work (plus the time of one analysis).
You need CppDepend installed, with a license that allows analyses, and a .cdproj project for your C++ code that already works in CppDepend. Nothing else.
In the examples, cppdepend-ai stands for the full path of the program in your CppDepend folder, for example "C:\CppDepend\cppdepend-ai.exe".
Tip: add the CppDepend folder to your PATH once, then you can type just cppdepend-ai.
Step 1. Check the program
cppdepend-ai --version
It prints a version number. Do not move or copy the program: it must stay in the CppDepend folder.
Step 2. Set a baseline (once)
A review reports the issues that are new, so CppDepend needs something to compare with: the baseline. In your CppDepend project, set the baseline to an analysis of your main branch (or simply to today's analysis if you want to start fresh). Without a baseline the review has nothing to call "new".
Step 3. Prepare your repository (once)
Open a terminal in your C++ repository folder and run:
cppdepend-ai init
This adds a few small files (instructions for AI assistants and your quality gate). Commit them with your code. What exactly init creates.
Step 4. Analyze your code
Build your code first, then:
cppdepend-ai analyze --run --project MyApp.cdproj
- It can take a few minutes on a large code base. The first time it does a full analysis, the next times it is incremental and much faster. Add
--fullto force a full analysis. - You can omit
--projectwhen there is only one.cdprojin your folder or above it.
Step 5. Get the review
Pick the way that suits you:
| I want... | Run | Needs an AI |
|---|---|---|
| a quick report on my machine | cppdepend-ai review --base main and open review.md (path shown at the end of the command) |
no |
| my AI assistant to review and explain | open your assistant and ask: "Review my change using CppDepend." | yes |
| every pull request reviewed automatically | cppdepend-ai init --ci github, then follow Review on every pull request |
optional |
--base main means "compare with the main branch": use your own target branch name.
What the review looks like
An example of the report:
CppDepend review Quality gate: FAILED
New issues in the files changed since
origin/main: 3 (2 Critical, 1 High) - fixed issues: 1
Severity Rule Location Code element Critical Avoid methods too complex src/net/Parser.cpp:212net::Parser::ParseCritical Avoid namespaces mutually dependent src/net/Socket.cpp:48net::SocketHigh Avoid types with too many methods src/core/Config.h:15core::Config
How to read it and what to do: Review.
What init creates
Run it again whenever you want to refresh the files: your own text in them is never touched, only the CppDepend block.
| File | For whom |
|---|---|
AGENTS.md (the CppDepend instructions, including how to review) |
every assistant that reads it: Codex, Cursor, GitHub Copilot, and many others |
CLAUDE.md and a .claude folder (skills, a reviewer agent, an optional hook file) |
Claude Code (Copilot also reads the skills) |
cppdepend-ai.gate.json |
everyone: your quality gate, the rules that make a review pass or fail |
.gitignore entry |
keeps the generated results out of git |
Some assistants have their own files. Add them with --agents:
cppdepend-ai init --agents all --ci github
| Option | Adds |
|---|---|
--agents cursor |
a Cursor rule: .cursor/rules/cppdepend.mdc |
--agents copilot |
the CppDepend block in .github/copilot-instructions.md |
--agents gemini |
.gemini/settings.json, so Gemini CLI reads AGENTS.md (an existing file is never rewritten: init tells you the line to add) |
--agents all |
all of the above |
--ci github |
a GitHub workflow that reviews every pull request |
If you typed the full path to the program in step 1, use it for init too: it is then written into the instructions and your assistant finds the program by itself.
Your daily routine
- Work as usual (with or without an assistant).
- Build, then
cppdepend-ai analyze --run --quiet. cppdepend-ai review --base main, fix what matters, repeat.- Open your pull request: the automatic review runs again there.
Good to know
analyzedoes not build your code: build first.- After you edit files, the results are out of date until you run
analyze --runagain.cppdepend-ai statustells you. - Without
--run,analyzejust re-reads the latest analysis and is instant. - Using an AI assistant for more than reviews (questions, fixes, refactoring)? See the page of your assistant, listed on the overview.
