Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
902311f
feat(skills): add async-pr-review skill
mattKorwel Feb 22, 2026
c1b640a
refactor(skills): optimize async-pr-review for agentic workflow
mattKorwel Feb 22, 2026
c3272a5
refactor(skills): dynamic paths and worktree scoping for async-pr-review
mattKorwel Feb 22, 2026
a49a502
feat(skills): improve async-pr-review workflow and logging
mattKorwel Mar 10, 2026
4fbf969
Merge remote-tracking branch 'origin/main' into feat/update-async-pr-…
mattKorwel Mar 10, 2026
dcb7dd7
feat(skills): add macOS notifications to async-pr-review
mattKorwel Mar 10, 2026
3f7523b
Merge branch 'main' into feat/update-async-pr-review
mattKorwel Mar 10, 2026
ee5d325
feat(skills): improve async-pr-review test running and diff analysis
mattKorwel Mar 10, 2026
ccf29e5
fix(skills): remove full test suite fallback in async review
mattKorwel Mar 10, 2026
9f46923
fix(skills): handle pending CI checks in async pr review test step
mattKorwel Mar 10, 2026
fb0a1e1
Update .gemini/skills/async-pr-review/SKILL.md
mattKorwel Mar 11, 2026
0c8b8bd
feat(skills): migrate async-pr-review to use policy.toml
mattKorwel Mar 11, 2026
739de66
fix(skills): secure and complete async-pr-review policy.toml
mattKorwel Mar 11, 2026
6e79770
fix(skills): restrict gh pr commands to read-only in policy.toml
mattKorwel Mar 11, 2026
0052657
feat(skills): enrich async-pr-review policy with core unix and read-o…
mattKorwel Mar 11, 2026
078ad35
Merge branch 'main' into feat/update-async-pr-review
mattKorwel Mar 11, 2026
17f3266
Apply suggestion from @mattKorwel
mattKorwel Mar 12, 2026
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
45 changes: 45 additions & 0 deletions .gemini/skills/async-pr-review/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: async-pr-review
description: Trigger this skill when the user wants to start an asynchronous PR review, run background checks on a PR, or check the status of a previously started async PR review.
---

# Async PR Review

This skill provides a set of tools to asynchronously review a Pull Request. It will create a background job to run the project's preflight checks, execute Gemini-powered test plans, and perform a comprehensive code review using custom prompts.

This skill is designed to showcase an advanced "Agentic Asynchronous Pattern":
1. **Native Background Shells vs Headless Inference**: While Gemini CLI can natively spawn and detach background shell commands (using the `run_shell_command` tool with `is_background: true`), a standard bash background job cannot perform LLM inference. To conduct AI-driven code reviews and test generation in the background, the shell script *must* invoke the `gemini` executable headlessly using `-p`. This offloads the AI tasks to independent worker agents.
2. **Dynamic Git Scoping**: The review scripts avoid hardcoded paths. They use `git rev-parse --show-toplevel` to automatically resolve the root of the user's current project.
3. **Ephemeral Worktrees**: Instead of checking out branches in the user's main workspace, the skill provisions temporary git worktrees in `.gemini/tmp/async-reviews/pr-<number>`. This prevents git lock conflicts and namespace pollution.
4. **Agentic Evaluation (`check-async-review.sh`)**: The check script outputs clean JSON/text statuses for the main agent to parse. The interactive agent itself synthesizes the final assessment dynamically from the generated log files.

## Workflow

1. **Determine Action**: Establish whether the user wants to start a new async review or check the status of an existing one.
* If the user says "start an async review for PR #123" or similar, proceed to **Start Review**.
* If the user says "check the status of my async review for PR #123" or similar, proceed to **Check Status**.

### Start Review

If the user wants to start a new async PR review:

1. Ask the user for the PR number if they haven't provided it.
2. Execute the `async-review.sh` script, passing the PR number as the first argument. Be sure to run it with the `is_background` flag set to true to ensure it immediately detaches.
```bash
.gemini/skills/async-pr-review/scripts/async-review.sh <PR_NUMBER>
```
3. Inform the user that the tasks have started successfully and they can check the status later.

### Check Status

If the user wants to check the status or view the final assessment of a previously started async review:

1. Ask the user for the PR number if they haven't provided it.
2. Execute the `check-async-review.sh` script, passing the PR number as the first argument:
```bash
.gemini/skills/async-pr-review/scripts/check-async-review.sh <PR_NUMBER>
```
3. **Evaluate Output**: Read the output from the script.
* If the output contains `STATUS: IN_PROGRESS`, tell the user which tasks are still running.
* If the output contains `STATUS: COMPLETE`, use your file reading tools (`read_file`) to retrieve the contents of `final-assessment.md`, `review.md`, `pr-diff.diff`, `npm-test.log`, and `test-execution.log` files from the `LOG_DIR` specified in the output.
* **Final Assessment**: Read those files, synthesize their results, and give the user a concise recommendation on whether the PR builds successfully, passes tests, and if you recommend they approve it based on the review.
148 changes: 148 additions & 0 deletions .gemini/skills/async-pr-review/policy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# --- CORE TOOLS ---
[[rule]]
toolName = "read_file"
decision = "allow"
priority = 100

[[rule]]
toolName = "write_file"
decision = "allow"
priority = 100

[[rule]]
toolName = "grep_search"
decision = "allow"
priority = 100

[[rule]]
toolName = "glob"
decision = "allow"
priority = 100

[[rule]]
toolName = "list_directory"
decision = "allow"
priority = 100

[[rule]]
toolName = "codebase_investigator"
decision = "allow"
priority = 100

# --- SHELL COMMANDS ---

# Git (Safe/Read-only)
[[rule]]
toolName = "run_shell_command"
commandPrefix = [
"git blame",
"git show",
"git grep",
"git show-ref",
"git ls-tree",
"git ls-remote",
"git reflog",
"git remote -v",
"git diff",
"git rev-list",
"git rev-parse",
"git merge-base",
"git cherry",
"git fetch",
"git status",
"git st",
"git branch",
"git br",
"git log",
"git --version"
]
decision = "allow"
priority = 100

# GitHub CLI (Read-only)
[[rule]]
toolName = "run_shell_command"
commandPrefix = [
"gh workflow list",
"gh auth status",
"gh checkout view",
"gh run view",
"gh run job view",
"gh run list",
"gh run --help",
"gh issue view",
"gh issue list",
"gh label list",
"gh pr diff",
"gh pr check",
"gh pr checks",
"gh pr view",
"gh pr list",
"gh pr status",
"gh repo view",
"gh job view",
"gh api",
"gh log"
]
decision = "allow"
priority = 100

# Node.js/NPM (Generic Tests, Checks, and Build)
[[rule]]
toolName = "run_shell_command"
commandPrefix = [
"npm run start",
"npm install",
"npm run",
"npm test",
"npm ci",
"npm list",
"npm --version"
]
decision = "allow"
priority = 100

# Core Utilities (Safe)
[[rule]]
toolName = "run_shell_command"
commandPrefix = [
"sleep",
"env",
"break",
"xargs",
"base64",
"uniq",
"sort",
"echo",
"which",
"ls",
"find",
"tail",
"head",
"cat",
"cd",
"grep",
"ps",
"pwd",
"wc",
"file",
"stat",
"diff",
"lsof",
"date",
"whoami",
"uname",
"du",
"cut",
"true",
"false",
"readlink",
"awk",
"jq",
"rg",
"less",
"more",
"tree"
]
decision = "allow"
priority = 100
Loading
Loading