What Is GEPA Prompting?

GEPA stands for Goal, Environment, Plan, Action—a structured prompting framework specifically designed for debugging tasks in unfamiliar codebases. Unlike generic "fix this bug" prompts, GEPA forces systematic thinking by breaking down the debugging process into four distinct phases:
- Goal: Clearly define what success looks like
- Environment: Document the current state (files, dependencies, errors)
- Plan: Outline the investigation strategy before touching code
- Action: Execute the plan with specific changes
This structure mirrors how senior engineers approach debugging and gives Claude Code the context it needs to reason effectively.
Why It Works With Claude Code
Claude Code excels at multi-file analysis and shell operations, but it needs proper framing to avoid "shotgun debugging"—making random changes hoping something sticks. GEPA provides that framing by:
- Reducing context switching: By establishing the environment upfront, Claude doesn't need to repeatedly ask "what files are relevant?"
- Encouraging hypothesis-driven debugging: The planning phase forces consideration of multiple failure modes
- Improving token efficiency: Structured prompts use tokens more effectively than rambling descriptions
When tested on new bugs in unfamiliar repositories, GEPA prompts achieved a 20% higher solve rate compared to standard prompts.
How To Implement GEPA In Your Workflow
Basic GEPA Template
Add this to your CLAUDE.md or use it as a starting prompt:
## GEPA Debugging Framework
**GOAL**
- [Describe the expected behavior]
- [Define acceptance criteria]
**ENVIRONMENT**
- Relevant files: [list files with paths]
- Current error: [paste exact error]
- Dependencies: [list relevant packages/versions]
- Reproduction steps: [how to trigger the bug]
**PLAN**
- Hypothesis 1: [possible cause]
- Investigation: [how to test]
- Hypothesis 2: [alternative cause]
- Investigation: [how to test]
- Priority: [which to check first]
**ACTION**
- [Execute the investigation plan]
- [Make minimal changes]
- [Test each change]
Example: Debugging a Flask API Error
**GOAL**: GET /api/users returns JSON array, not 500 error
**ENVIRONMENT**:
- Files: app.py, models/user.py, tests/test_api.py
- Error: "sqlalchemy.exc.OperationalError: no such table: users"
- Dependencies: Flask 2.3, SQLAlchemy 2.0, pytest
- Reproduction: `curl http://localhost:5000/api/users`
**PLAN**:
1. Check database initialization
2. Verify table creation in migrations
3. Test database connection
**ACTION**:
First, examine app.py for database setup...
Advanced: GEPA + Claude Code Commands
Combine GEPA with Claude Code's shell access for maximum effectiveness:
# Use Claude Code to gather environment data automatically
claude code "Run 'git log -1 --oneline' and 'pip freeze | grep sqlalchemy' for ENVIRONMENT section"
# Then apply GEPA framework
claude code "<paste GEPA template with gathered data>"
When GEPA Shines

- New codebases: First-day debugging on unfamiliar projects
- Complex failures: Multiple interacting components causing issues
- Team handoffs: When someone else's code breaks and you need to understand it quickly
- Production incidents: Structured approach reduces risk of making things worse
Limitations & Alternatives
GEPA adds overhead for trivial bugs (typos, syntax errors). For simple issues, direct commands work faster:
# Simple fix - no GEPA needed
claude code "Fix the syntax error on line 42 of utils.py"
But for anything requiring investigation, the 20% improvement justifies the extra structure.
Integrating With Existing Workflows
If you already use CLAUDE.md for project context, add a GEPA section:
## Debugging Guidelines
Use GEPA framework for all non-trivial bugs:
1. Define Goal first
2. Document Environment with 'git status' and error logs
3. Create Plan before editing
4. Action with minimal changes
This creates a consistent debugging approach across your team.









