| name | self_repair |
| description | Fix, explore, and refactor the crocbot codebase safely using Claude Code as a high-thinking-budget sub-agent. Use when the user requests codebase repairs, complex refactors, or deep exploration of the crocbot project structure. |
Self Repair
This skill enables crocbot to safely repair and refactor its own codebase using Claude Code (claude) as a high-thinking-budget sub-agent.
Overview
Self-repair uses a specialized command configuration to ensure Claude Code operates with maximum analytical depth and bypasses routine permission prompts to maintain momentum during autonomous sessions.
Workspace Awareness
The sub-agent is aware of two critical paths:
- Source Code:
{projectRoot} (where repairs/exploration happen)
- Identity Workspace:
{workspaceDir} (where research, reports, and persistent documentation are stored)
Workflow
1. Launching a Repair or Research Session
Always use the following command structure. Replace <instructions> with the specific task.
bash pty:true workdir:{projectRoot} background:true command:"claude -p 'Use maximum thinking budget for this prompt and make sure you output a detailed summary end of response. You have permission to write files directly to my identity workspace at {workspaceDir}/ for reporting or research purposes. Instructions: <instructions>' --dangerously-skip-permissions"
2. Full Lifecycle (Repair, Build, Redeploy)
When a sub-agent is tasked with modifying the code, it must follow this completion sequence:
- Modify Code: Apply the requested fixes/refactors.
- Build: Run
pnpm build to ensure the changes are valid and compiled.
- Redeploy: Once the build succeeds, it must restart the gateway service:
systemctl --user restart crocbot-gateway
- Continuity: The sub-agent should understand that restarting the gateway will terminate its parent session. It should finalize its report/summary BEFORE the restart command.
2. Monitoring Progress
Once the session is launched, monitor the output using the process tool:
process action:log sessionId:XXX
process action:poll sessionId:XXX
3. Verification
Once the sub-agent completes the task, review the summary provided by Claude Code to verify the changes.
Safety Rules
- Targeted Scope: Always set the
workdir to {projectRoot}.
- Deduplication: Before starting a new repair session, check
process action:list to ensure a similar session isn't already running.
- Reporting: Always provide the user with the final "detailed summary" generated by Claude Code.