astrai-code-review

AI-powered code review with intelligent model routing — saves 40%+ vs always using the most expensive model

3,891 stars

Best use case

astrai-code-review is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

AI-powered code review with intelligent model routing — saves 40%+ vs always using the most expensive model

Teams using astrai-code-review should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/astrai-code-review/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/beee003/astrai-code-review/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/astrai-code-review/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How astrai-code-review Compares

Feature / Agentastrai-code-reviewStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

AI-powered code review with intelligent model routing — saves 40%+ vs always using the most expensive model

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Astrai Code Review

AI-powered code review with intelligent model routing.
Complex logic goes to powerful models. Formatting and style goes to fast, cheap ones. You save 40%+ without sacrificing quality.

## What it does

- **Smart routing for reviews**: Astrai analyzes the diff complexity and routes to the optimal model. A gnarly concurrency bug gets Opus. A missing semicolon gets Haiku. You only pay for the intelligence you need.
- **Structured output**: Every review returns typed issues with file, line number, severity (critical/warning/info), message, and a concrete suggestion.
- **Strictness modes**: Standard catches bugs and logic errors. Strict adds style and best-practice checks. Security mode focuses on vulnerabilities, injection, auth, and data exposure.
- **BYOK (Bring Your Own Keys)**: Your provider API keys stay with you. Astrai decides which model to use, then calls the provider using YOUR key. You pay providers directly.
- **Cost tracking**: Every review response includes the cost and how much you saved vs always using the most expensive model.
- **Local-only mode**: If you only set `ASTRAI_API_KEY` without provider keys, Astrai uses its own hosted models. Still routed intelligently, still cheap.

## Setup

1. Get a free API key at [as-trai.com](https://as-trai.com)
2. Set `ASTRAI_API_KEY` in your environment or skill config
3. Optionally add provider API keys for BYOK routing (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`)
4. Run `/review` on any diff or PR

## Usage

```
/review                     Review the current diff (staged changes)
/review --strict            Strict mode: bugs + style + best practices
/review --focus security    Security-focused review (vulns, injection, auth)
/review --file src/auth.py  Review a specific file
```

### Examples

**Basic review of staged changes:**
```
/review
```
Returns issues found in the current diff with severity levels and suggestions.

**Strict review for a PR:**
```
/review --strict
```
Catches not just bugs but also style violations, naming issues, and missed best practices.

**Security audit:**
```
/review --focus security
```
Focuses on SQL injection, XSS, auth bypass, hardcoded secrets, insecure deserialization, and other vulnerability classes.

## Environment Variables

| Variable | Required | Description | Default |
|---|---|---|---|
| `ASTRAI_API_KEY` | Yes | Your API key from as-trai.com | -- |
| `ANTHROPIC_API_KEY` | No | Anthropic key for BYOK routing | -- |
| `OPENAI_API_KEY` | No | OpenAI key for BYOK routing | -- |
| `GOOGLE_API_KEY` | No | Google key for BYOK routing | -- |
| `DEEPSEEK_API_KEY` | No | DeepSeek key for BYOK routing | -- |
| `MISTRAL_API_KEY` | No | Mistral key for BYOK routing | -- |
| `GROQ_API_KEY` | No | Groq key for BYOK routing | -- |
| `TOGETHER_API_KEY` | No | Together key for BYOK routing | -- |
| `FIREWORKS_API_KEY` | No | Fireworks key for BYOK routing | -- |
| `COHERE_API_KEY` | No | Cohere key for BYOK routing | -- |
| `PERPLEXITY_API_KEY` | No | Perplexity key for BYOK routing | -- |
| `REVIEW_STRICTNESS` | No | standard, strict, or security | standard |

## External Endpoints

| Endpoint | Purpose | Data Sent |
|---|---|---|
| `https://as-trai.com/v1/chat/completions` | Code review inference via intelligent routing | Diff content, file context, review instructions |

## Security & Privacy

- All requests authenticated via API key in the Authorization header
- Diffs are sent to the Astrai routing API, which forwards to the selected provider
- In BYOK mode, provider keys are sent via encrypted header (`X-Astrai-Provider-Keys`) and never stored
- No diffs, code, or review results are retained by Astrai after the request completes
- Source code is fully open: [github.com/beee003/astrai-openclaw](https://github.com/beee003/astrai-openclaw)

## Model Invocation

This skill sends code diffs to the Astrai routing API. The router classifies the review complexity and selects the best model:

- **High complexity** (concurrency, security, architecture): Routes to Claude Opus, GPT-4o, or Gemini Pro
- **Medium complexity** (logic errors, missing edge cases): Routes to Claude Sonnet, GPT-4o-mini, or Gemini Flash
- **Low complexity** (formatting, typos, naming): Routes to Claude Haiku, GPT-4o-mini, or Gemini Flash

Your prompts are processed by third-party LLM providers according to the routing decision. In BYOK mode, calls are made using your own provider API keys.

## Pricing

Same as Astrai platform pricing:

- **Free**: 1,000 requests/day, smart routing, all strictness modes
- **Pro** ($49/mo): Unlimited requests, priority routing, analytics dashboard
- **Business** ($199/mo): Team dashboards, compliance exports, SLA guarantee

Related Skills

Post-Mortem & Incident Review Framework

3891
from openclaw/skills

Run structured post-mortems that actually prevent repeat failures. Blameless analysis, root cause identification, and action tracking.

DevOps & Infrastructure

Pitch Deck Reviewer

3891
from openclaw/skills

Reviews pitch decks and provides investor-ready feedback with scoring

Business Strategy & Growth

Performance Review Engine

3891
from openclaw/skills

> Your AI-powered performance management system. Write reviews that develop people, not just evaluate them. From self-assessments to 360° feedback to calibration — complete frameworks for every review cycle.

Workflow & Productivity

Deal Desk — Structured Deal Review & Approval

3891
from openclaw/skills

Run every non-standard deal through a repeatable review process. Catch margin leaks, enforce discount guardrails, and close faster with pre-approved terms.

Contract Review Assistant

3891
from openclaw/skills

Analyze business contracts for risks, unfavorable terms, and missing clauses. Get a plain-English summary of what you're signing.

Legal & Finance

afrexai-code-reviewer

3891
from openclaw/skills

Enterprise-grade code review agent. Reviews PRs, diffs, or code files for security vulnerabilities, performance issues, error handling gaps, architecture smells, and test coverage. Works with any language, any repo, no dependencies required.

Coding & Development

performance-review-cn

3891
from openclaw/skills

绩效面谈报告、OKR对齐度检测、校准辅助

Workflow & Productivity

clawdtm-review

3891
from openclaw/skills

Review and rate OpenClaw skills on ClawdTM. See what humans and AI agents recommend.

General Utilities

cyber-owasp-review

3891
from openclaw/skills

Map application security findings to OWASP Top 10 categories and generate remediation checklists. Use for normalized AppSec review outputs and category-level prioritization.

Security

Contract Reviewer - AI Legal Document Risk Scanner

3891
from openclaw/skills

Upload any contract or legal document and get a structured risk analysis with flagged clauses, plain-language explanations, and negotiation suggestions.

serde-code-review

3891
from openclaw/skills

Reviews serde serialization code for derive patterns, enum representations, custom implementations, and common serialization bugs. Use when reviewing Rust code that uses serde, serde_json, toml, or any serde-based serialization format. Covers attribute macros, field renaming, and format-specific pitfalls.

rust-testing-code-review

3891
from openclaw/skills

Reviews Rust test code for unit test patterns, integration test structure, async testing, mocking approaches, and property-based testing. Use when reviewing _test.rs files,