name: anti-gravity-codegen description: Autonomous code generation without human intervention. Creates, refactors, and fixes code using AI. Use for rapid prototyping, feature implementation, refactoring, and bug fixing - all automatically.
Anti-Gravity Codegen ๐
Autonomous code generation. Describe what you want, get working code.
Quick Start
# Generate new feature
python3 {baseDir}/scripts/antigravity.py generate "Create a React login form with validation"
# Refactor existing code
python3 {baseDir}/scripts/antigravity.py refactor src/old.js --target "Convert to TypeScript"
# Fix bugs automatically
python3 {baseDir}/scripts/antigravity.py fix src/buggy.js --from-error "TypeError: Cannot read property"
# Generate from template
python3 {baseDir}/scripts/antigravity.py template "API endpoint" --output src/api/users.ts
How It Works
- Analyze - Understands requirements and context
- Generate - Creates code using AI
- Validate - Checks syntax and basic errors
- Test - Runs if tests exist
- Integrate - Places in correct location
Commands
Generate
antigravity.py generate "<description>" [--output <file>] [--template <type>]
Templates:
react-component- React component with propsapi-endpoint- REST API endpointfunction- Utility functionclass- OOP class structuretest- Unit tests
Refactor
antigravity.py refactor <file> --target "<goal>"
Examples:
- "Convert to async/await"
- "Add TypeScript types"
- "Extract into smaller functions"
- "Modernize ES5 to ES6+"
Fix
antigravity.py fix <file> --from-error "<error message>"
Auto-fixes based on:
- Error messages
- Stack traces
- Linting errors
- Type errors
Examples
Generate Component
$ antigravity.py generate "Button component with loading state" --template react-component --output src/Button.tsx
โ
Generated: src/Button.tsx
Props: label, onClick, loading, disabled
Size: 45 lines
TypeScript: โ
Refactor Legacy Code
$ antigravity.py refactor src/old-api.js --target "Convert to fetch API with error handling"
โ
Refactored: src/old-api.js
Changes: 12 modifications
Tests passing: โ
Auto-Fix Bug
$ antigravity.py fix src/utils.js --from-error "Cannot read property 'map' of undefined"
โ
Fixed: Added null check
Line 23: if (!data) return []
Workflow Integration
With Git Cycle
# Generate, test, commit
antigravity.py generate "new feature"
npm test
gitcycle.py full -m "Add auto-generated feature"
With Master Coding Cycle
# Part of full development cycle
requirements = "Add user authentication"
generated = antigravity.generate(requirements)
tests_pass = test.run(generated)
if tests_pass:
git.commit("Add auth")
Safety Features
- โ Backup original files
- โ Validate generated code
- โ Run existing tests
- โ Show diff before applying
- โ ๏ธ Review mode for critical files
Configuration
{
"anti-gravity": {
"model": "claude-3.5-sonnet",
"temperature": 0.2,
"autoApply": false,
"reviewRequired": true
}
}
Best Practices
- Start small - Generate functions, not whole apps
- Review output - Always check generated code
- Test immediately - Run tests after generation
- Commit first - Git backup before big changes
- Iterate - Generate โ Review โ Refine