Use cases/Fixing a Bug

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 & Introduction
Hide

Every 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 Style
Show
3
🔧Find references
Grep Tool
Show
4
🔧Inspect the code
File Read Tool
Show
5
🔧Apply the fix
File Edit Tool
Show
6
🔧Run tests or checks
Bash Tool
Show
7
⚙️Security-aware execution
Cyber Risk & Security Boundaries
Show