Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions plugins/code-review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Performs automated code review on a pull request using multiple specialized agen

**What it does:**
1. Checks if review is needed (skips closed, draft, trivial, or already-reviewed PRs)
2. Gathers relevant CLAUDE.md guideline files from the repository
2. Gathers relevant CLAUDE.md and AGENTS.md guideline files from the repository
3. Summarizes the pull request changes
4. Launches 4 parallel agents to independently review:
- **Agents #1 & #2**: Audit for CLAUDE.md compliance
- **Agents #1 & #2**: Audit for project instruction compliance
- **Agent #3**: Scan for obvious bugs in changes
- **Agent #4**: Analyze git blame/history for context-based issues
5. Scores each issue 0-100 for confidence level
Expand Down Expand Up @@ -50,7 +50,7 @@ Performs automated code review on a pull request using multiple specialized agen
**Features:**
- Multiple independent agents for comprehensive review
- Confidence-based scoring reduces false positives (threshold: 80)
- CLAUDE.md compliance checking with explicit guideline verification
- CLAUDE.md and AGENTS.md compliance checking with explicit guideline verification
- Bug detection focused on changes (not pre-existing issues)
- Historical context analysis via git blame
- Automatic skipping of closed, draft, or already-reviewed PRs
Expand All @@ -62,15 +62,15 @@ Performs automated code review on a pull request using multiple specialized agen

Found 3 issues:

1. Missing error handling for OAuth callback (CLAUDE.md says "Always handle OAuth errors")
1. Missing error handling for OAuth callback (CLAUDE.md or AGENTS.md says "Always handle OAuth errors")

https://github.com/owner/repo/blob/abc123.../src/auth.ts#L67-L72

2. Memory leak: OAuth state not cleaned up (bug due to missing cleanup in finally block)

https://github.com/owner/repo/blob/abc123.../src/auth.ts#L88-L95

3. Inconsistent naming pattern (src/conventions/CLAUDE.md says "Use camelCase for functions")
3. Inconsistent naming pattern (src/conventions/CLAUDE.md or src/conventions/AGENTS.md says "Use camelCase for functions")

https://github.com/owner/repo/blob/abc123.../src/utils.ts#L23-L28
```
Expand All @@ -87,7 +87,7 @@ https://github.com/owner/repo/blob/abc123.../src/utils.ts#L23-L28
- Code that looks like a bug but isn't
- Pedantic nitpicks
- Issues linters will catch
- General quality issues (unless in CLAUDE.md)
- General quality issues (unless in CLAUDE.md or AGENTS.md)
- Issues with lint ignore comments

## Installation
Expand All @@ -97,11 +97,11 @@ This plugin is included in the Claude Code repository. The command is automatica
## Best Practices

### Using `/code-review`
- Maintain clear CLAUDE.md files for better compliance checking
- Maintain clear CLAUDE.md or AGENTS.md files for better compliance checking
- Trust the 80+ confidence threshold - false positives are filtered
- Run on all non-trivial pull requests
- Review agent findings as a starting point for human review
- Update CLAUDE.md based on recurring review patterns
- Update project instruction files based on recurring review patterns

### When to use
- All pull requests with meaningful changes
Expand Down Expand Up @@ -144,7 +144,7 @@ This plugin is included in the Claude Code repository. The command is automatica

- Git repository with GitHub integration
- GitHub CLI (`gh`) installed and authenticated
- CLAUDE.md files (optional but recommended for guideline checking)
- CLAUDE.md or AGENTS.md files (optional but recommended for guideline checking)

## Troubleshooting

Expand All @@ -163,7 +163,7 @@ This plugin is included in the Claude Code repository. The command is automatica

**Solution**:
- Default threshold is 80 (already filters most false positives)
- Make CLAUDE.md more specific about what matters
- Make CLAUDE.md or AGENTS.md more specific about what matters
- Consider if the flagged issue is actually valid

### No review comment posted
Expand Down Expand Up @@ -202,10 +202,10 @@ https://github.com/owner/repo/blob/[full-sha]/path/file.ext#L[start]-L[end]

## Tips

- **Write specific CLAUDE.md files**: Clear guidelines = better reviews
- **Write specific project instruction files**: Clear CLAUDE.md or AGENTS.md guidelines = better reviews
- **Include context in PRs**: Helps agents understand intent
- **Use confidence scores**: Issues ≥80 are usually correct
- **Iterate on guidelines**: Update CLAUDE.md based on patterns
- **Iterate on guidelines**: Update CLAUDE.md or AGENTS.md based on patterns
- **Review automatically**: Set up as part of PR workflow
- **Trust the filtering**: Threshold prevents noise

Expand All @@ -231,7 +231,7 @@ Edit `commands/code-review.md` to add or modify agent tasks:
## Technical Details

### Agent architecture
- **2x CLAUDE.md compliance agents**: Redundancy for guideline checks
- **2x project-instruction compliance agents**: Redundancy for guideline checks
- **1x bug detector**: Focused on obvious bugs in changes only
- **1x history analyzer**: Context from git blame and history
- **Nx confidence scorers**: One per issue for independent scoring
Expand All @@ -240,7 +240,7 @@ Edit `commands/code-review.md` to add or modify agent tasks:
- Each issue independently scored 0-100
- Scoring considers evidence strength and verification
- Threshold (default 80) filters low-confidence issues
- For CLAUDE.md issues: verifies guideline explicitly mentions it
- For project instruction issues: verifies CLAUDE.md or AGENTS.md explicitly mentions it

### GitHub integration
Uses `gh` CLI for:
Expand Down
27 changes: 14 additions & 13 deletions plugins/code-review/commands/code-review.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ To do this, follow these steps precisely:

Note: Still review Claude generated PR's.

2. Launch a haiku agent to return a list of file paths (not their contents) for all relevant CLAUDE.md files including:
- The root CLAUDE.md file, if it exists
- Any CLAUDE.md files in directories containing files modified by the pull request
2. Launch a haiku agent to return a list of file paths (not their contents) for all relevant project instruction files, including:
- The root CLAUDE.md and AGENTS.md files, if they exist
- Any CLAUDE.md or AGENTS.md files in directories containing files modified by the pull request
- Apply both files when both exist in the same directory; if a CLAUDE.md rule conflicts with an AGENTS.md rule, prefer the CLAUDE.md rule because it is Claude-specific

3. Launch a sonnet agent to view the pull request and return a summary of the changes

4. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged (e.g. "CLAUDE.md adherence", "bug"). The agents should do the following:
4. Launch 4 agents in parallel to independently review the changes. Each agent should return the list of issues, where each issue includes a description and the reason it was flagged (e.g. "project instruction adherence", "bug"). The agents should do the following:

Agents 1 + 2: CLAUDE.md compliance sonnet agents
Audit changes for CLAUDE.md compliance in parallel. Note: When evaluating CLAUDE.md compliance for a file, you should only consider CLAUDE.md files that share a file path with the file or parents.
Agents 1 + 2: project-instructions compliance sonnet agents
Audit changes for CLAUDE.md and AGENTS.md compliance in parallel. Note: When evaluating instruction compliance for a file, you should only consider CLAUDE.md and AGENTS.md files that share a file path with the file or parents. If both files apply and conflict, prefer the more specific CLAUDE.md instruction.

Agent 3: Opus bug agent (parallel subagent with agent 4)
Scan for obvious bugs. Focus only on the diff itself without reading extra context. Flag only significant bugs; ignore nitpicks and likely false positives. Do not flag issues that you cannot validate without looking at context outside of the git diff.
Expand All @@ -41,7 +42,7 @@ Note: Still review Claude generated PR's.
**CRITICAL: We only want HIGH SIGNAL issues.** Flag issues where:
- The code will fail to compile or parse (syntax errors, type errors, missing imports, unresolved references)
- The code will definitely produce wrong results regardless of inputs (clear logic errors)
- Clear, unambiguous CLAUDE.md violations where you can quote the exact rule being broken
- Clear, unambiguous project instruction violations where you can quote the exact rule being broken

Do NOT flag:
- Code style or quality concerns
Expand All @@ -52,13 +53,13 @@ Note: Still review Claude generated PR's.

In addition to the above, each subagent should be told the PR title and description. This will help provide context regarding the author's intent.

5. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. These subagents should get the PR title and description along with a description of the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. For example, if an issue such as "variable is not defined" was flagged, the subagent's job would be to validate that is actually true in the code. Another example would be CLAUDE.md issues. The agent should validate that the CLAUDE.md rule that was violated is scoped for this file and is actually violated. Use Opus subagents for bugs and logic issues, and sonnet agents for CLAUDE.md violations.
5. For each issue found in the previous step by agents 3 and 4, launch parallel subagents to validate the issue. These subagents should get the PR title and description along with a description of the issue. The agent's job is to review the issue to validate that the stated issue is truly an issue with high confidence. For example, if an issue such as "variable is not defined" was flagged, the subagent's job would be to validate that is actually true in the code. Another example would be project instruction issues. The agent should validate that the CLAUDE.md or AGENTS.md rule that was violated is scoped for this file and is actually violated. Use Opus subagents for bugs and logic issues, and sonnet agents for instruction violations.

6. Filter out any issues that were not validated in step 5. This step will give us our list of high signal issues for our review.

7. Output a summary of the review findings to the terminal:
- If issues were found, list each issue with a brief description.
- If no issues were found, state: "No issues found. Checked for bugs and CLAUDE.md compliance."
- If no issues were found, state: "No issues found. Checked for bugs and project instruction compliance."

If `--comment` argument was NOT provided, stop here. Do not post any GitHub comments.

Expand All @@ -82,21 +83,21 @@ Use this list when evaluating issues in Steps 4 and 5 (these are false positives
- Something that appears to be a bug but is actually correct
- Pedantic nitpicks that a senior engineer would not flag
- Issues that a linter will catch (do not run the linter to verify)
- General code quality concerns (e.g., lack of test coverage, general security issues) unless explicitly required in CLAUDE.md
- Issues mentioned in CLAUDE.md but explicitly silenced in the code (e.g., via a lint ignore comment)
- General code quality concerns (e.g., lack of test coverage, general security issues) unless explicitly required in CLAUDE.md or AGENTS.md
- Issues mentioned in CLAUDE.md or AGENTS.md but explicitly silenced in the code (e.g., via a lint ignore comment)

Notes:

- Use gh CLI to interact with GitHub (e.g., fetch pull requests, create comments). Do not use web fetch.
- Create a todo list before starting.
- You must cite and link each issue in inline comments (e.g., if referring to a CLAUDE.md, include a link to it).
- You must cite and link each issue in inline comments (e.g., if referring to a CLAUDE.md or AGENTS.md, include a link to it).
- If no issues are found and `--comment` argument is provided, post a comment with the following format:

---

## Code review

No issues found. Checked for bugs and CLAUDE.md compliance.
No issues found. Checked for bugs and project instruction compliance.

---

Expand Down
2 changes: 1 addition & 1 deletion plugins/feature-dev/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ Suggested next steps:
**Purpose**: Reviews code for bugs, quality issues, and project conventions

**Focus areas:**
- Project guideline compliance (CLAUDE.md)
- Project guideline compliance (CLAUDE.md and AGENTS.md)
- Bug detection
- Code quality issues
- Confidence-based filtering (only reports high-confidence issues ≥80)
Expand Down
2 changes: 1 addition & 1 deletion plugins/feature-dev/agents/code-architect.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ You are a senior software architect who delivers comprehensive, actionable archi
## Core Process

**1. Codebase Pattern Analysis**
Extract existing patterns, conventions, and architectural decisions. Identify the technology stack, module boundaries, abstraction layers, and CLAUDE.md guidelines. Find similar features to understand established approaches.
Extract existing patterns, conventions, and architectural decisions. Identify the technology stack, module boundaries, abstraction layers, and project instruction guidelines from CLAUDE.md or AGENTS.md. Find similar features to understand established approaches.

**2. Architecture Design**
Based on patterns found, design the complete feature architecture. Make decisive choices - pick one approach and commit. Ensure seamless integration with existing code. Design for testability, performance, and maintainability.
Expand Down
4 changes: 2 additions & 2 deletions plugins/feature-dev/agents/code-reviewer.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ model: sonnet
color: red
---

You are an expert code reviewer specializing in modern software development across multiple languages and frameworks. Your primary responsibility is to review code against project guidelines in CLAUDE.md with high precision to minimize false positives.
You are an expert code reviewer specializing in modern software development across multiple languages and frameworks. Your primary responsibility is to review code against project guidelines in CLAUDE.md or AGENTS.md with high precision to minimize false positives.

## Review Scope

By default, review unstaged changes from `git diff`. The user may specify different files or scope to review.

## Core Review Responsibilities

**Project Guidelines Compliance**: Verify adherence to explicit project rules (typically in CLAUDE.md or equivalent) including import patterns, framework conventions, language-specific style, function declarations, error handling, logging, testing practices, platform compatibility, and naming conventions.
**Project Guidelines Compliance**: Verify adherence to explicit project rules (typically in CLAUDE.md, AGENTS.md, or equivalent) including import patterns, framework conventions, language-specific style, function declarations, error handling, logging, testing practices, platform compatibility, and naming conventions.

**Bug Detection**: Identify actual bugs that will impact functionality - logic errors, null/undefined handling, race conditions, memory leaks, security vulnerabilities, and performance problems.

Expand Down
2 changes: 1 addition & 1 deletion plugins/pr-review-toolkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ This plugin bundles 6 expert review agents that each focus on a specific aspect
**Focus**: General code review for project guidelines

**Analyzes:**
- CLAUDE.md compliance
- CLAUDE.md and AGENTS.md compliance
- Style violations
- Bug detection
- Code quality issues
Expand Down
Loading