Post

Mastering Antigravity Agents: Best Practices and Configuration Guide

A comprehensive guide to configuring Antigravity Agents using Rules, Skills, and Workflows for autonomous development.

Mastering Antigravity Agents: Best Practices and Configuration Guide

Antigravity Agents represent the next evolution in AI-assisted development. Unlike passive code completion tools, Antigravity Agents are autonomous, context-aware, and tool-capable. To harness their full potential, you must configure them with a robust structure of Rules, Skills, and Workflows.

This guide covers the best practices for structuring your .agent configuration to build a powerful Development Agent.


1. The Trinity of Configuration

An effective Antigravity setup relies on three distinct components, all living in the .agent directory.

📜 Rules (.agent/rules/*.md)

The Context & Constraints. Rules provide persistent memory and behavioral guidelines. They are the “Constitution” of your agent.

  • Trigger Mechanisms:
    • always_on: Global rules (Architecture patterns, Tech Stack).
    • glob: File-specific rules (e.g., globs: {py,ts}).
    • model_decision: Dynamic personas activated by intent (e.g., “Act as a DBA”).
    • manual: Explicitly activated by user mention (e.g., @rule).
  • Best Practice: Keep rules focused. Use always_on sparingly to avoid Context Window pollution. Use model_decision for specialized tasks.

🛠️ Skills (.agent/skills/*/SKILL.md)

The Capabilities. Skills extend what the agent can do. They are executable functions wrapped in instructions.

  • Structure: A folder containing a SKILL.md (instructions) and optional scripts.
  • Best Practice: Port your essential CLI knowledge here. Don’t just list commands; explain when and how to use them (e.g., “Use npm run test:backend to verify Flask changes”). For UI and browser-automation projects, mention and utilize the browser_subagent for visual debugging and testing.

🔄 Workflows (.agent/workflows/*.md)

The Process. Workflows are structured, multi-step procedures triggered by slash commands.

  • Trigger: The filename dictates the command (e.g., debug.md -> /debug).
  • Best Practice: Use workflows for repetitive, complex tasks (e.g., “Feature Implementation” or “Root Cause Analysis”). Define clear steps: Gather -> Plan -> Execute -> Verify.

2. Governance Strategy

Separation of Concerns

  • Rules define “Who I am and What I must (not) do”.
  • Skills define “What tools I can use”.
  • Workflows define “How I should execute a multi-step task”.

Limits & Performance

  • File Limits: Rules and Workflows are strictly limited to 12,000 characters. Concise writing is key.
  • Atomic Design: Break large workflows into smaller, composable pieces if necessary.

3. The Antigravity Config Generator

Want to configure a new project instantly? Use this Meta-Prompt. Copy it into your Antigravity chat, and it will analyze your project to generate a tailored .agent directory.

📋 Copy this Prompt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# System Prompt: Generate Antigravity Agent Configuration

You are an expert in configuring **Antigravity Agent Rules, Skills, and Workflows**. Your task is to analyze the current project structure and generate a complete, strictly compliant `.agent` directory configuration.

## 1. Core Concepts & Definitions

Strictly adhere to these definitions and constraints (Max 12,000 chars per Rule/Workflow file):

### A. Rules (`.agent/rules/*.md`)
**Purpose**: Manually or automatically activated constraints/personas.
**Triggers** (Must specify one in frontmatter):
- `always_on`: Always applied (Global context).
- `glob`: Applied when active file matches extensions (e.g., `globs: {ts,tsx}`).
- `model_decision`: Model decides based on description (e.g., "Act as a Database Expert").
- `manual`: User activates via `@rule`.

### B. Skills (`.agent/skills/<name>/SKILL.md`)
**Purpose**: Reusable packages of knowledge/commands.
**Structure**: Must be a folder containing a `SKILL.md` file.

### C. Workflows (`.agent/workflows/*.md`)
**Purpose**: Structured sequences of steps for repetitive tasks.
**Trigger**: Slash command (Filename determines trigger, e.g., `add-feature.md` -> `/add-feature`).
**Structure**: Title, Description, and numbered Steps.

## 2. Analysis Phase
- **Scan**: Read `README.md`, `package.json` (or equivalent).
- **Identify**: Tech stack, coding style, common tasks (debug, test, deploy).

## 3. Generation Phase
Generate the following files in `.agent/`. Use standard English.

### A. Rules
1.  **Project Core (`core.md`)**:
    -   *Trigger*: `always_on`
    -   *Content*: Arch patterns, tech stack, critical constraints.
2.  **Code Style (`style.md`)**:
    -   *Trigger*: `glob` (CRITICAL: Must specify extensions using `globs` key, e.g., `globs: {ts,tsx,py}`)
    -   *Content*: Naming conventions, specific syntax preferences.
3.  **Specialist Persona (`implementer.md`)**:
    -   *Trigger*: `model_decision` ("Act as...")
    -   *Content*: Persona for implementing code (e.g., "Minimal changes", "Verify with tests").

### B. Skills
1.  **Dev Toolkit (`.agent/skills/dev-toolkit/SKILL.md`)**:
    -   *Content*: CLI commands for Run, Test, Lint, Build, database access.

### C. Workflows
1.  **Feature Workflow (`.agent/workflows/add-feature.md`)**:
    -   *Trigger*: `/add-feature`
    -   *Steps*: Requirements -> Plan -> Implement -> Verify.
2.  **Debug Workflow (`.agent/workflows/debug.md`)**:
    -   *Trigger*: `/debug`
    -   *Steps*: Symptom -> Logs -> Root Cause -> Fix -> Verify.

## 4. Output Format
Return the content for each file using standard markdown code blocks, specifying the absolute path (e.g., `.agent/rules/core.md`).

---
**Example Frontmatter for Rule:**
```markdown
---
trigger: always_on
description: Core Project Instructions
---

Example Frontmatter for Glob Rule:

1
2
3
4
5
---
trigger: glob
description: Python Code Style
globs: {py}
---

Example Frontmatter for Workflow:

1
2
3
---
description: Interactive workflow for debugging
---

```

By standardizing your Agent configuration, you ensure that every AI interaction starts with a deep understanding of your project’s unique DNA.

This post is licensed under CC BY 4.0 by the author.