Antigravity CLI — Patterns
Reusable patterns for Antigravity CLI. Multi-agent workflows, async tasks, hooks, model routing, cross-model review, and CI/CD integration.
Antigravity CLI — Patterns
Reusable workflow patterns for Antigravity CLI.
Multi-Agent Workflows
Antigravity CLI's subagent system lets you run multiple agents concurrently:
Background Code Review
> /agents --background --model "Claude Opus 4.6 (Thinking)"
"Review src/auth/ for security vulnerabilities"
> /agents --background --model "Gemini 3.5 Flash (High)"
"Review src/ui/ for accessibility issues"
> /agents --background --model "Claude Sonnet 4.6 (Thinking)"
"Review src/api/ for error handling gaps"
... continue working while agents run ...
Results arrive asynchronously.
Generate + Polish Pipeline
> /model Gemini 3.5 Flash (High)
> Generate a complete CRUD API for a blog platform
> /model Claude Opus 4.6 (Thinking)
> Review the generated code for: edge cases, error handling, performance
Async Background Tasks
Delegate long-running work and keep your session free:
> /agents --background "Refactor all SQL queries to use parameterized statements"
> /agents --background --model "Gemini 3.1 Pro (High)"
"Write documentation for all exported functions in src/lib/"
Check status:
> /agents status
[1] Refactoring SQL queries — 12/24 files complete
[2] Writing documentation — 8/15 functions complete
Hooks Pipeline
Combine hooks for autonomous fix → verify → report cycles:
.gemini/hooks/
├── pre-apply # Always run lint before changes
├── post-apply # Run formatter after changes
└── verify # Build + test after changes
pre-apply:
#!/bin/bash
npm run lint
post-apply:
#!/bin/bash
npx prettier --write .
verify:
#!/bin/bash
npm run build && npm test
The agent automatically runs these hooks in sequence, retrying on failure.
Cross-Model Review
Use different models for generation vs. review:
> /model Gemini 3.5 Flash (High)
> Generate a TypeScript utility: debounce, throttle, memoize
> /model Claude Opus 4.6 (Thinking)
> Audit the generated utilities for: type safety, edge cases, performance
CI/CD Integration
PR Review (GitHub Actions)
name: AI PR Review
on: [pull_request]
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install agy
run: curl -fsSL https://antigravity.google/cli/install.sh | bash
- name: Review
run: agy -p "Review this PR diff" --output-format json
env:
ANTIGRAVITY_API_KEY: ${{ secrets.ANTIGRAVITY_API_KEY }}
Automated Documentation
agy -p "Generate API documentation from JSDoc comments in src/api/" \
--output-format json
Related
Related Articles
CLI-First Antigravity Image Pipeline
Build sites with fast CLI tools, generate images in Antigravity with Nano Banana, and compress to WebP with cwebp. All under one Google AI Pro plan.
Claude Code — Configuration Reference
Complete Claude Code configuration reference. Covers claude.json settings, MCP server setup, hook scripts, .claude/ directory conventions, and environment variable overrides.
CLI-First Development with Antigravity Image Pipeline
Use fast CLI tools for all coding, then switch to Antigravity for Nano Banana image generation. Both under one Google AI Pro plan with no per-image fees.