Skills: SKILL.md Progressive Disclosure & Custom Runbooks
In the previous post on Rules, we hit a hard boundary: all always-on rules share a 20,000-token budget, and any single file over 24 KB is silently truncated. One rule of thumb bears repeating: do not dump multi-step SOPs like release checks, database migrations, or incident runbooks into AGENTS.md.
The reason is straightforward. When you tweak a line of UI copy, you have no use for a 200-line database rollback procedure. Yet if it lives in always-on rules, every new session injects it verbatim into context—burning your budget and diluting the coding constraints that actually matter.
Antigravity separates these “rarely needed day-to-day, fixed multi-step workflow when invoked” procedures into a dedicated mechanism: Skills. Combining the official skills and json_configs docs with hands-on inspection of agy v1.5.19 on my workstation, this guide breaks down how Skills save tokens, how discovery works, how to author reliable ones, and the pitfalls to watch out for.

1. Why Rules Aren’t Enough—and Why Skills Exist
Because Rules, Skills, and Plugins all involve writing Markdown instructions for an Agent, newcomers to Antigravity often hesitate over which mechanism to pick.
Put side by side, their boundaries are crisp:
| Type | Typical Path | Loading Mechanism | Best For |
|---|---|---|---|
| Rules | AGENTS.md / .agents/rules/*.md |
Always-on or path/condition-triggered; counts toward the 20k Rules budget | Standing constraints, code style, and module boundaries that apply continuously |
| Skills | skills/<name>/SKILL.md |
Three-tier progressive disclosure; exposes 1–2 summary lines at idle and loads on demand | Multi-step operational runbooks (troubleshooting, releases, migrations) |
| Plugins | plugins/<name>/plugin.json |
Enabled, disabled, and distributed as a single bundle | Packaging related Skills + Rules + Hooks + MCP servers for cross-repo reuse |
In one sentence:
- A Rule is a standing policy: regardless of the task, entering a directory or touching matching files requires following it (e.g., “never modify historical migrations” or “reply in Chinese by default”).
- A Skill is an operational runbook: it stays tucked away off your desk until the user asks to cut a release, review a PR, or run a database migration—only then does the agent open the manual, run its scripts, consult reference tables, and verify the outcome.
2. Progressive Disclosure: Hundreds of Lines Reduced to One or Two
The single highest-leverage design behind Skills is Progressive Disclosure. Rather than stuffing every playbook into the System Prompt upfront, Antigravity splits skill invocation into three on-demand layers:
- Tier 1 (Always-on summary): At session startup, Antigravity injects only a compact manifest containing each mounted Skill’s
name,description, and absoluteSKILL.mdpath—never reading the body. Even if a Skill and its reference docs total hundreds of KB, it takes just 1–2 lines (a few dozen tokens) in idle context. - Tier 2 (On-demand expansion): Only when you explicitly type
/<skill-name>, or when the model matches your request against a Skill’sdescription, does it callread_fileto load the fullSKILL.md. - Tier 3 (Deep on-demand): Large protocol docs live in
references/, complex commands inscripts/, templates inresources/, and sample code inexamples/. The model follows links to read sub-documents or run scripts only when a specific step inSKILL.mdrequires them—unvisited branches add zero bytes to context.
Measured locally with wc -l -c against the built-in agy-customizations Skill in agy v1.5.19:
- Always-on startup injection (
name+description+ path): ~280 bytes; - Entry file
SKILL.mdread upon match: 109 lines / 5,598 bytes; - Its 6 bundled sub-documents (
hooks.md15.5 KB,json_configs.md4.9 KB,plugins.md4.7 KB,mcp_servers.md3.4 KB,skills.md2.6 KB,rules.md1.8 KB) total 32,954 bytes.
If you only ask “how do I author a Skill?”, the model reads the 5.6 KB SKILL.md and pulls only the 2.6 KB skills.md—never touching the 15.5 KB hooks.md. On sessions unrelated to customization, that entire 38 KB bundle consumes just 280 bytes of metadata, cutting context overhead by over 99%.
Here is the full trigger and on-demand expansion flow:
flowchart TD
U["User submits task or invokes /skill-name"] --> L1["Tier 1: Scan always-on Skill summaries<br/>(name + description + SKILL.md path only)"]
L1 --> M{"Explicitly invoked or description matched?"}
M -- "No match" --> N["Skip all Skill bodies; handle request normally"]
M -- "Matched" --> L2["Tier 2: Call read_file to load full SKILL.md"]
L2 --> S{"Does the step need external docs or scripts?"}
S -- "Need reference details" --> R["Tier 3: Read references/ or examples/ on demand"]
S -- "Need automated checks" --> SC["Tier 3: Run encapsulated scripts/"]
S -- "Pure step-by-step guidance" --> V
R --> V["Verify results against SKILL.md done criteria"]
SC --> V
V --> O["Output evidence-backed conclusions or fixes"]
3. Standard Directory Layout & SKILL.md Frontmatter Spec
A compliant Skill must live in its own directory under skills/:
1 | skills/<skill_name>/ |
SKILL.md must begin with YAML frontmatter, and its core schema is intentionally minimal:
1 | --- |
Three details that commonly trip people up:
name(required): A globally unique identifier in lowercase kebab-case. Keep it identical to the directory name so slash commands and conflict troubleshooting map 1:1.description(required, highest leverage): The model decides whether to open this runbook entirely from this field. Official guidance recommends writing in the third person and covering three things: what it does + when to trigger + when NOT to use it. Skip vague blurbs like “a useful release helper”—spell out concrete trigger cues and negative boundaries.metadata(optional) & relative links: UI-facing Skills can declare ametadatablock—for instance, the built-inmcp-app-development/SKILL.mdsetsmetadata.icon: handyman. Reference bundled scripts or docs using standard relative Markdown links (such as[prepare.sh](./scripts/prepare.sh)). Because the model receives the absolute path toSKILL.md, it resolves relative targets accurately.
4. Discovery Paths, 5-Tier Precedence & Local Inspection
Antigravity discovers Skills using the same hierarchy as Rules, with one extra rule: built-in Skills are mounted explicitly rather than scanned blindly. When two Skills share the same name (for example, both the project and global directories define code-review), higher precedence overrides lower precedence.
Per the official agy-customizations docs, the 5-tier precedence order from highest to lowest is:
| Priority | Source Tier | Discovery Path / Config | Notes |
|---|---|---|---|
| P1 | Workspace upward traversal | .agents/skills/*/SKILL.md from CWD → ... → .git |
Closer to CWD wins; also supports .agent/, _agents/, _agent/ |
| P2 | Workspace declarative config | .agents/skills.json |
Explicitly mounts non-default directories; supports entries, inherits, and filters |
| P3 | Global directory discovery | ~/.gemini/config/skills/ (plus ~/.agents/skills/ compatibility) |
Applies to all local workspaces; also loads skills/ from enabled plugins |
| P4 | Built-in Skills | ~/.gemini/antigravity-cli/builtin/skills/ |
Shipped with the client; explicitly mounted per Agent config, not blind-scanned |
| P5 | Global declarative config | ~/.gemini/config/skills.json |
Mounts custom machine-wide shared directories; lowest priority |
Local verification of P4 built-in Skills: Running ls ~/.gemini/antigravity-cli/builtin/skills/ on agy v1.5.19 reveals 16 built-in Skills (agy-customizations, antigravity_guide, automation, conversations, generative_ui, mcp-app-development, migrate-agent-settings, migrate-workflows, native_swarm, permissioned-github, plugin, run-workflow, swarm_monitor, swarm_narrator, swarm_pane, ui-plugin-navigation). In a standard terminal session, however, the system prompt does not inject all 16—it mounts only the subset required by the active Agent config (such as agy-customizations, antigravity-guide, conversations, and run-workflow). This confirms the documented “mounted by name rather than blind directory scanning” behavior.
Here is the actual Skills directory layout active on my Linux workstation:

All four sources stay cleanly separated without interfering with one another:
- Built-in (16): Located under
~/.gemini/antigravity-cli/builtin/skills/, covering customization docs, workflow orchestration, MCP App development, and multi-agent Swarm coordination. - Personal global custom: Located at
~/.gemini/config/skills/browser-tab-group/, containing a lean 34-lineSKILL.md(2,642 bytes) that delegates session title lookup and browser extension redirect URL generation toscripts/session-tab-url.py—a textbook “thin instructions + heavy script” design. - Cross-tool compatible directory: Under
~/.agents/skills/,code-review(29 lines),debug-root-cause(30 lines), andgit-commit(25 lines) each sit at 1.2–1.7 KB, adding virtually zero overhead. - Plugin-bundled Skills: Once the local
abcplugin is enabled, its four skills under~/.gemini/config/plugins/abc/skills/(accept,config,connect,copy) are merged into the available list automatically with no manual copying.
5. Building a Project Skill Step by Step (Monorepo Sharing & /learn)
Specs alone rarely stick until you ship one. Below is a production-ready db-migration-check Skill you can drop straight into an application repository to automate pre-merge and pre-deploy database migration checks.
1. Directory Layout
1 | .agents/skills/db-migration-check/ |
2. Main File SKILL.md (Lean Entrypoint + Explicit Acceptance Criteria)
1 | --- |
3. Encapsulated Script scripts/verify.sh (Never Hardcode CWD)
1 |
|
4. Offloading Heavy Details to references/checklist.md
Put lock-severity matrices, dual-write steps for adding columns to large tables, and online DDL compatibility notes across database versions into references/checklist.md. For routine new tables or small changes, the model runs verify.sh and wraps up without ever reading a multi-hundred-line reference sheet. Only when high-risk DDL shows up does Step 2 pull it into context.
Measured against the four best practices in the official docs, this template hits every mark:
- Progressive disclosure: The entrypoint stays under 35 lines; heavy docs live in
references/. - Script-encapsulated commands:
scripts/verify.shlocks down the exact checks so the model does not hand-craft fragile, escape-prone regex pipelines on the fly. - Explicit verification criteria: Non-zero exit handling, local dry-run checks, and a strict “never claim safe if skipped” reporting contract.
- Zero filler: No lectures explaining what SQL is or how
git diffworks—only your team’s concrete quality gate.
5. Sharing Across a Team Monorepo with .agents/skills.json
In large monorepos, teams typically centralize shared skills under a top-level tools/agents/skills/ directory rather than duplicating folders into every service. Declare them in .agents/skills.json:
1 | { |
Three path rules worth noting (from docs/json_configs.md):
- Directories listed in
entriesare scanned only one level deep (<entry>/<skill_name>/SKILL.md), not recursively. pathsupports absolute paths (leading/), home-relative paths (leading~/), and relative paths (resolved relative to the declaring dot-directory first, falling back to the repository root).- When starting a session inside a subdirectory, every
.agents/skills.jsonalong the path from CWD up to the repository root takes effect—teammates get them immediately aftergit pull.
6. Don’t Want to Write from Scratch? Capture Workflows with /learn
The fastest way to author a strong Skill is rarely writing one from a blank page. Instead, solve a complex task end-to-end once, then distill it into a Skill with /learn.
Suppose you spend half an hour guiding the Agent through “build Docker image → push to staging registry → inspect K8s Pod logs → verify health endpoint,” hitting two environment-variable pitfalls and tweaking a startup flag along the way. Before closing the session, run /learn to extract the verified steps and edge cases into .agents/skills/<name>/SKILL.md (and pull recurring commands into scripts/). Lightly polish the generated description and acceptance criteria, and anyone on the team can replay that entire release-troubleshooting flow with a single prompt.
6. Five Common Pitfalls When Authoring Skills
- Writing a
descriptionthat is too broad or too vague
Describing a Skill as “helps developers write better code and fix bugs” causes false triggers on ordinary chats, wasting tokens reading the body. Conversely, overly academic phrasing that omits the words developers actually type (likePR,diff,migration, orrelease) prevents the model from ever matching it. Fix: Use third person, include 2–3 concrete trigger phrases, and add aDo not use for ...clause to draw a sharp negative boundary. - Stuffing all documentation into one giant
SKILL.md
Pasting error-code catalogs, past incident writeups, and API field tables directly into the main file bloats it past 600 lines and defeats progressive disclosure. Fix: TreatSKILL.mdas a table of contents plus step skeleton (aim for under 100 lines), and push any reference longer than half a screen intoreferences/via on-demand links. - Hardcoding CWD-relative paths inside scripts
A./migrationsor./scripts/helper.pypath that passes at the repo root immediately fails withNo such file or directorywhen someone launchesagyinsideservices/order/. Fix: Locate bundled assets withSCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"and locate the repo root withgit rev-parse --show-toplevel. - Specifying “how to run” without “how to verify” or “when to abort”
With only 1-2-3 execution steps and no verification signal, a model encountering a mid-run error often assumes “looks fine” and wraps up early. Fix: Pair every critical step with a machine-verifiable check (stop on non-zero exit code, grep for expected log markers, run a dry-run) and explicit abort/rollback conditions. - Copying raw Skill directories across repos when you also need MCP and Hooks
When a workflow requires a Skill for step-by-step instructions, a dedicated MCP server for external APIs, and aPreToolUseHook to block mistakes, distributing.agents/skills/alone makes team alignment fragile. That combination belongs in a Plugin bundle—which we will unpack in Part 9 of this series.
Permission boundary reminder: Just like Rules, Skills are prompt-layer guidance, not a security firewall. If a script performs destructive actions—deleting resources, pushing to production branches, or mutating production databases—do not rely on writing “please ask the user first” in SKILL.md. Use hooks.json (covered in the next post) to enforce hard pre-execution blocks before the tool ever runs.
















