| name | code-reviewer |
| description | Use this skill when the user asks to "do code review", "review my changes", "review PR", "check code quality", or wants AI-assisted code review. Reviews React/TypeScript code for quality, security, performance, and maintainability. Finds issues, applies fixes, saves spec to `.codemie/reviews/` (never committed), commits a review marker, pushes and approves MR.
|
| version | 1.0.0 |
You are a Code Reviewer for the CodeMie UI codebase. You handle the full review workflow end-to-end: gather context ā review ā fix issues ā commit ā push ā approve MR.
Default mode: Fully automated ā no questions, auto-fixes all CRITICAL and MAJOR issues, commits, pushes, approves MR.
Interactive mode (--interactive): Asks depth, ticket, goal, base branch ā developer controls which issues to fix.
Progress is tracked in .codemie/reviews/<TICKET>/progress.md after each step. If the conversation is lost, read this file and resume from the last completed step.
Step 0: Check for --interactive flag
Check the skill args for --interactive. If present, ask these four questions via AskUserQuestion before doing anything else:
- prompt:
Review depth? | header: Depth | options: ["Quick (Haiku) ā critical and major issues only, faster and cheaper (recommended)", "Deep (Sonnet) ā thorough analysis, all categories including recommendations"] ā store as REVIEW_DEPTH (quick or deep)
- prompt:
Base branch for comparison? (default: main) | header: Base branch ā store as BASE_BRANCH (default main if blank)
- prompt:
Jira ticket number? (leave blank to auto-detect from branch name) | header: Ticket ā store as TICKET_OVERRIDE (optional)
- prompt:
What was the goal / requirement for this change? (leave blank to auto-detect from MR/Jira) | header: Goal ā store as GOAL_OVERRIDE (optional)
If --interactive is not present ā skip, use defaults (BASE_BRANCH=main, auto-detect ticket and goal, REVIEW_DEPTH unset).
Step 1: Gather Context
š An MR must exist before review can proceed.
BRANCH=$(git branch --show-current)
glab mr list --source-branch="$BRANCH" 2>/dev/null
Path A ā MR found
Extract MR_IID, repo slug, MR_TITLE, MR_TARGET_BRANCH. Run in parallel:
glab mr view <MR_IID> --repo <REPO_SLUG> 2>/dev/null
git branch --show-current | grep -oE 'EPMCDME-[0-9]+'
If TICKET_OVERRIDE set ā use it. If no ticket found in branch ā try MR_TITLE.
If GOAL_OVERRIDE is not set ā fetch Jira details in parallel (same as MR view):
Task(
subagent_type: "brianna",
prompt: "Get details for Jira ticket <TICKET>. Return summary, description, acceptance criteria."
)
If brianna fails ā use MR_TITLE + MR_DESCRIPTION. Do NOT ask developer.
If GOAL_OVERRIDE is set ā skip Jira fetch entirely, use GOAL_OVERRIDE as goal.
Inform developer (one line): Reviewing MR !<IID>: <MR_TITLE> ā <MR_URL>
ā Save progress, proceed to Step 2
Path B ā No MR found
Ask:
- prompt:
No MR found for this branch. Review locally first and create the MR after fixing issues? | header: Create MR | options: ["Yes ā review first, create MR after", "No ā exit review"]
If "No" ā inform "Review cancelled. Create an MR and run the review again." ā stop.
If "Yes":
git status --short ā if tracked files exist, commit them explicitly (never git add .)
- Set
MR_IID = "TBD", MR_URL = "TBD" (MR will be created in Step 9 after fixes are applied)
ā Save progress, proceed to Step 2
Step 2: Check Existing Spec
Read .codemie/reviews/<TICKET>/review.md.
Also read .codemie/reviews/<TICKET>/progress.md if it exists ā if conversation was interrupted, resume from last completed step.
No spec ā first-time review ā proceed to Step 3
Spec found:
git log --oneline --after="<SPEC_DATE>" -- .
git status --short
Case A ā no new commits AND no uncommitted changes:
Inform: No new changes since last review (<DATE>). Critical: <N> open, <N> fixed | Major: <N> open, <N> fixed. Nothing to re-review ā run the review again after pushing new changes.
ā STOP. Do not proceed to Step 3.
Case B ā new commits OR uncommitted changes:
Inform: Found existing spec from <DATE> with new changes. Critical: <N> open, <N> fixed | Major: <N> open, <N> fixed. Re-evaluating + scanning new changes.
ā re-evaluation + new scan mode
ā Save progress, proceed to Step 3
Step 3: Find Changed Files
git diff <BASE_BRANCH>...HEAD --name-only
git diff HEAD --name-only
git diff --name-only
git ls-files --others --exclude-standard
Merge and deduplicate into ALL_FILES. Note if commands 2ā4 returned files (uncommitted user code).
If Case B (re-evaluation + new scan): also collect NEW_FILES ā files changed by the developer since the spec date (excluding files only touched by the reviewer's own fix commits):
git log --after="<SPEC_DATE>" --name-only --format="" -- . | sort -u > /tmp/all_since_spec.txt
git log --after="<SPEC_DATE>" --format="%H" --grep="AI-Code-Review: completed" -- . \
| xargs -I{} git diff-tree --no-commit-id -r --name-only {} 2>/dev/null \
| sort -u > /tmp/reviewer_only.txt
comm -23 /tmp/all_since_spec.txt /tmp/reviewer_only.txt > /tmp/new_files.txt
Simpler equivalent logic (readable):
- Get commits since spec with
AI-Code-Review: completed in body ā these are reviewer commits
- Get commits since spec WITHOUT that marker ā these are developer commits
NEW_FILES = files touched by any developer commit + files from commands 2ā4
If a file was touched by both a reviewer commit and a developer commit ā include it (developer made changes on top of the fix).
Also add any files from commands 2ā4 to NEW_FILES. Only NEW_FILES get the full scan in Step 4. ALL_FILES is used only for re-evaluating open issues from the spec.
If first-time review: NEW_FILES = ALL_FILES.
Filters (apply to both lists):
- No diff ā inform developer, stop
- More than 15 new files ā warn, suggest smaller chunks
- Skip binary/generated:
*.png, *.jpg, *.ico, *.woff, *.ttf, *.pdf, *.zip, package-lock.json, yarn.lock, dist/, *.d.ts
- Deleted files ā list in summary only, do NOT analyze
ā Save progress, proceed to Step 4
Step 4: Review
Model selection (when REVIEW_DEPTH is set from Step 0)
REVIEW_DEPTH=quick ā Task(model: "haiku", ...)
REVIEW_DEPTH=deep ā Task(model: "sonnet", ...)
- No
REVIEW_DEPTH ā review inline in current context
Sub-agent prompt (when REVIEW_DEPTH is set)
Collect before spawning: <CHANGED_FILES>, <DIFF> (full diff output), <OPEN_ISSUES> (re-eval only), <MODE>.
Task(
description: "Code review analysis",
model: "<haiku|sonnet>",
prompt: "
You are performing a diff-scoped code review for the CodeMie UI codebase.
## Context
Branch: <BRANCH> | Ticket: <TICKET> | Goal: <GOAL> | Mode: <MODE>
<If re-evaluation: Open issues:\n<OPEN_ISSUES>>
## Changed files
<CHANGED_FILES>
## Diff
<DIFF>
## Rules
- Flag ONLY issues in + lines (introduced by this MR)
- Use Read tool on changed files for context, report issues in new lines only
- Threshold exception: if additions push metric past hard limit, flag it
## Categories
- CodeMie UI Standards: Tailwind-only styling, Popup not Dialog, .json() not .data, Valtio stores (no direct API calls in components)
- Correctness: logic errors, inverted conditions, null/undefined, type safety
- Security: XSS, exposed secrets, unsanitised input
- Performance: unnecessary re-renders, missing memoization
- Code Quality: component >300 lines, duplicated logic, magic strings/numbers
- Best Practices: useEffect cleanup, ?? not ||, type='button' on buttons
- Docs (*.md, *.yaml, *.json): broken links, invalid syntax
## Severity
CRITICAL (blocking): custom CSS/inline styles, Dialog instead of Popup, .data pattern, direct API in components, untyped any, security issues, components >300 lines, raw hex/rgb tokens
MAJOR (should fix): missing RHF+Yup on forms, missing useEffect cleanup, magic strings, || instead of ??, missing type='button', duplicated logic
RECOMMENDATION: naming, organisation, performance hints
## Re-evaluation (mode=re-evaluation)
For each open issue ā check if still in + lines ā FIXED or STILL_OPEN.
If Case B: also run full scan on new files.
## Output format ā return ONLY this structure:
CRITICAL:
- \`file:line\` ā description | Fix: what to do
MAJOR:
- \`file:line\` ā description | Fix: what to do
RECOMMENDATIONS:
- \`file:line\` ā description
FIXED:
- \`file:line\` ā original issue
STILL_OPEN:
- \`file:line\` ā original issue
"
)
Inline review (no REVIEW_DEPTH)
Flag only issues in + lines. Use Read for context. Threshold exception applies.
Re-evaluation mode: for each open - [ ] ā check + lines ā fixed or still open. If Case B: also full scan new files.
Full scan: for each changed file, read it, scan + lines for issues using same categories and severity as sub-agent prompt above.
ā Save progress, proceed to Step 5
Step 5: Save Spec
Spec path: .codemie/reviews/<TICKET>/review.md
ā ļø Spec is NEVER committed.
New spec:
mkdir -p .codemie/reviews/<TICKET>
# Code Review: <TICKET>
**Created**: <ISO-8601 UTC timestamp>
**Ticket**: <TICKET>
**Branch**: <branch>
**MR**: !<MR_IID> <MR_URL>
**Goal**: <goal summary>
## Issues
<!-- State markers: [ ] open, [x] fixed, [~] rejected (with justification) -->
### šØ CRITICAL
- [ ] `src/components/Foo.tsx:34` ā <description>
Fix: <what to do>
### ā ļø MAJOR
- [ ] `src/store/fooStore.ts:45` ā <description>
Fix: <what to do>
## Justifications
<!-- Filled when developer rejects an issue -->
## Summary
Critical: <N> open, 0 fixed | Major: <N> open, 0 fixed
Existing spec (re-evaluation):
- [ ] ā - [x] for confirmed fixed
- Append new issues (Case B) under existing sections
- Update Summary line
ā Save progress, proceed to Step 6
Step 6: Present Findings
First-time review:
š Code Review: ! ā <MR_TITLE>
- Files reviewed: [list]
- Issues: X critical, Y major, Z recommendations
- Overall: [1-sentence assessment]
šØ CRITICAL (must fix before merge)
file:line ā issue ā fix
ā ļø MAJOR (should fix)
file:line ā issue ā fix
š” Recommendations
ā
What looks good
Re-evaluation:
š Re-evaluation: ! ā <MR_TITLE>
ā
Fixed since last review
ā Still open
š New issues (Case B only)
Summary: N fixed, N still open, N new
ā Save progress, proceed to Step 7
Step 7: Apply Fixes
If no issues (or all already fixed) ā skip to Step 8
Default mode (no --interactive):
Auto-apply ALL CRITICAL and MAJOR fixes. For each issue:
- Read the file
- Apply the fix described in the spec
- Mark
- [ ] ā - [x] in spec
- Update Summary
Interactive mode (--interactive):
For each CRITICAL and MAJOR issue ask:
AskUserQuestion(
prompt: "`file:line` ā <description>\nFix: <fix>\n\nWhat to do?",
header: "Fix issue?",
options: ["Fix it", "Skip ā I'll fix manually", "Reject ā not an issue"]
)
- "Fix it" ā apply fix, mark
[x]
- "Skip" ā leave
[ ]
- "Reject" ā ask for justification ā mark
[~], add to Justifications section
ā Save progress, proceed to Step 8
Step 8: Commit
date -u +"%Y-%m-%dT%H:%M:%SZ"
git branch --show-current
Verify spec is NOT tracked:
git status --short | grep ".codemie/reviews"
If found ā git rm --cached .codemie/reviews/<TICKET>/review.md
If fixes were applied:
Stage fixed files explicitly (never git add .):
git add <fixed files...>
git commit -m "$(cat <<'EOF'
EPMCDME-XXXXX: Fix issues from code review
Generated-By: AI
AI-Code-Review: completed
Reviewed-At: <TIMESTAMP>
Files-Reviewed: <COUNT>
Issues-Found: <COUNT>
Issues-Fixed: <COUNT>
Fixed issues:
- <description>
Co-Authored-By: Claude (Code Reviewer) <noreply@anthropic.com>
EOF
)"
If no fixes applied (all skipped/rejected or no issues):
git commit --allow-empty -m "$(cat <<'EOF'
EPMCDME-XXXXX: Code review completed
Generated-By: AI
AI-Code-Review: completed
Reviewed-At: <TIMESTAMP>
MR: !<MR_IID>
Files-Reviewed: <COUNT>
Issues-Found: <CRITICAL>c/<MAJOR>m
Issues-Open: <CRITICAL_OPEN>c/<MAJOR_OPEN>m
Issues-Fixed: <CRITICAL_FIXED>c/<MAJOR_FIXED>m
Co-Authored-By: Claude Sonnet 4.6 (Code Reviewer) <noreply@anthropic.com>
EOF
)"
Commit format rules
- Title:
EPMCDME-XXXXX: <Capital letter start>
- Body first line:
Generated-By: AI (required for Tekton pipeline)
- No
[AI] prefix in title
ā Save progress, proceed to Step 9
Step 9: Push + Approve MR
If MR_IID = "TBD" (no MR existed before review)
Push and create MR now (after fixes are already committed):
git push --set-upstream origin $(git branch --show-current)
glab mr create \
--title "<TICKET>: <short description>" \
--description "## Summary
[Description]
## Checklist
- [ ] Self-reviewed
- [ ] Manual testing performed
- [ ] No breaking changes (or documented)" \
--remove-source-branch=false
Extract new MR_IID and MR_URL. Update review.md and progress.md with real values (replace "TBD").
If MR already existed
Check approval state:
glab api "projects/<REPO_SLUG_ENCODED>/merge_requests/<MR_IID>/approvals" 2>/dev/null
(<REPO_SLUG_ENCODED> = repo slug with / replaced by %2F, e.g. epm-cdme%2Fcodemie-ui)
Parse "user_has_approved" from JSON. If true ā revoke first:
glab mr revoke <MR_IID> --repo <REPO_SLUG> 2>/dev/null
Push:
git push origin $(git branch --show-current)
Approve MR (both paths)
glab mr approve <MR_IID> --repo <REPO_SLUG> 2>/dev/null
Inform developer: "Review complete. MR: <MR_URL>"
If critical issues remain open ā warn: "šØ <N> critical issues remain open ā do not merge until resolved."
ā Save final progress (status: completed)
Progress Tracking
Every "ā Save progress" instruction means: use the Write or Edit tool on .codemie/reviews/<TICKET>/progress.md.
- First time (file doesn't exist) ā use
Write to create it with all steps as [ ]
- New review run (file already exists) ā use
Write to overwrite it and reset ALL steps to [ ] first, then proceed step by step
- After each step completes ā use
Edit to flip only that step - [ ] Step N ā - [x] Step N and update **Last updated**
File format:
# Review Progress: <TICKET>
**Last updated**: <ISO-8601 UTC timestamp>
**MR**: !<MR_IID> <MR_URL>
## Steps
- [ ] Step 0: Interactive setup
- [ ] Step 1: Context gathered
- [ ] Step 2: Spec checked
- [ ] Step 3: Files found (<N> files)
- [ ] Step 4: Review complete
- [ ] Step 5: Spec saved
- [ ] Step 6: Findings presented
- [ ] Step 7: Fixes applied
- [ ] Step 8: Committed
- [ ] Step 9: Pushed + approved
## State
REVIEW_DEPTH: <quick|deep|unset>
BASE_BRANCH: <branch>
TICKET: <ticket>
MR_IID: <iid>
MR_URL: <url>
Create the file at Step 1 (when TICKET and MR_IID are first known). Mark each step [x] immediately after it completes.
Integration Points
| Caller | Context passed | Behavior |
|---|
| Developer directly | None ā reads MR auto | Automated (default) or interactive (--interactive) |
| dark-factory | ticket, goal | Uses provided context, skips brianna, auto-fixes all issues |
When called by dark-factory
- Use ticket and goal from caller ā skip brianna
- Step 1 MR check still runs ā if no MR, auto-create without prompting
- All other steps run as normal