A few months back, I used a custom subagent to migrate all of our unit tests . It worked fine, but managing the process from the main agent was messy and wasted a lot of tokens. 💡 As it turns out, running claude in headless mode with a –system-prompt-file works exactly like a subagent does. The documentation makes this option sound a lot more drastic than it really is. It doesn’t replace the entire system prompt, only the conversational/persona parts that define the main interactive agent. This way an external shell script can easily drive a large batch of coding agent micro-sessions. You generally want to keep –tools and –mcp-config minimal for cheap and deterministic execution. There are a few footguns to navigate around –permission-mode , –allowedTools and –disallowedTools , as the way they interact with each other and your settings is not always intuitive. Plus you have to consider that any raised permission prompts will auto-deny in headless mode. 🧩 Long story short, I poured everything I had to learn into a skill as part of my existing scaffolding plugin . It can create various driver scripts for mass-applying a prompt to files or task lists, sequentially or in parallel. submitted by /u/Im2Curious
Originally posted by u/Im2Curious on r/ClaudeCode
