21 typescript rules available
Antigravity's TypeScript collection is dominated by creative-coding rules (particles, shaders, Web Audio, MIDI, canvas, WebXR, physics), most of them short. Only the full-stack TypeScript and React rules are substantive. This file therefore targets browser TypeScript for interactive graphics and audio, where strict typing of DOM and Web Audio APIs and frame-loop discipline matter most.
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/typescript.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: "**/*.ts,**/*.tsx" --- # TypeScript instructions for Antigravity ## Focus for this project - Type DOM lookups explicitly (for example document.querySelector<HTMLCanvasElement>) and handle null results. - Run one requestAnimationFrame loop per scene, use the timestamp argument for timing, and cancel it on teardown. - Create AudioContext only after a user gesture and close it on teardown. - Keep per-frame code allocation-free: reuse arrays and typed arrays instead of creating new objects each frame. ## TypeScript conventions - Keep "strict": true. Note that noUncheckedIndexedAccess is a separate flag that strict does not enable; respect whichever setting tsconfig.json has. - Use unknown, not any, for untrusted data and narrow it with type guards or a schema validator before use. - Model variants as discriminated unions and end switch statements with an exhaustive never check. - Do not add non-null assertions (!) or as casts to silence an error; fix the type instead and explain any cast that remains. ## Before you finish - Run npx tsc --noEmit plus the project's lint and test scripts 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 TypeScript 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 ask Antigravity to add an animated canvas visualization and want typed DOM access, a single requestAnimationFrame loop and cleanup when the component unmounts.
Add a canvas that draws an audio waveform from the microphone after the user presses Start.
A Start button handler that creates the AudioContext and AnalyserNode, a typed canvas lookup with a null check, one rAF loop reading into a reused Uint8Array, a stop/teardown path that cancels the loop and closes the context, and tsc output or a note that it was not run.
Content reviewed 2026-11-05. Confirm instruction activation in your installed client before relying on it.
Generate complex animation systems