In Chapter 5: Subagent-Driven Development (The Manager Pattern), we built a system where a "Manager" AI delegates tasks to "Worker" subagents. This solved the problem of the AI getting tired or confused by large tasks.
However, we still have one major problem: The "Eager Junior" Problem.
AI models are trained to be helpful fast. If you tell them "Fix this bug," their instinct is to guess, apply a random patch, and say "Done!" This leads to messy code, broken features, and technical debt.
We need to turn our AI agents from "Eager Juniors" into "Strict Senior Engineers."
Without discipline, an AI debugging session looks like this:
This is the Guess-and-Check Loop. It is dangerous.
In Superpowers, we introduce Discipline Skills. These are not skills that do things (like writing code); they are skills that govern behavior.
They act like a safety protocol in a chemistry lab. You cannot mix chemicals (write code) until you have put on your safety goggles (written a test).
We will cover two specific protocols:
The test-driven-development skill enforces a strict rule: You cannot write production code until you have written a test that fails.
The skill file contains this instruction:
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST.
Write code before the test? Delete it. Start over.
Without Discipline:
The AI immediately edits submitButton.js to change the onClick handler. It hopes it works.
With Discipline: The AI says: "I must enter the RED phase."
It creates submitButton.test.js:
test('button triggers API call on click', () => {
const mockApi = jest.fn();
const button = render(<Button onSubmit={mockApi} />);
fireEvent.click(button);
// This MUST fail right now because the feature isn't built
expect(mockApi).toHaveBeenCalled();
});
Only after it sees this test fail in the terminal does it allow itself to write the actual button code.
The systematic-debugging skill prevents the AI from guessing. It forces a scientific method approach.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
Symptom fixes are failure.
The skill forces the AI to stop and answer questions before it can touch the code:
You click "Login" and nothing happens. No error message.
Lazy AI: "I'll try reinstalling the node modules." (Guessing).
Disciplined AI: "I am activating Systematic Debugging."
Login.js and AuthService.js."Login.js sends data, but AuthService.js receives an empty object."Only now is the AI allowed to write a fix.
How do we force a large language model to obey these rules? We use Prompt Engineering as Code.
We structure the SKILL.md files with aggressive "Stop Sequences" and logical gates.
Here is how the system handles a request when these skills are active.
Let's look at a simplified version of skills/systematic-debugging/SKILL.md. Notice the capitalized warnings.
# Systematic Debugging
## The Iron Law
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
## Process
1. **Read Error Messages:** Don't skip them.
2. **Trace Data Flow:** Where does the bad value start?
3. **Form Hypothesis:** State clearly: "I think X causes Y".
## Red Flags - STOP
If you catch yourself thinking:
- "Quick fix for now"
- "Just try changing X"
- "I don't understand but this might work"
STOP. Return to step 1.
When the AI loads this skill (via the Context Injection we learned in Chapter 2), these words become part of its identity. It becomes "afraid" to break the rules because the instructions are so explicit.
Because we can trust our agents to be disciplined, we can do something magical: Parallel Work.
If you have 3 unrelated bugs, you don't need to fix them one by one. You can use the dispatching-parallel-agents skill.
Because they are disciplined, they rarely step on each other's toes or break shared code.
Congratulations! You have completed the tour of the Superpowers architecture.
Let's review what we have built:
By combining these layers, you move beyond "chatting" with an AI. You are now collaborating with a structured, intelligent engineering swarm.
The AI no longer just guesses; it plans, it delegates, it tests, and it verifies. You have given it Superpowers.
End of Tutorial.
Generated by Code IQ