Setup and context — When Writing an Issue Becomes Writing Code
In software development, GitHub Issues serve as the central hub for tracking bugs, feature requests, and improvements. But the gap between filing an issue and actually writing the first line of code often involves multiple steps: understanding the spec, reviewing existing code, deciding on an implementation approach, and setting up the right branch.
By combining Antigravity's AI agent with the GitHub MCP server, you can build a workflow that reads issue descriptions and generates context-aware code automatically. This article walks you through building this "Issue → Code Generation" pipeline, complete with configuration files and practical examples.
This guide is aimed at developers who are comfortable with Antigravity's basics and want to take their productivity to the next level. Familiarity with GitHub operations like creating issues and managing branches is assumed.
Setting Up the GitHub MCP Server
To give Antigravity access to your GitHub data, you need to configure the GitHub MCP (Model Context Protocol) server. MCP servers are the standard protocol that Antigravity agents use to communicate with external services. For a deeper dive into how MCP works, check out the MCP Server Guide.
Installation
Add the GitHub MCP server to your Antigravity configuration. Edit .antigravity/settings.json in your project root:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"
}
}
}
}Set GITHUB_PERSONAL_ACCESS_TOKEN to a Personal Access Token generated from GitHub. Grant the repo scope for private repositories and read:org for Organization repositories.
Verifying the Connection
Once configured, you can test the connection in Antigravity's Agent mode:
# In Antigravity Agent mode
> List all open issues for my-org/my-project from GitHub
# The agent fetches issues via MCP and displays them
# Expected output:
# Issue #42: Make user profile page responsive
# Issue #41: Add fuzzy search to the search feature
# Issue #40: Improve dashboard loading performanceIf the MCP server is working correctly, the agent will call the GitHub API and retrieve your issue data.
Defining Issue-to-Code Rules with AGENTS.md
Antigravity's AGENTS.md file lets you customize agent behavior on a per-project basis. By defining "rules for generating code from issues" here, you ensure consistent, high-quality output from the AI agent.
Create .antigravity/AGENTS.md in your project root:
# Code Generation Rules from Issues
## Pre-checks
- Check the issue's labels (bug, feature, enhancement) to identify the task type
- Search existing code under `src/` to identify affected files
- Map out file dependencies
## Code Generation Standards
- Follow the project's coding style (ESLint / Prettier configuration)
- Add JSDoc comments to all new functions
- Generate test files alongside production code (placed in `__tests__/`)
- Centralize type definitions in the `types/` directory
## Branch Naming Convention
- feature: `feature/issue-{number}-{brief-description}`
- bugfix: `fix/issue-{number}-{brief-description}`
- enhancement: `enhance/issue-{number}-{brief-description}`
## Commit Messages
- Use Conventional Commits format
- Always include the issue number (e.g., `feat(auth): add OAuth2 login flow (#42)`)With this configuration, the agent will automatically create branches, follow your coding conventions, and generate well-structured code after reading an issue.
Hands-On: Generating Code from an Issue
Let's walk through the actual workflow using a concrete example issue.
Step 1: Feed the Issue to the Agent
In Antigravity's Agent mode, enter a prompt like this:
> Read GitHub Issue #42 "Make user profile page responsive" and generate code
> following the rules in AGENTS.md.
> Check the existing code in src/components/Profile/ before starting.Step 2: The Agent's Automated Process
The agent performs these steps automatically:
- Fetches Issue #42 details (body, labels, comments) via the GitHub MCP server
- Analyzes existing code under
src/components/Profile/ - Creates a
feature/issue-42-responsive-profilebranch per AGENTS.md rules - Generates responsive code (media queries, Tailwind classes, etc.)
- Creates test files at
__tests__/Profile.responsive.test.tsx - Commits using Conventional Commits format
Step 3: Reviewing the Generated Code
// src/components/Profile/ProfileCard.tsx (modified by agent)
import { FC } from 'react';
import { User } from '@/types/user';
interface ProfileCardProps {
user: User;
}
/**
* User profile card component
* Responsive layout supporting mobile, tablet, and desktop
* @see Issue #42
*/
export const ProfileCard: FC<ProfileCardProps> = ({ user }) => {
return (
<div className="w-full max-w-sm mx-auto md:max-w-md lg:max-w-lg">
<div className="flex flex-col items-center md:flex-row md:items-start gap-4">
<img
src={user.avatarUrl}
alt={`${user.name}'s profile picture`}
className="w-24 h-24 rounded-full md:w-32 md:h-32"
/>
<div className="text-center md:text-left">
<h2 className="text-xl font-bold md:text-2xl">{user.name}</h2>
<p className="text-gray-600 mt-1">{user.bio}</p>
</div>
</div>
</div>
);
};The agent generates code that directly addresses the issue requirements. For more on Antigravity's agent-first workflow design, see the Agent-First Workflow Practical Guide.
Batch Processing Multiple Issues
Solo developers and small teams often need to tackle a backlog of issues in one sitting. Antigravity's agent supports batch workflows that process multiple issues sequentially.
> Process the following issues in order:
> - #42: Make profile page responsive
> - #43: Add autocomplete to the search bar
> - #44: Fix color palette for dark mode
>
> Create separate branches for each issue with independent commits.The agent processes each issue one by one, creating dedicated branches and commits for each. Once finished, it reports a summary of changes and branch names.
For advanced CI/CD pipeline integration that takes this further, the Antigravity × GitHub Actions Advanced CI/CD Pipeline guide covers production-grade setups in detail.
Best Practices for Production Use
Here are key tips for running the Issue-to-Code workflow effectively.
Structure Your Issue Templates
The quality of generated code correlates directly with the clarity of your issues. Use GitHub's issue templates to ensure every issue includes:
- Summary: What needs to be done (1-2 sentences)
- Acceptance criteria: Definition of done (bullet points)
- Technical notes: Specific libraries or APIs to use
- Related files: Hints about which files need changes
Always Include Human Review
Generated code should always go through human review before merging. When reviewing agent-created PRs, focus on:
- Business logic correctness
- Security considerations
- Performance implications
- Existing test integrity
Use Labels for Priority Management
Leverage GitHub labels to guide the agent's prioritization. By adding priority rules to your AGENTS.md, you can instruct the agent to process priority: high issues first, ensuring critical work gets done before nice-to-haves.
Summary
Connecting Antigravity with GitHub Issues creates an AI-powered workflow that accelerates the entire development cycle: from issue creation to code generation, PR submission, and CI/CD verification. The combination of AGENTS.md rules and the GitHub MCP server forms the backbone of this system.
Start small — try it with simple issues like style fixes or utility function additions — and observe the output quality before expanding to more complex tasks. For foundational GitHub integration setup, the GitHub Integration Guide is a great companion resource.