An AI-powered pull request review tool for Azure DevOps that uses Anthropic Claude to automatically analyze code changes and provide actionable feedback directly in your terminal.
- 🔍 Fetches PRs assigned to you across all repositories in an Azure DevOps project
- 🤖 AI-powered review using Claude — identifies bugs, security issues, performance problems, and bad patterns
- 🎛️ Interactive selection — choose one or multiple PRs to review in a single run
- 📊 Severity-rated comments — Critical 🔴, Warning 🟡, Info 🔵
- 💬 Post comments back to Azure DevOps with a single confirmation
- 💾 Saves reviews to disk as markdown files for later reference
- 🖥️ Rich terminal UI powered by Spectre.Console
| Requirement | Notes |
|---|---|
| .NET 10 SDK | Runtime and build toolchain |
| Azure DevOps account | With access to the target project |
| Azure DevOps PAT | Personal Access Token with Code (Read) and Code (Write) scopes |
| Anthropic API Key | Claude API access |
git clone https://github.com/thekim1/AzureDevopsPrReviewBot.git
cd AzureDevopsPrReviewBotOpen PrReviewBot/appsettings.json and fill in your values:
{
"AzureDevOps": {
"OrganizationUrl": "https://dev.azure.com/YOUR_ORG",
"Project": "YOUR_PROJECT",
"PersonalAccessToken": "YOUR_PAT_HERE",
"ReviewerEmail": "you@example.com"
},
"Claude": {
"ApiKey": "YOUR_ANTHROPIC_API_KEY",
"Model": "claude-sonnet-4-6"
},
"Ollama": {
"ApiKey": "YOUR_OLLAMA_API_KEY",
"BaseUrl": "https://ollama.com/api",
"Model": "glm-5.2:cloud"
}
}
⚠️ Do not commit secrets. Use .NET User Secrets or environment variables instead.
At startup the app asks which provider to use (Claude or Ollama). Both the Anthropic API key and the Ollama API key can be configured; only the selected provider is used per run.
cd PrReviewBot
dotnet runThe app loads configuration from the following sources in order (later sources override earlier ones):
appsettings.json- .NET User Secrets
- Environment variables
| Key | Description |
|---|---|
AzureDevOps:OrganizationUrl |
Your Azure DevOps org URL, e.g. https://dev.azure.com/myorg |
AzureDevOps:Project |
The Azure DevOps project name |
AzureDevOps:PersonalAccessToken |
PAT with Code (Read) + Code (Write) scopes |
AzureDevOps:ReviewerEmail |
Your email — used to identify PRs assigned to you |
Claude:ApiKey |
Your Anthropic API key |
Claude:Model |
Claude model to use (default: claude-sonnet-4-6) |
Ollama:ApiKey |
Your Ollama API key (for ollama.com cloud; leave empty for local Ollama) |
Ollama:BaseUrl |
Ollama API base URL (default: https://ollama.com/api; use http://localhost:11434/api for local) |
Ollama:Model |
Ollama model to use (default: glm-5.2:cloud) |
Keeps secrets out of source control:
cd PrReviewBot
dotnet user-secrets init
dotnet user-secrets set "AzureDevOps:PersonalAccessToken" "YOUR_PAT"
dotnet user-secrets set "Claude:ApiKey" "YOUR_ANTHROPIC_API_KEY"
dotnet user-secrets set "Ollama:ApiKey" "YOUR_OLLAMA_API_KEY"# Windows (PowerShell)
$env:AzureDevOps__PersonalAccessToken = "YOUR_PAT"
$env:Claude__ApiKey = "YOUR_ANTHROPIC_API_KEY"
$env:Ollama__ApiKey = "YOUR_OLLAMA_API_KEY"
# Linux / macOS
export AzureDevOps__PersonalAccessToken="YOUR_PAT"
export Claude__ApiKey="YOUR_ANTHROPIC_API_KEY"
export Ollama__ApiKey="YOUR_OLLAMA_API_KEY"Note: Use double underscores (
__) as the separator for nested keys in environment variables.
┌─────────────────────────────────────────────────────────────┐
│ 1. Connect to Azure DevOps and fetch active PRs assigned │
│ to you across all repositories in the project │
│ │
│ 2. Select which PR(s) to review from an interactive list │
│ │
│ 3. PR diffs are sent to Claude for analysis │
│ │
│ 4. Review results are displayed in the terminal with │
│ severity ratings and suggested code fixes │
│ │
│ 5. Optionally post comments directly to the PR in │
│ Azure DevOps │
│ │
│ 6. Review is saved to a local file in /reviews/ │
└─────────────────────────────────────────────────────────────┘
| Severity | Icon | When Used |
|---|---|---|
| Critical | 🔴 | Security vulnerabilities, data loss, crashes, serious bugs |
| Warning | 🟡 | Performance problems, bad patterns, maintainability issues |
| Info | 🔵 | Style improvements, minor suggestions |
PrReviewBot/
├── Config/
│ └── AppSettings.cs # Strongly-typed configuration classes
├── Models/
│ ├── PullRequestInfo.cs # PR data model
│ └── ReviewComment.cs # Review comment + severity enum
├── Services/
│ ├── AzureDevOpsService.cs # Azure DevOps API integration
│ ├── ClaudeReviewService.cs # Anthropic Claude AI integration
│ ├── OllamaReviewService.cs # Ollama API integration (local or ollama.com)
│ ├── ReviewHelpers.cs # Shared review prompt + response parsing
│ └── ReviewOutputService.cs # Terminal display + file output
├── Program.cs # Entry point + interactive CLI flow
└── appsettings.json # Configuration file
- Go to Azure DevOps → User Settings → Personal Access Tokens
- Click New Token
- Set an expiration date and select the following scopes:
- Code →
Read - Code →
Write(only needed if you want to post comments)
- Code →
- Copy the generated token into your configuration
- Sign in at console.anthropic.com
- Navigate to API Keys and create a new key
- Copy the key into your configuration
| Package | Purpose |
|---|---|
Anthropic |
Official Anthropic SDK for Claude API |
Microsoft.TeamFoundationServer.Client |
Azure DevOps REST API client |
Microsoft.VisualStudio.Services.Client |
Azure DevOps authentication & connection |
Spectre.Console |
Rich terminal UI (colors, spinners, panels) |
Microsoft.Extensions.Configuration.* |
JSON + env var + user secrets config |
Ollama is accessed via plain
HttpClient(no SDK dependency) against the/api/generateendpoint, so it works with both local Ollama and ollama.com.