mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-31 06:02:47 -07:00
6.0 KiB
6.0 KiB
Gemini CLI: PR Tooling & Automation Guide
This document provides a comprehensive overview of the specialized skills, custom commands, and extension tools available for managing Pull Requests within the Gemini CLI project. These tools are designed to automate verification, enforce standards, and streamline the review-to-merge lifecycle.
1. Built-in Agent Skills (.gemini/skills/)
These skills are available globally within the workspace and provide structural workflows for different phases of the PR lifecycle.
A. pr-creator
- Purpose: Guides the creation of high-quality PRs.
- Workflow:
- Verifies current branch is not
main. - Enforces a descriptive commit message following Conventional Commits.
- Locates and applies the repository's
.github/PULL_REQUEST_TEMPLATE.md. - Mandatory: Runs
npm run preflightlocally before pushing. - Uses
ghCLI to create the PR from a temporary description file.
- Verifies current branch is not
- Key Principle: Never push to
main; never ignore the PR template.
B. code-reviewer
- Purpose: Conducts professional, multi-dimensional code reviews.
- Target: Can review remote PRs (
gh pr checkout) or local uncommitted changes. - Analysis Pillars: Correctness, Maintainability, Readability, Efficiency, Security, Edge Cases, and Testability.
- Key Principle: Execute
npm run preflightearly to catch automated failures before performing human-level analysis.
C. async-pr-review
- Purpose: Executes a background review job to avoid blocking the main session.
- Mechanism: Uses an "Agentic Asynchronous Pattern" where a background shell
script invokes a headless
gemini -pinstance. - Workflow: Creates an ephemeral worktree, runs preflight, and generates a
final-assessment.md. - Key Principle: Prevents git lock conflicts by using isolated worktrees in
.gemini/tmp/async-reviews/.
D. pr-address-comments
- Purpose: Helps the author systematically resolve feedback.
- Workflow: Uses
scripts/fetch-pr-info.jsto gather all comments and provides a checklist (✅ for resolved, [number] for open threads). - Key Principle: The agent summarizes but waits for user guidance before fixing issues.
2. UX Extension Skills (ux-extension/)
These skills are part of the specialized UX team extension and prioritize "finish line" polish and TUI design principles.
A. _ux_finish-pr
- Purpose: Expert PR maintenance and final polish.
- Core Principle: "Always maintain a clean, focused diff by resolving merge conflicts early and squashing into a single feature commit."
- Unique Features:
- TDD Fallback: If a fix fails 2-3 times, it mandates creating a local reproduction test case.
- Snapshot Review: Mandates manual review of updated
.snapor.svgfiles after running tests with-u. - Force-Push safety: Uses
--force-with-lease.
B. _ux_git-worktree
- Purpose: Implements the Base Folder Strategy.
- Rules: All work happens in sibling directories (e.g.,
main/,feature-name/). - Workflow: Automates
git worktree addand semantic PR checkouts (e.g.,pr-123-fix-logo). - Key Principle: Prevents macOS sandbox interference by including
main/.gitin the trusted environment.
C. _ux_designer
- Purpose: Ruthlessly enforces the v1.0 Design Principles.
- Principles:
- Signal over Noise: Mandates collapsible components
(
<ExpandableText>). - Coherent State: Global state belongs in the "Bottom Drawer" (Footer).
- Intent Signaling: Long-running tasks must telegaph progress via spinners.
- Strategic Color: Functional use of color only; no "rainbow" text.
- Signal over Noise: Mandates collapsible components
(
3. Custom Commands (.gemini/commands/)
These shortcuts inject specific context or trigger focused agent loops.
/pr-review <PR_NUMBER>: Triggers theoncall/pr-review.tomlprompt. It automates checkout, runsnpm run preflight, and drafts a professional approval/feedback message./review-and-fix <target>: Initiates the "Pickle Rick" worker loop. It conducts a review, identifies findings, and then spawns a manager-worker loop to fix every issue until validation (npm run build,test,lint,typecheck) passes./frontend: Injects the complete source code ofpackages/cliand key core files, along with theStrict Development Rules./prompt-suggest: Analyzes agent failures and suggests high-level system prompt improvements to prevent recurrence.
4. How to Use These Tools Correctly
To prevent the "recursive failure loop" identified in the pattern investigation, follow these usage rules:
- Start with Worktrees: Always use
_ux_git-worktreeto check out a PR. This keeps yourmainbranch clean and avoids sandbox issues. - Use
/frontendfor UI Tasks: This ensures the agent is aware of theStrict Development Rules(e.g., noany, usewaitForcorrectly). - Run
npm run preflightviapr-creator: Never manually push a PR. Always call thepr-creatorskill, as it forces the full validation suite. - Finish with
_ux_finish-pr: When a PR is "done," use this skill to squash commits, resolve final conflicts withmain, and verify snapshots in a neutral environment. - Don't Bypass Hooks: Never use
git commit --no-verify. If pre-commit hooks fail, use_ux_finish-prto diagnose the root cause.
5. Summary of PR verification lifecycle
| Phase | Tool/Skill | Command |
|---|---|---|
| Checkout | _ux_git-worktree |
worktree-manager.sh pr <#> |
| Fixing | review-and-fix |
/review-and-fix staged |
| UI Audit | _ux_designer |
Audit <Component.tsx> |
| Final Polish | _ux_finish-pr |
activate_skill _ux_finish-pr |
| Submission | pr-creator |
activate_skill pr-creator |