Skip to content

Instantly share code, notes, and snippets.

@KanshuYokoo
Created February 23, 2026 03:01
Show Gist options
  • Select an option

  • Save KanshuYokoo/2be2e7838791f775e12819beaeae4d95 to your computer and use it in GitHub Desktop.

Select an option

Save KanshuYokoo/2be2e7838791f775e12819beaeae4d95 to your computer and use it in GitHub Desktop.
Prompt template
<!--
<role>: Who are you? (The Persona)
<context>: Where are we? (The Backstory)
<task>: What are we doing? (The Action)
<constraints>: What are the rules? (The Safety/No-Hallucination Guardrails)
-->
<instruction_set>
<role>
<!--
Avoid Generic Roles: Don't just say Programmer.
Use Senior React Developer focusing on Atomic Design or Database Administrator specializing in PostgreSQL Query Optimization.
Combine with Constraints: A role sets the style,
but the <constraints> tag ensures the safety. For example, a Web Developer might naturally want to use a popular NPM package, but your constraints should specify if you are limited to internal Google libraries.
Antigravity Specifics: Since Antigravity is used for large-scale professional codebases, the most effective roles often include the Seniority level (e.g., "Staff Engineer") because it forces the model to prioritize maintainability and "clean code" over "quick hacks."
-->
</role>
<context>
<!--
<context>: Where are we? (The Backstory)
While backstory is helpful,
for coding pro use, try to keep the <context> focused on technical debt, architectural shifts, or edge cases.
Emotional backstory (e.g., "I'm in a rush") is less effective than technical backstory (e.g., "This must handle 10k concurrent connections").
This section sets the stage. It tells the AI about the project's history, the current state of the code, and the specific environment it is operating in.
Key Elements:
Project History: What led to this point? (e.g., "We are migrating from a monolithic architecture to microservices.")
Current State: What is the status of the code? (e.g., "The codebase is 500k lines of code, written in TypeScript.")
Environment: What tools and versions are being used? (e.g., "We are using React 18, Node 16, and Docker.")
Business Goal: What is the high-level objective? (e.g., "We need to reduce latency by 20%.")
Antigravity Specifics: In Antigravity, the <context> is crucial for grounding the AI in the specific codebase it is looking at. It helps the AI understand the "lay of the land" before making changes.
-->
</context>
<!--
To minimize hallucinations and maximize "pro" utility,
this template uses a Constraint-First approach. By wrapping instructions
in XML tags, you provide clear semantic boundaries
that help the model distinguish between context, code, and rules.
-->
<rules_of_engagement>
<constraint>NO HALLUCINATIONS: If an internal API is not in context, state "API_UNKNOWN".</constraint>
<constraint>STYLE: Strict adherence to Google-internal style guides and Repo-specific patterns.</constraint>
<constraint>TYPES: Mandatory strict typing. No 'any' or 'interface{}'.</constraint>
</rules_of_engagement>
<technical_constraints>
<!--exmaple
<constraint>Zero-allocation where possible.</constraint>
<constraint>No external dependencies outside the standard library.</constraint>
<constraint>Avoid mutex contention; prefer channels for synchronization.</constraint>
-->
</technical_constraints>
</instruction_set>
<environment_context>
<objective>
</objective>
<environment>
<editor>Antigravity / VSCode Hard Clone</editor>
<language_version></language_version>
<frameworks></frameworks>
</environment>
</environment_context>
<reference_code>
</reference_code>
<prompt>
<task>
</task>
</prompt>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment