Skip to main content

Guide

Putting It All Together: Your First Working Agent

Combine CLAUDE.md rules, a review skill, and a GitHub MCP server into a working code review agent.

By The Codegen Team · Updated June 2026

Key insight
A working Claude Code agent combines three layers. CLAUDE.md sets your project's review rules, a SKILL.md defines the review workflow as a slash command, and GitHub MCP lets Claude pull your PRs directly. One command triggers the full review.
Key takeaways
  • The three-layer pattern (rules in CLAUDE.md, workflow in a skill, external tools via MCP) applies to any repeatable developer workflow.
  • Fill CLAUDE.md with your project's actual conventions, not generic advice. Your team's logger, your naming rules, and your test structure make the output actionable.
  • Set disable-model-invocation to true on review skills so Claude runs them only when you invoke the command, not automatically mid-task.
  • The system is built for iteration. Update CLAUDE.md rules or skill instructions whenever the output misses something, and the fix persists across future sessions.

What Are We Building?

A code review agent that reads your pull request, checks it against your project’s conventions, flags real issues, and outputs a structured summary. It combines the three layers you learned in the previous lessons. CLAUDE.md sets the code style rules. A skill defines the review workflow. A GitHub MCP server gives Claude access to your PRs without leaving the terminal.

By the end of this guide, you will run one command and get a review that catches the issues you care about, not generic lint output.

Add Review Rules to CLAUDE.md

Open your project’s CLAUDE.md and add a review section. These rules tell Claude what matters when it reviews code in your project.

# CLAUDE.md (add to your existing file)

## Code Review Standards
- Flag any function over 50 lines. It probably needs extraction.
- No default exports. Named exports only.
- Every API endpoint must have error handling. No bare try/catch.
- Test files colocate with source: Component.test.tsx next to Component.tsx.
- No console.log in production code. Use the project logger.
- Commit messages follow Conventional Commits (feat:, fix:, chore:).

These are your project’s rules, not generic best practices. Claude already knows that error handling matters. What it does not know is that your team requires the project logger instead of console.log, or that you use colocated test files. The specifics are what make the review useful.

Create a Review Skill

Claude Code ships with a built-in /code-review skill that runs a general-purpose review. You can extend it with a custom skill that applies your project’s specific checklist.

mkdir -p .claude/skills/pr-review

Create .claude/skills/pr-review/SKILL.md with this content:

---
description: Reviews a pull request against project conventions.
  Use when the user asks to review a PR, check a diff, or
  prepare code for merge.
disable-model-invocation: true
---

## Review Workflow

1. Read the current diff with `git diff main...HEAD`.
2. Check every changed file against the Code Review Standards
   in CLAUDE.md.
3. For each issue found, report:
   - File and line number
   - What the violation is
   - A suggested fix (one line, not a rewrite)
4. Score confidence: only report issues you are 80%+ certain about.
5. End with a summary: total issues, files reviewed, and whether
   the PR is ready to merge.

If no issues are found, say so. Do not invent problems.

The disable-model-invocation: true flag means Claude will not trigger this skill on its own. You invoke it by typing /pr-review. This is intentional for review workflows where you want to control when the review happens, not have Claude auto-trigger it mid-task.

Connect GitHub via MCP

If your project is on GitHub, connecting the GitHub MCP server lets Claude read pull requests, check CI status, and post review comments directly. Without it, Claude can still review your local diff. With it, Claude can pull the PR description, check whether CI passed, and see comments from other reviewers.

# Add the GitHub MCP server
claude mcp add --transport http github https://api.github.com/mcp

# Verify it connected
claude mcp list

The GitHub server exposes tools for reading repositories, pull requests, issues, and actions workflows. Once connected, you can ask Claude to review a specific PR by number instead of relying on your local diff.

Run Your First Agent Review

Start a Claude Code session in your project directory. All three layers load automatically. CLAUDE.md injects your code review standards. The skill registers as /pr-review. The GitHub MCP server connects in the background.

Run the review:

# Option 1: Review your local changes against main
/pr-review

# Option 2: Review a specific GitHub PR (requires MCP)
> Review PR #42 against our code review standards

Claude reads the diff, checks each changed file against your CLAUDE.md rules, and outputs a structured report. A typical review on a 200-line PR takes 30 to 60 seconds and catches convention violations that human reviewers spend time flagging manually.

If the output misses something you expected, update your CLAUDE.md rules. If the workflow needs adjustment (different output format, different confidence threshold), edit the skill’s SKILL.md. The system is designed for iteration. Every correction you make to the rules or skill persists across future sessions.

What to Build Next

The code review agent is a starting point. The same three-layer pattern (rules, skill, MCP) works for any repeatable developer workflow. A deployment agent that checks tests, builds, and pushes to staging. A documentation agent that reads changed files and updates relevant docs. A bug triage agent that pulls error reports from Sentry and creates tickets in Linear.

Each one follows the same structure. Define the rules in CLAUDE.md. Write the workflow in a SKILL.md. Connect external tools through MCP. The pieces you learned in this course are the building blocks for all of them.

What's next

Keep building on what you just learned.

Frequently Asked Questions

Build faster with AI-powered agents

See how Codegen automates the full development workflow — from ticket to pull request.

Get Started →