# How to Implement Code Review Automation in ECC: A Complete Guide

> Implement code review automation in ECC using the code-reviewer agent. Automate quality, security, and maintainability checks in CI pipelines and Git hooks for efficient development.

- Repository: [Affaan Mustafa/ECC](https://github.com/affaan-m/ECC)
- Tags: how-to-guide
- Published: 2026-05-26

---

**Implement code review automation in ECC by leveraging the built-in `code-reviewer` agent, which can be triggered via the `/code-review` command, integrated into orchestrated workflows, or embedded into CI pipelines and Git hooks to automatically analyze code changes for quality, security, and maintainability.**

The **Everything Claude Code (ECC)** platform from the `affaan-m/ECC` repository provides a comprehensive, LLM-driven solution to implement code review automation directly into your development workflow. By utilizing the `code-reviewer` agent and its associated commands, you can enforce consistent quality standards across local development, continuous integration, and pull request processes without manual intervention.

## Core Components of ECC Code Review Automation

### The code-reviewer Agent

The heart of the system lives in [`agents/code-reviewer.md`](https://github.com/affaan-m/ECC/blob/main/agents/code-reviewer.md), which defines the **LLM-driven reviewer**. This file specifies the review checklist, confidence thresholds, and structured output format. The agent implements severity bands ranging from **CRITICAL** to **LOW**, ensuring comprehensive coverage of potential issues.

### The /code-review Command

Located in [`docs/zh-CN/commands/code-review.md`](https://github.com/affaan-m/ECC/blob/main/docs/zh-CN/commands/code-review.md), this command serves as the primary user-facing entry point. When invoked, it launches the reviewer agent on the current diff, making it ideal for ad-hoc reviews during development sessions.

### Orchestration Engine Integration

The orchestrator, documented in [`docs/zh-CN/commands/orchestrate.md`](https://github.com/affaan-m/ECC/blob/main/docs/zh-CN/commands/orchestrate.md), automatically inserts the `code-reviewer` into workflows for `impl`, `refactor`, or `migration` steps. When you run `/orchestrate feature "..."`, the engine builds a chain such as `planner → tdd-guide → code-reviewer`, ensuring reviews happen automatically after implementation.

## How the Code Review Process Works

The automation follows a four-step pipeline:

1. **Gather Change Context** – Executes `git diff --staged` or falls back to recent commits to isolate exact changes.
2. **Read Affected Files** – Uses the `Read` tool to load full source files, imports, and related test files for broader context.
3. **Apply the Review Checklist** – Processes the checklist from [`agents/code-reviewer.md`](https://github.com/affaan-m/ECC/blob/main/agents/code-reviewer.md), filtering by confidence levels.
4. **Produce Structured Output** – Generates findings grouped by severity with a final verdict of `APPROVE`, `WARNING`, or `BLOCK`.

### Confidence-Based Filtering

According to lines 31-34 of the agent definition in [`agents/code-reviewer.md`](https://github.com/affaan-m/ECC/blob/main/agents/code-reviewer.md), the system filters noise by only reporting issues with **greater than 80% confidence**. This threshold prevents low-probability suggestions from cluttering results while maintaining high signal-to-noise ratios for critical findings.

## Integration Methods for Automation

### Manual Ad-hoc Reviews

Trigger immediate reviews during Claude Code sessions:

```text
/code-review

```

This command analyzes the current diff and returns a formatted report with severity counts and a verdict.

### Orchestrated Workflows

For structured development, use workflow commands:

```text
/orchestrate feature "Add JWT authentication"

```

The orchestrator automatically chains agents: `planner → tdd-guide → code-reviewer → security-reviewer`. The review runs immediately after implementation completes, blocking progression if issues are found.

### CI Pipeline Integration

Automate reviews in CI using the headless mode. The test file [`tests/ci/code-reviewer-false-positive-guard.test.js`](https://github.com/affaan-m/ECC/blob/main/tests/ci/code-reviewer-false-positive-guard.test.js) validates that the reviewer maintains consistent formatting and guard thresholds.

Example GitHub Actions workflow:

```bash

# In .github/workflows/ci.yml

- name: Run ECC code review
  run: |
    npx claude-code review \
      --repo $GITHUB_WORKSPACE \
      --diff $(git diff HEAD~1) \
      --output review.json
    cat review.json

```

If the JSON output contains `BLOCK`, the workflow exits with a non-zero status, failing the pull request.

### Git Pre-commit Hooks

Prevent low-quality commits at the source by creating `.git/hooks/pre-commit`:

```bash
#!/usr/bin/env bash

# Run ECC's code reviewer on staged changes

if ! claude-code review --staged; then
  echo "Code review failed – fix issues before committing."
  exit 1
fi

```

Make the file executable (`chmod +x .git/hooks/pre-commit`). Now every `git commit` triggers an automatic review; commits proceed only if the reviewer returns `APPROVE`.

## Implementation Examples

### Custom Orchestration with Explicit Ordering

Control review timing by manually composing agent chains:

```text
/orchestrate custom "architect,tdd-guide,code-reviewer,security-reviewer" "Redesign caching layer"

```

This places the code reviewer before security checks or after specific architecture decisions, giving you fine-grained control over the validation sequence.

### Verdict-Based Workflow Control

The structured output enables automated decision-making:

```

## Review Summary

| Severity | Count | Status |
|----------|-------|--------|
| CRITICAL | 0     | pass   |
| HIGH     | 1     | warn   |
| MEDIUM   | 2     | info   |
| LOW      | 0     | note   |
Verdict: WARNING — resolve the HIGH issue before merging.

```

Parse this output in CI scripts to conditionally block merges or notify reviewers.

## Key Configuration Files

| File | Purpose |
|------|---------|
| [`agents/code-reviewer.md`](https://github.com/affaan-m/ECC/blob/main/agents/code-reviewer.md) | Full agent definition including checklist and output format |
| [`docs/zh-CN/commands/code-review.md`](https://github.com/affaan-m/ECC/blob/main/docs/zh-CN/commands/code-review.md) | Documentation for the `/code-review` command |
| [`docs/zh-CN/commands/orchestrate.md`](https://github.com/affaan-m/ECC/blob/main/docs/zh-CN/commands/orchestrate.md) | Orchestrator integration patterns |
| [`tests/ci/code-reviewer-false-positive-guard.test.js`](https://github.com/affaan-m/ECC/blob/main/tests/ci/code-reviewer-false-positive-guard.test.js) | CI validation ensuring reviewer headings and confidence guards remain intact |
| [`docs/COMMAND-AGENT-MAP.md`](https://github.com/affaan-m/ECC/blob/main/docs/COMMAND-AGENT-MAP.md) | Maps commands to agents; identifies `code-reviewer` as the default for "no-tag" steps |
| [`tests/ci/validators.test.js`](https://github.com/affaan-m/ECC/blob/main/tests/ci/validators.test.js) | Test harness validating the presence and shape of the reviewer file |

## Summary

- **Implement code review automation in ECC** using the `code-reviewer` agent defined in [`agents/code-reviewer.md`](https://github.com/affaan-m/ECC/blob/main/agents/code-reviewer.md), triggered by the `/code-review` command or orchestrated workflows.
- Apply **80% confidence filtering** to eliminate noise while catching critical issues.
- Integrate into **CI pipelines** using headless CLI commands to enforce quality gates on every pull request.
- Use **Git pre-commit hooks** to block low-quality code before it enters the repository.
- Leverage the **orchestration engine** to automatically insert reviews into feature development, refactoring, and migration workflows.

## Frequently Asked Questions

### What is the minimum confidence threshold for ECC code review reports?

The `code-reviewer` agent only reports issues with **greater than 80% confidence**, as specified in lines 31-34 of [`agents/code-reviewer.md`](https://github.com/affaan-m/ECC/blob/main/agents/code-reviewer.md). This filtering mechanism prevents false positives and ensures developers receive high-signal feedback.

### How do I integrate ECC code review into my CI pipeline?

Configure your CI workflow to run `npx claude-code review` with the `--repo` and `--diff` flags, outputting to JSON. The process validates the same checklist used in interactive mode. If the output contains a `BLOCK` verdict or `CRITICAL` severity issues, exit with a non-zero status to fail the build, as demonstrated in [`tests/ci/code-reviewer-false-positive-guard.test.js`](https://github.com/affaan-m/ECC/blob/main/tests/ci/code-reviewer-false-positive-guard.test.js).

### Can I run ECC code review automatically before every commit?

Yes. Create an executable `.git/hooks/pre-commit` script that runs `claude-code review --staged`. If the reviewer returns anything other than `APPROVE`, the hook exits with code 1, preventing the commit from completing until issues are resolved.

### Where is the code-reviewer agent behavior defined?

The complete behavior, including the review checklist, severity bands (CRITICAL → LOW), and output formatting rules, is defined in [`agents/code-reviewer.md`](https://github.com/affaan-m/ECC/blob/main/agents/code-reviewer.md) at the repository root. This file serves as the source of truth for how the LLM analyzes code quality and security patterns.