Agent skill
review-and-submit
Lightweight review-fix loop (2 rounds, 1 agent each), then create PR and merge
Install this agent skill to your Project
npx add-skill https://github.com/stablyai/orca/tree/main/.claude/skills/review-and-submit
SKILL.md
review-and-submit
Lightweight autonomous pipeline: review code with a single agent, fix issues (up to 2 rounds), then create PR and merge. Designed for smaller PRs where full parallel review is overkill.
IMPORTANT: Execute this entire process autonomously without asking the user for confirmation at any step.
Process Overview
REVIEW-FIX (max 2 rounds, 1 agent each) → CREATE PR → WAIT FOR CI → MERGE
Step 1: Review-Fix Loop (Max 2 Rounds)
Round Setup (first round only)
Get the diff to understand what changed:
MERGE_BASE=$(git merge-base origin/main HEAD)
git diff $MERGE_BASE --stat
git diff $MERGE_BASE
Each Round: Single-Agent Review
Spawn one review agent that covers all review concerns:
Agent(
subagent_type: "general-purpose",
model: "opus",
description: "Review all changes on branch",
prompt: """
Review all code changes on this branch vs origin/main.
Run: git diff $(git merge-base origin/main HEAD)
Review for:
- Correctness and logical bugs
- Security issues
- Type safety issues
- Error handling gaps
- Performance problems
- Dead code or unused imports
**SCOPE**: Only report issues in changed code or directly caused by the changes.
Do NOT report pre-existing issues unrelated to this PR.
For each finding, output:
- File: path/to/file.ts
- Line: NN
- Severity: Critical|High|Medium|Low
- Issue: [description]
- Fix: [suggested fix]
If no issues found, say "No issues found."
"""
)
Fix Phase
If the review found issues:
- Skip Low severity issues — only fix Critical, High, and Medium
- Fix issues via a single fix agent:
Agent(
subagent_type: "general-purpose",
model: "opus",
description: "Fix review issues",
prompt: """
Fix the following review issues:
[LIST ALL CRITICAL/HIGH/MEDIUM ISSUES FROM REVIEW]
Instructions:
1. Read each file
2. Apply fixes using the Edit tool
3. Verify fixes don't break syntax
4. Report what was fixed
"""
)
- After fixes, run typecheck:
pnpm typecheck 2>&1
If typecheck fails, fix type errors (up to 2 attempts).
Exit Conditions
IF (review found no Critical/High/Medium issues):
→ EXIT loop — code is clean
IF (fixes applied):
→ Run another round to verify (unless already at round 2)
IF (round 2 reached):
→ EXIT loop
Commit Changes
After the review-fix loop completes, commit any changes:
if [ -n "$(git status --porcelain)" ]; then
git add -A && git commit -m "fix: address review findings"
fi
Continue to Step 2 — do not stop here.
Step 2: Create PR and Merge
2a. Create PR
Use the Skill tool: skill: "create-pr"
After /create-pr completes, extract PR info:
gh pr view --json number,url --jq '.number, .url'
2b. Wait for CI Checks
Wait 2.5 minutes before the first poll:
echo "Waiting 2.5 minutes for CI checks..." && sleep 150
CRITICAL: Set timeout: 210000 (3.5 minutes) on the Bash tool call for this sleep.
Poll for results (up to 5 polls, 90s apart)
For each poll:
CHECKS=$(gh pr checks --json name,state,bucket 2>&1)
echo "$CHECKS"
if echo "$CHECKS" | jq -e 'length == 0' >/dev/null 2>&1; then
echo "RESULT:NO_CHECKS"
elif echo "$CHECKS" | jq -e '[.[].bucket] | all(. == "pass" or . == "skipping")' >/dev/null 2>&1; then
echo "RESULT:PASSED"
elif echo "$CHECKS" | jq -e '[.[].bucket] | any(. == "fail" or . == "cancel")' >/dev/null 2>&1; then
echo "RESULT:FAILED"
else
echo "RESULT:PENDING"
fi
PASSED→ Proceed to mergeFAILED→ Attempt one quick fix iteration (diagnose fromgh run view --log-failed, fix, push, re-poll)PENDING→ Wait 90s (sleep 90,timeout: 150000), then poll againNO_CHECKS→ Proceed to merge
2c. Merge
IS_WORKTREE=false
if [ "$(git rev-parse --git-dir)" != "$(git rev-parse --git-common-dir)" ]; then
IS_WORKTREE=true
fi
BRANCH=$(git branch --show-current)
if [ "$IS_WORKTREE" = "true" ]; then
gh pr merge --admin --squash
git push origin --delete "$BRANCH" 2>/dev/null || true
else
gh pr merge --admin --squash --delete-branch
fi
CI Fix Loop (if checks fail)
If CI fails after PR creation, run one fix iteration:
- Diagnose:
FAILED_RUN=$(gh run list --branch $(git branch --show-current) --limit 5 --json databaseId,conclusion,name --jq '[.[] | select(.conclusion == "failure")] | .[0].databaseId')
if [ -n "$FAILED_RUN" ] && [ "$FAILED_RUN" != "null" ]; then
gh run view "$FAILED_RUN" --log-failed 2>&1 | tail -200
fi
- Fix the issues, run
pnpm typecheck, commit and push:
if [ -n "$(git status --porcelain)" ]; then
git add -A && git commit -m "fix: address CI failures"
git push --force-with-lease
fi
- Wait 2.5 minutes and re-poll. If still failing after one fix attempt, merge with
--adminanyway.
Progress Tracking
╔════════════════════════════════════════════════════════════╗
║ REVIEW AND SUBMIT ║
╠════════════════════════════════════════════════════════════╣
║ Review-Fix Loop: ║
║ Round 1: ✅ X issues found, Y fixed ║
║ Round 2: ✅ Clean review ║
║ Create PR: ✅ PR #123 ║
║ CI Checks: ✅ Passed ║
║ Merge: ✅ Merged with --admin --squash ║
╠════════════════════════════════════════════════════════════╣
║ PR URL: https://github.com/org/repo/pull/123 ║
╚════════════════════════════════════════════════════════════╝
Critical Instructions
- DO NOT ask for user confirmation — Execute autonomously
- Max 2 review rounds, 1 agent per round — keep it lightweight
- Only fix Critical/High/Medium — skip Low severity
- DO run typecheck after fixes
- DO use opus model for review and fix agents
- 2.5 minute initial CI wait (not 8 minutes) — this repo's CI is fast
- DO use --admin --squash for merge
- DO set Bash timeouts for sleep commands
- Continue through all steps — don't stop after review or PR creation
- One CI fix iteration max — don't loop forever on CI failures
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
auto-pr-merge
Create PR, wait for checks, fix issues iteratively, and merge with --admin
react-useeffect
React useEffect best practices from official docs. Use when writing/reviewing useEffect, useState for derived values, data fetching, or state synchronization. Teaches when NOT to use Effect and better alternatives.
typescript
This skill should be used when the user asks to "optimize TypeScript performance", "speed up tsc compilation", "configure tsconfig.json", "fix type errors", "improve async patterns", or encounters TS errors (TS2322, TS2339, "is not assignable to"). Also triggers on .ts, .tsx, .d.ts file work involving type definitions, module organization, or memory management. Does NOT cover TypeScript basics, framework-specific patterns, or testing.
auto-submit
End-to-end autonomous pipeline that runs auto-review-fix, then auto-pr-merge
auto-review-fix
Automated iterative code review and fix loop with parallel review agents
electron
Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include "automate Slack app", "control VS Code", "interact with Discord app", "test this Electron app", "connect to desktop app", or any task requiring automation of a native Electron application.
Didn't find tool you were looking for?