1 nextjs rules available
There is one Antigravity rule tagged nextjs: a full-stack TypeScript rule that pairs Next.js with React and strict typing. Because Antigravity plans and executes several edits at once, this file concentrates on the server/client boundary and data mutations, where an agent's multi-file changes most often go wrong in the App Router.
Google describes Antigravity as its agentic development platform. Antigravity reads workspace rules from AGENTS.md or GEMINI.md and from Markdown files in .agents/rules/, with a trigger front matter field that sets when a rule is active. Global rules live under ~/.gemini/.
.agents/rules/nextjs.mdStarting point, not a tested configuration for your repository. Active when files matching globs are involved (trigger: glob). Review the instructions, adapt the file paths and run your project's existing checks.
--- trigger: glob globs: "app/**/*.ts,app/**/*.tsx,src/app/**/*.ts,src/app/**/*.tsx" --- # Next.js instructions for Antigravity ## Focus for this project - Keep database and secret-bearing modules server-only; import them from Server Components, Server Actions or route handlers, never from a "use client" file. - For mutations from forms, prefer a Server Action that validates input and calls revalidatePath or revalidateTag for the affected route. - Before finishing, list which new files are client components and why each needs "use client". ## Next.js conventions - Check package.json for the Next.js major version and whether the project uses app/ (App Router) or pages/ (Pages Router); follow the router that already exists instead of mixing them. - Files under app/ are Server Components by default. Add "use client" only at the smallest component that needs state, effects, event handlers or browser APIs. - From Next.js 15, params, cookies() and headers() are asynchronous, and so is searchParams in page files: await them in pages, layouts, route handlers and generateMetadata. - Put API endpoints in route.ts files that export named HTTP-method functions (GET, POST, ...), and validate request bodies before using them. ## Before you finish - Run the project's lint script and next build (type errors and invalid route exports fail the build) and report the actual output. If you cannot run them, say so and list the exact commands instead of saying they pass. - Summarize which of the rules above affected the change. - Show your plan, including the commands you will run, before editing any file outside the globs in this rule.
Create your own Antigravity rules for Next.js and share with the community.
Ask for a small change to one matching file. Check the tool's loaded context or instruction view, inspect the diff for the requested convention, and run the relevant build or test. A well-formatted file does not guarantee the model follows every instruction.
Antigravity truncates any single rule file over 24,000 bytes, and global plus always_on rules share a 20,000-token budget, according to the docs. AGENTS.md (or GEMINI.md) in a workspace directory is one of the documented rule locations, and ~/.gemini/AGENTS.md works globally. Use .agents/rules/ when a rule should only apply in some situations.
Documentation checked 2026-11-05: Google Antigravity docs: RulesGoogle Antigravity home page
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
You let Antigravity build a form and the server code behind it, and want server-only code kept out of client bundles and request APIs awaited in current Next.js versions.
Add a settings page under app/settings where a signed-in user can change their display name.
app/settings/page.tsx as a Server Component that awaits its data, a small "use client" form component, a Server Action that validates the name and revalidates /settings, plus lint/build output or a note that the build was not run.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.