Skip to content

Commit 914da0a

Browse files
sylvansysclaude
andcommitted
Clean repo: Claude Code review workflows only
Remove turborepo monorepo structure that was incorrectly added. This repo contains reusable workflow definitions for Claude Code PR review actions. Workflows: - agents-review: Review agent definitions - playwright-ui-review: Visual regression and UI review - project-memory-review: CLAUDE.md compliance review - requirements-review: Issue requirements review - rules-review: Rules file compliance review - skills-review: Skills file review 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 parents  commit 914da0a

7 files changed

Lines changed: 1988 additions & 0 deletions

File tree

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
name: Agents Review
2+
3+
# Reviews .claude/agents/*.md files for context optimization
4+
# Ensures agents are well-defined with proper capabilities and descriptions
5+
# Advises on agent improvements - DOES NOT edit files
6+
7+
on:
8+
pull_request:
9+
branches:
10+
- '**'
11+
paths:
12+
- '.claude/agents/**'
13+
- 'agents/**'
14+
- '**/agents/*.md'
15+
16+
permissions:
17+
contents: read
18+
pull-requests: write
19+
statuses: write
20+
21+
concurrency:
22+
group: agents-review-${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
agents-review:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
review_passed: ${{ steps.review.outputs.passed }}
30+
structured_output: ${{ steps.review.outputs.structured_output }}
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Extract context
39+
id: context
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
run: |
43+
BRANCH_NAME="${{ github.head_ref || github.ref_name }}"
44+
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
45+
46+
# Extract issue number
47+
ISSUE_NUMBER=""
48+
if [[ $BRANCH_NAME =~ ^(feature|fix|bugfix|hotfix)/([0-9]+) ]]; then
49+
ISSUE_NUMBER="${BASH_REMATCH[2]}"
50+
elif [[ $BRANCH_NAME =~ ^([0-9]+)- ]]; then
51+
ISSUE_NUMBER="${BASH_REMATCH[1]}"
52+
fi
53+
echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT
54+
55+
# Get changed agent files
56+
CHANGED_AGENTS=$(gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files[].path' | grep -E '(agents/.*\.md|AGENT\.md)' || echo "")
57+
echo "$CHANGED_AGENTS" > /tmp/changed_agents.txt
58+
echo "changed_agents=$CHANGED_AGENTS" >> $GITHUB_OUTPUT
59+
60+
- name: Get issue context
61+
if: steps.context.outputs.issue_number != ''
62+
env:
63+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
run: |
65+
gh issue view ${{ steps.context.outputs.issue_number }} --json title,body,comments > /tmp/issue.json 2>/dev/null || echo "{}" > /tmp/issue.json
66+
67+
- name: Agents Review with Claude
68+
id: review
69+
uses: anthropics/claude-code-base-action@beta
70+
with:
71+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
72+
allowed_tools: "View,GlobTool,Grep,Bash(cat:*),Bash(find:*)"
73+
max_turns: 15
74+
prompt: |
75+
# Agents Review Agent
76+
77+
You are an agents review specialist focused on context optimization. Your job is to review .claude/agents/*.md files for quality, completeness, and context efficiency.
78+
79+
## Context
80+
- Branch: ${{ steps.context.outputs.branch_name }}
81+
- Issue: ${{ steps.context.outputs.issue_number }}
82+
- Changed Agents: Read /tmp/changed_agents.txt
83+
84+
## Agent Quality Criteria
85+
86+
1. **Frontmatter Requirements**:
87+
- `description`: Clear, concise purpose (1-2 sentences)
88+
- `capabilities`: Array of specific capabilities
89+
- Optional: `color`, `model`, `tools`
90+
91+
2. **Content Structure**:
92+
- Clear heading with agent name
93+
- Detailed description of role and expertise
94+
- When to use (triggering conditions)
95+
- What the agent does (step-by-step)
96+
- What it doesn't do (boundaries)
97+
98+
3. **Context Optimization**:
99+
- Is the description too verbose? (wastes context tokens)
100+
- Is it too vague? (causes confusion)
101+
- Are capabilities specific and actionable?
102+
- Does it avoid duplicating system knowledge?
103+
- Does it focus on domain-specific guidance?
104+
105+
4. **Integration Quality**:
106+
- Does the when-to-use section help Claude decide correctly?
107+
- Are there clear boundaries to prevent scope creep?
108+
- Is the agent focused on ONE specialized domain?
109+
110+
## Your Task
111+
112+
1. Read each changed agent file
113+
2. Evaluate against the criteria above
114+
3. Check if issue context suggests any needed updates
115+
4. Identify context optimization opportunities
116+
5. Provide specific, actionable suggestions
117+
118+
## IMPORTANT RULES
119+
120+
- **DO NOT edit any files** - you are a reviewer only
121+
- Focus on context optimization (smaller = better if equally clear)
122+
- Prefer specific examples over abstract descriptions
123+
- Flag agents that try to do too much (should be split)
124+
125+
## Output Format
126+
127+
Provide agent-by-agent analysis, then output your final decision as a JSON code block.
128+
129+
Your response MUST end with a JSON code block in this exact format:
130+
131+
```json
132+
{
133+
"passed": true/false,
134+
"confidence": 0.0-1.0,
135+
"agent_evaluations": [
136+
{
137+
"agent_file": "path/to/agent.md",
138+
"frontmatter_valid": true/false,
139+
"context_score": 1-10,
140+
"clarity_score": 1-10,
141+
"focus_score": 1-10,
142+
"issues": ["issue descriptions"],
143+
"suggestions": ["suggestions"]
144+
}
145+
],
146+
"optimization_opportunities": ["opportunities for context optimization"],
147+
"summary": "Brief summary of your decision"
148+
}
149+
```
150+
151+
- name: Extract review result
152+
id: extract
153+
run: |
154+
EXEC_FILE="${{ steps.review.outputs.execution_file }}"
155+
CONCLUSION="${{ steps.review.outputs.conclusion }}"
156+
157+
if [ "$CONCLUSION" = "success" ]; then
158+
DEFAULT_OUTPUT='{"passed":true,"confidence":0.8,"summary":"Review completed successfully"}'
159+
else
160+
DEFAULT_OUTPUT='{"passed":false,"confidence":0.5,"summary":"Review completed with issues"}'
161+
fi
162+
163+
if [ -f "$EXEC_FILE" ]; then
164+
LAST_TEXT=$(jq -r '[.[] | select(.type == "assistant") | .message.content[]? | select(.type == "text") | .text] | last // ""' "$EXEC_FILE" 2>/dev/null)
165+
OUTPUT=$(echo "$LAST_TEXT" | sed -n '/```json/,/```/{/```json/d;/```/d;p;}' | tr -d '\r')
166+
if echo "$OUTPUT" | jq . >/dev/null 2>&1 && [ -n "$OUTPUT" ]; then
167+
echo "$OUTPUT" > /tmp/review_output.json
168+
else
169+
echo "$DEFAULT_OUTPUT" > /tmp/review_output.json
170+
fi
171+
else
172+
echo "$DEFAULT_OUTPUT" > /tmp/review_output.json
173+
fi
174+
175+
PASSED=$(jq -r '.passed // false' /tmp/review_output.json)
176+
SUMMARY=$(jq -r '.summary // "No summary"' /tmp/review_output.json | head -c 200)
177+
echo "passed=$PASSED" >> $GITHUB_OUTPUT
178+
echo "summary=$SUMMARY" >> $GITHUB_OUTPUT
179+
180+
- name: Post review comment
181+
env:
182+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
183+
run: |
184+
OUTPUT=$(cat /tmp/review_output.json)
185+
PASSED=$(echo "$OUTPUT" | jq -r '.passed // false')
186+
CONFIDENCE=$(echo "$OUTPUT" | jq -r '.confidence // 0')
187+
SUMMARY=$(echo "$OUTPUT" | jq -r '.summary // "No summary available"')
188+
189+
if [ "$PASSED" = "true" ]; then
190+
STATUS_ICON=":white_check_mark:"
191+
STATUS_TEXT="PASSED"
192+
else
193+
STATUS_ICON=":warning:"
194+
STATUS_TEXT="NEEDS IMPROVEMENT"
195+
fi
196+
197+
COMMENT_BODY="## Agents Review ${STATUS_ICON} ${STATUS_TEXT}
198+
199+
**Confidence:** ${CONFIDENCE}
200+
201+
### Summary
202+
${SUMMARY}
203+
"
204+
205+
# Add agent evaluations
206+
echo "$OUTPUT" | jq -r '.agent_evaluations[]? | "### \(.agent_file)\n- **Context Score:** \(.context_score)/10\n- **Clarity Score:** \(.clarity_score)/10\n- **Focus Score:** \(.focus_score)/10\n- **Frontmatter Valid:** \(.frontmatter_valid)\n\n**Issues:**\n\(.issues | if length > 0 then map(\"- \" + .) | join(\"\n\") else \"None\" end)\n\n**Suggestions:**\n\(.suggestions | if length > 0 then map(\"- \" + .) | join(\"\n\") else \"None\" end)\n"' 2>/dev/null | while IFS= read -r line; do
207+
COMMENT_BODY="${COMMENT_BODY}${line}
208+
"
209+
done
210+
211+
# Add optimization opportunities
212+
OPTS=$(echo "$OUTPUT" | jq -r '.optimization_opportunities // [] | .[]' 2>/dev/null)
213+
if [ -n "$OPTS" ]; then
214+
COMMENT_BODY="${COMMENT_BODY}
215+
### Context Optimization Opportunities
216+
$(echo "$OPTS" | while read -r opt; do echo "- :zap: $opt"; done)
217+
"
218+
fi
219+
220+
COMMENT_BODY="${COMMENT_BODY}
221+
222+
---
223+
*Automated Agents Review by Claude Code*"
224+
225+
gh pr comment ${{ github.event.pull_request.number }} --body "$COMMENT_BODY"
226+
227+
- name: Set commit status
228+
env:
229+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
230+
run: |
231+
PASSED="${{ steps.extract.outputs.passed }}"
232+
SUMMARY="${{ steps.extract.outputs.summary }}"
233+
234+
if [ "$PASSED" = "true" ]; then
235+
STATE="success"
236+
DESCRIPTION="Agents review passed"
237+
else
238+
STATE="failure"
239+
DESCRIPTION="Agents need improvement"
240+
fi
241+
242+
gh api repos/${{ github.repository }}/statuses/${{ github.sha }} \
243+
-f state="$STATE" \
244+
-f target_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
245+
-f description="$DESCRIPTION" \
246+
-f context="Agents Review"
247+
248+
- name: Fail if review failed
249+
run: |
250+
PASSED="${{ steps.extract.outputs.passed }}"
251+
252+
if [ "$PASSED" != "true" ]; then
253+
echo "::warning::Agents review identified improvements needed. See PR comment."
254+
exit 1
255+
fi

0 commit comments

Comments
 (0)