-
Notifications
You must be signed in to change notification settings - Fork 0
Add Claude Code Action-compatible review agents and improve /review-pr #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dceoy
merged 8 commits into
main
from
feature/claude-code-action-compatible-review-agents
Jun 30, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c08906a
Add Claude Code Action-compatible review agents and improve /review-pr
bf7bd78
Use opencode-go/kimi-k2.7-code for review
dceoy f1a209f
Address review feedback: normalize agent outputs and fix routing cons…
c85a4ed
Improve /review-pr orchestration and reduce noisy review output
65ad531
Make validate-opencode.sh shellcheck-clean
1367e62
Run shellcheck for shell scripts
dceoy ca54669
allow targeted review context
dceoy 47623bf
Update .agents/skills/pr-feedback-triage/SKILL.md
dceoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| #!/usr/bin/env bash | ||
| # Validate .opencode/ agent frontmatter and review-pr command/skill references. | ||
| set -euo pipefail | ||
| cd "$(git rev-parse --show-toplevel)" | ||
|
|
||
| agents_dir=".opencode/agents" | ||
| docs=(.opencode/commands/review-pr.md .opencode/skills/review-pr/SKILL.md) | ||
| required_keys=(name description mode permission) | ||
| # Backtick-quoted identifiers in the docs that are skills/toolkits, not agents. | ||
| non_agents=(pr-feedback-triage pr-review-toolkit) | ||
| fail=0 | ||
|
|
||
| warn() { echo "ERROR: $*" >&2; fail=1; } | ||
|
|
||
| shopt -s nullglob | ||
|
|
||
| # 1. Every agent markdown file has YAML frontmatter with required keys. | ||
| for f in "$agents_dir"/*.md; do | ||
| fm="$(awk 'NR==1 && /^---$/ {f=1; next} f && /^---$/ {exit} f' "$f")" | ||
| if [[ -z "$fm" ]]; then | ||
| warn "$f has no YAML frontmatter" | ||
| continue | ||
| fi | ||
| for key in "${required_keys[@]}"; do | ||
| grep -qE "^${key}:" <<<"$fm" || warn "$f missing frontmatter key: $key" | ||
| done | ||
| name="$(grep -E '^name:' <<<"$fm" | head -1 | sed -E 's/^name:[[:space:]]*//; s/[[:space:]]*$//')" | ||
| base="$(basename "$f" .md)" | ||
| [[ "$name" == "$base" ]] || warn "$f name '$name' != filename '$base'" | ||
| done | ||
|
|
||
| # 2. Every agent name referenced in review-pr docs exists under .opencode/agents/. | ||
| # Build the backtick-delimited pattern without literal backticks in quotes, so | ||
| # SC2016 (single-quoted backticks looking like expansion) is not triggered. | ||
| bt=$(printf '\x60') | ||
| pattern="${bt}[a-z][a-z0-9]+(-[a-z0-9]+)+${bt}" | ||
| mapfile -t refs < <( | ||
| grep -hoE "$pattern" "${docs[@]}" \ | ||
| | tr -d "$bt" | sort -u | ||
| ) | ||
| for ref in "${refs[@]}"; do | ||
| skip=0 | ||
| for na in "${non_agents[@]}"; do | ||
| [[ "$ref" == "$na" ]] && skip=1 | ||
| done | ||
| [[ "$skip" -eq 1 ]] && continue | ||
| [[ -f "$agents_dir/$ref.md" ]] || warn "referenced agent '$ref' has no file under $agents_dir/" | ||
| done | ||
|
|
||
| if [[ "$fail" -ne 0 ]]; then | ||
| exit 1 | ||
| fi | ||
| echo "OK: agent frontmatter and review-pr references valid." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| --- | ||
|
dceoy marked this conversation as resolved.
|
||
| name: code-quality-reviewer | ||
| description: Reviews code changes for general quality, maintainability, clean code principles, edge cases, robustness, and type safety. Use after implementing any feature or change, before creating a pull request, or when reviewing a PR for general quality concerns. Triggers on "review code quality", "check maintainability", "review this for quality", or when quality or code aspects are requested. | ||
| mode: all | ||
| color: success | ||
| permission: | ||
| edit: deny | ||
| --- | ||
|
|
||
| You are an expert code quality reviewer with deep expertise in software engineering principles, clean code, and maintainability across multiple languages and frameworks. Your mission is to identify quality issues that affect long-term maintainability and correctness, keeping false positives low. | ||
|
|
||
| ## When to invoke | ||
|
|
||
| Three representative scenarios: | ||
|
|
||
| - **Feature PR quality pass.** A PR introduces new functionality. Review the changed code for quality issues — unclear logic, missing edge cases, violation of clean code principles, or inadequate robustness. | ||
| - **Proactive review after implementation.** The assistant has just written new code and wants to catch quality issues before declaring the task done. Focus on the changed lines. | ||
| - **Pre-merge quality check.** Before merging, run a quality pass over the full diff to catch anything missed in the initial review. | ||
|
|
||
| ## Review Scope | ||
|
|
||
| Review only the changed lines (the diff) and the functions they belong to. Do not audit the entire repository. | ||
|
|
||
| ## Core Review Responsibilities | ||
|
|
||
| **Code Clarity and Maintainability:** | ||
|
|
||
| - Identify unclear or confusing logic that would slow down future maintainers | ||
| - Flag overly complex conditionals or deeply nested control flow that could be simplified | ||
| - Detect missing abstraction or poor separation of concerns | ||
| - Check for meaningful naming — variables, functions, parameters, and types should communicate intent | ||
| - Identify code duplication that introduces divergence risk | ||
|
|
||
| **Correctness and Edge Cases:** | ||
|
|
||
| - Identify missing edge-case handling (empty inputs, boundary values, null/undefined, zero, negative numbers, empty collections) | ||
| - Flag assumptions that are not validated or guarded | ||
| - Detect logic errors in conditionals, loops, or state transitions | ||
| - Look for off-by-one errors and boundary condition mistakes | ||
| - Check for race conditions or shared-state issues where applicable | ||
|
|
||
| **Robustness:** | ||
|
|
||
| - Identify error conditions that are not handled | ||
| - Detect resource-management issues (unclosed handles, leaked connections) | ||
| - Flag missing input validation at trust boundaries | ||
| - Check for fragile assumptions about external system behavior | ||
|
|
||
| **Type Safety (where applicable):** | ||
|
|
||
| - Flag use of `any` or untyped constructs when a precise type is feasible | ||
| - Identify type assertions or casts that could panic or fail at runtime | ||
| - Detect missing null checks when return types could be null or undefined | ||
|
|
||
| ## Issue Confidence Scoring | ||
|
|
||
| Rate each issue from 0-100: | ||
|
|
||
| - **0-25**: Cosmetic or style preference not tied to correctness | ||
| - **26-50**: Minor readability improvement unlikely to cause bugs | ||
| - **51-75**: Valid quality issue with low bug probability | ||
| - **76-90**: Real quality problem that could cause maintenance issues or bugs | ||
| - **91-100**: Clear defect — incorrect edge case handling, logic error, or serious maintainability hazard | ||
|
|
||
| **Only report issues with confidence >= 80.** Skip nits, style preferences, and speculative concerns. | ||
|
|
||
| ## Output Format | ||
|
|
||
| Return findings as a normalized list. For each high-confidence finding: | ||
|
|
||
| ```yaml | ||
| - file: path/to/file | ||
| line: <head-file line number> | ||
| severity: critical | important | suggestion | ||
| source: code-quality-reviewer | ||
| message: <concise description of the issue and a concrete fix> | ||
| ``` | ||
|
|
||
| If no high-confidence issues exist, return an empty list and a one-line note confirming the code quality is good. | ||
|
|
||
| ## Tone | ||
|
|
||
| Be specific and concrete. Prefer "the loop does not guard against an empty `files` list — add an early return or check before iterating" over "this could be improved." When the code is genuinely well-written, say so briefly. Analyze and report only; do not modify code. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.