How to Write an Antigravity /Swarm Prompt
Learn to write clear Antigravity /swarm prompts that split coding work safely, define agent ownership, and verify results. Use the template.
How to Write a Prompt for Antigravity’s /swarm Feature
A good prompt for Antigravity’s /swarm feature tells the coordinator what result you need, which parts can be handled independently, what boundaries each worker must respect, and how the finished work should be checked. The goal is not simply to launch more agents. It is to give them a task they can divide without duplicating effort or interfering with one another.
Antigravity’s Swarm feature turns your conversation into a coordinator for a group of named agents. Workers handle separate parts of the task and communicate through a shared message board. A verifier can review the changes and run tests before the coordinator reports back. This makes Swarm useful for work that can be separated by files, packages, or investigation areas. Read Google’s official Swarm guide.
What Should a Good /swarm Prompt Include?
Before writing the prompt, make five things clear:
- The desired outcome: Explain what should be built, fixed, tested, or investigated. Describe the result rather than saying only “improve the code.”
- The project context: Identify relevant folders, files, packages, frameworks, and current behaviour.
- Work boundaries: Explain which areas can be handled independently and which files or components should not be changed by a particular worker.
- Constraints: State what must remain compatible, which conventions to follow, and what must not be changed.
- Verification: Give measurable acceptance criteria and the exact test, build, or lint commands that should be run.
Work boundaries deserve particular attention. If multiple workers make changes in the same area, their work may conflict or become difficult to review. Whenever possible, describe independent parts of the task and ask the coordinator to assign clear ownership. If a shared change is unavoidable, tell the coordinator to coordinate it rather than allowing workers to edit it independently.
A Reusable Antigravity /swarm Prompt Template
Use the following template as a starting point. Replace the bracketed text with details from your own project. You do not need to specify an exact number of agents; describe the work and let the Swarm coordinator decide how to divide it.
/swarm
GOAL
[Describe the feature, bug fix, or investigation you want completed.]
PROJECT CONTEXT
- Relevant files or folders: [Add paths]
- Current behaviour: [Explain what happens now]
- Expected behaviour: [Explain what should happen]
WORK PLAN
Break the task into independent workstreams where possible.
Assign clear ownership for each file, package, or investigation area.
Avoid overlapping edits. Coordinate any change that must be shared.
CONSTRAINTS
- Preserve: [Existing APIs, behaviour, data formats, compatibility]
- Do not: [Change unrelated files, remove tests, add dependencies, etc.]
- Follow the existing project structure and coding conventions.
ACCEPTANCE CRITERIA
- [Specific requirement 1]
- [Specific requirement 2]
- [Important edge cases]
VERIFICATION
Add or update relevant tests.
Have the verifier review the changes and run:
[Insert exact test, build, and lint commands.]
FINAL REPORT
Summarize the work completed, files changed, checks run,
test results, and any remaining issues or risks.
Example: Add Validation to Multiple API Routes
Imagine that your application has three API handlers that need input validation. Since the handlers are in separate files, they may be suitable for parallel work.
/swarm Add input validation to these API handlers:
- src/routes/users.ts
- src/routes/orders.ts
- src/routes/products.ts
Treat each handler as a separate work area and avoid overlapping
edits. Add or update tests for the validation rules.
Follow the validation patterns already used in this repository.
Preserve existing response formats and do not remove existing
test assertions.
After implementation, have a verifier review all changes and run
npm test. Report the files changed, test results, and any failures.
This prompt gives the coordinator a defined outcome, identifies the relevant files, explains the desired separation, and provides a verification command. The coordinator can decide how many workers are appropriate and assign the work. This follows the workflow described in Antigravity’s Swarm documentation.
More Examples of Tasks That Fit /swarm
1. Investigate a slow application startup
/swarm Investigate why this CLI takes several seconds to start.
Use separate read-only investigations for module imports,
configuration loading, and plugin discovery. Do not modify files.
Collect evidence for each possible cause and combine the findings
into a ranked list of likely fixes. Include the files and evidence
that support each finding.
2. Repair tests across packages
/swarm Run the existing test suite and group failures by package.
Assign independent failing packages for investigation and repair.
Do not delete tests or weaken assertions just to make the suite pass.
After the fixes, have a verifier run the full test suite again.
Report the original failures, changes made, and final test results.
3. Add tests to separate utility modules
/swarm Add unit tests for src/utils/date.ts and
src/utils/currency.ts.
Keep the work separated by utility module. Follow the existing
test framework and conventions. Include normal cases, edge cases,
and invalid inputs. Have a verifier run npm test and report
any failures.
How to Start and Monitor a Swarm
In the Antigravity app, open a conversation in your project, type /swarm, and use the command suggestion to insert it. Add your task description after the command and submit it. The coordinator will organise the work and provide a way to open the Swarm pane.
In the Antigravity CLI, enter /swarm in your project and describe the task. You can monitor the live board with /swarm board or the Alt+S shortcut in supported terminal setups. The board lets you follow worker assignments, messages, and reports. You can also ask the coordinator for a status update or provide new instructions while the work is running. See the official instructions for the app and CLI.
How to Check the Results Before Accepting Them
A finished Swarm report is useful, but it should not replace reviewing the actual changes. Before merging or shipping the result:
- Review the final code diff and confirm that only relevant files changed.
- Check that the implementation matches the acceptance criteria.
- Confirm that tests were added or updated for the changed behaviour.
- Check the verifier’s report and confirm which commands were actually run.
- Investigate failures rather than accepting an unsupported claim that everything passed.
- Run important checks yourself when the change affects security, data, or production systems.
Human review required: Review the code diff and test output before merging. Confirm that the changes fit your architecture, security requirements, and release process.
Common Mistakes to Avoid
- Giving an oversized task: “Build my entire application” leaves too much room for interpretation. Start with a specific feature or a clearly bounded milestone.
- Leaving out project context: Include relevant file paths and explain the current behaviour so the agents know where to look.
- Allowing overlapping ownership: Ask the coordinator to separate work areas and coordinate shared-file changes.
- Skipping acceptance criteria: Define what a successful result must do, including important edge cases.
- Forgetting verification: Specify the commands that should be run and ask for an honest report of any checks that could not be completed.
- Using Swarm for every small change: A simple, isolated task may not need multiple agents. Use Swarm when the work can genuinely proceed in parallel.
Frequently Asked Questions
What is the best way to write an Antigravity /swarm prompt?
Describe the desired result, provide relevant project context, identify independent work areas, state constraints, define acceptance criteria, and specify how the result should be tested.
Do I need to tell /swarm how many agents to create?
Usually, no. Describe the task and how it should be verified. The Swarm coordinator decides how many workers to add and how to divide the work.
Can multiple Swarm agents work on the same project?
Yes. Swarm workers coordinate through a shared message board. Antigravity’s documentation also describes shared workspaces by default and the option for the coordinator to give workers separate working copies when needed. Clear ownership still helps prevent conflicting changes.
How do I see what the agents are doing?
Use the Swarm pane in the Antigravity app. In the CLI, open the live board with /swarm board or Alt+S in supported terminal setups.
Is Antigravity /swarm available on every plan?
According to Google’s current Swarm guide, the feature is available on Google AI Pro and Google AI Ultra plans in the Antigravity app and CLI. Google also identifies Swarm as a preview feature, so check the official documentation for the latest availability and limitations.
The practical rule: Write the prompt around the result you need, divide the work by clear boundaries, and tell the coordinator exactly how to verify completion. A well-scoped task gives Antigravity’s Swarm a much better chance of producing work that is useful, reviewable, and ready for your next development step.
