Fixing a Bug
From symptom to patch using search, read, edit, and verification
A typical bug-fix loop in Claude Code: the main agent stays grounded in system identity and task rules, locates the issue with grep and file reads, applies a surgical edit, and validates with bash while security constraints stay active throughout.
7 stepsdebuggingtoolsworkflow
Step-by-step breakdown
1
⚙️Agent identity & guardrails
Identity & IntroductionEvery turn starts with the core system prompt: role as an interactive coding agent, security boundaries, and URL safety before any tools run.
You are an interactive agent that helps users with software engineering tasks.
Techniques
role-settingguardrailsscope-limiting
2
⚙️How to work on tasks
Task Execution & Code Style3
🔧Find references
Grep Tool4
🔧Inspect the code
File Read Tool5
🔧Apply the fix
File Edit Tool6
🔧Run tests or checks
Bash Tool7
⚙️Security-aware execution
Cyber Risk & Security Boundaries