A experimental Go-based coding assistant that generates complete, structured code projects using AI. It creates actual files, handles multiple languages, and follows best practices through customizable agent rules.
The Coding Agent is an AI-powered tool that:
- Generates complete code projects from natural language descriptions
- Creates actual files with proper directory structure
- Supports multiple programming languages (Go, Python, JavaScript, etc.)
- Follows coding best practices through customizable rules
- Handles complex multi-file projects with proper organization
- Provides beautiful visual feedback with loading animations and progress indicators
# 1. Install dependencies
go mod tidy
# 2. Set up your API key
cp .env.example .env
# Edit .env with your OpenRouter API key
# 3. Run the agent
go run main.go -prompt "Create a REST API server in Go with user management"go run main.go -prompt "Create a simple HTTP server in Go"# Multi-file web application
go run main.go -prompt "Create a complete Go web app with handlers, models, and database integration"
# Microservices architecture
go run main.go -prompt "Create a microservice with authentication, user management, and API gateway"
# Terraform infrastructure
go run main.go -prompt "Create Terraform code for S3 bucket with Lambda function"- AI-Powered Code Generation - Uses OpenRouter API with multiple models
- Multi-File Project Generation - Creates complete project structures
- Multiple Language Support - Go, Python, JavaScript, Terraform, and more
- Structured JSON Responses - Parses AI responses into organized file structures
- Visual Loading Animations - Beautiful spinner with progress indicators
- Tree-Style File Display - Shows project structure before generation
- Environment Configuration -
.envfile for API keys and settings - Agent Rules System - Customizable
.agentrulesfile for coding guidelines - Flexible Output Directory - Configurable output locations
- Model Selection - Choose different AI models (GPT-4, Claude, etc.)
- Robust Error Handling - Graceful fallbacks for API failures
- JSON Parsing Recovery - Handles malformed AI responses
- Directory Auto-Creation - Creates nested directories automatically
- Configuration Validation - Validates required settings on startup
- Progress Indicators - Real-time file creation progress
- File Size Reporting - Shows generated file sizes
- Comprehensive Logging - Detailed operation feedback
- Cross-Platform Support - Works on macOS, Linux, and Windows
- API Key: Get your OpenRouter API key from openrouter.ai
- Environment File: Copy
.env.exampleto.envand add your API key
- Agent Rules: Create
.agentrulesfile for custom coding guidelines - Output Directory: Set
OUTPUT_DIRin.envto change where files are generated - AI Model: Choose different models by setting
MODELin.env
Customize code generation behavior with .agentrules:
# Agent Rules - Dos and Don'ts for Code Generation
## DO:
- Always include proper error handling
- Use meaningful variable and function names
- Follow language-specific conventions
## DON'T:
- Don't hardcode sensitive information
- Don't use deprecated functions
## TERRAFORM SPECIFIC RULES:
- Always create backend.tf, providers.tf, variables.tf
- Never hardcode values - use variables
- Create individual resource files (iam.tf, s3.tf, etc.)Generated projects follow best practices:
generated/
├── main.go # Entry point
├── handlers/
│ └── user.go # HTTP handlers
├── models/
│ └── user.go # Data models
├── services/
│ └── user_service.go # Business logic
├── go.mod # Go module file
└── README.md # Generated documentation
- "API key required": Check your
.envfile hasOPENROUTER_API_KEY - "JSON parsing failed": AI response format issue - agent falls back gracefully
- Permission errors: Ensure output directory is writable
- Check the generated
README.mdin output directories for usage instructions - Review agent rules in
.agentrulesfor customization options - Ensure stable internet connection for API calls
# Build standalone binary
go build -o coding-agent main.go
# Run the binary
./coding-agent -prompt "your prompt here"Made with ❤️ using Go and AI