In Chapter 3: Skill Discovery & Core Library, we built a "Library" that allows our AI to find the right tool for the job.
But having a hammer doesn't mean you know how to build a house. If you hand a hammer to an enthusiastic amateur (or an AI) and say "Build me a house," they will likely start nailing boards together randomly. The result will be a shack that collapses when the wind blows.
To build professional software, we need Architecture. We need to separate "thinking" from "doing."
When you ask a standard AI: "Make me a Snake game in Python," it immediately starts spitting out Python code.
It usually fails because:
We need to force the AI to slow down.
Superpowers introduces a Planning Pipeline that strictly forbids writing code until two things happen:
This pipeline ensures that when we finally start coding, the AI is just following a checklist.
Let's say we want to build a simple "Pomodoro Timer" (a productivity clock).
Without Pipeline:
User: "Build a Pomodoro timer."
AI: Writes 200 lines of buggy Python code immediately.
With Pipeline:
User: "Build a Pomodoro timer."
AI: "Okay, I am opening the Brainstorming skill. Do you want this to be a web app or a command-line tool?"
User: "Command line."
AI: "Should it play a sound when the timer ends?"
User: "Yes."
AI: "Okay, I have created a design. Now I am opening the Writing Plans skill to create the task list."
The first skill in the pipeline is brainstorming. Its job is to interview you.
It contains a <HARD-GATE> rule. This is a special instruction that tells the AI: "Do not write implementation code yet."
The skill forces the AI to loop through a cycle:
When you run this skill, the conversation looks like this:
AI: I'm starting the brainstorming phase.
1. Check existing files... Done.
2. Question: specifically what language should we use? Python or Node.js?
User: Python.
AI: noted.
3. Question: Should we save stats to a database?
User: No, keep it simple.
Once the AI is satisfied, it generates a Design Document.
This is a file saved to docs/plans/2023-10-27-pomodoro-design.md. It acts as the "Blueprints."
# Pomodoro Timer Design
- **Type:** CLI Tool
- **Language:** Python
- **Libraries:** `click` for arguments, `playsound` for alerts.
- **Data Flow:** User inputs time -> Loop counts down -> Sound plays.
Once you approve the design, the AI automatically switches to the next skill: writing-plans.
This skill represents the Site Manager. It takes the blueprint (Design Doc) and converts it into instructions for the workers (the coding agents).
AI models get confused if a task is too big. The writing-plans skill forces the AI to break the feature down into tiny, atomic steps (2-5 minutes each).
This is the output file, usually docs/plans/2023-10-27-pomodoro-plan.md. It looks like a Todo list on steroids.
# Implementation Plan
## Task 1: Basic Timer Logic
- [ ] Create `src/timer.py`
- [ ] Write test: `test_timer_counts_down`
- [ ] Implement `countdown()` function
- [ ] Verify test passes
## Task 2: Add Sound
- [ ] Import `playsound`
- [ ] ...
Notice how detailed this is? It tells the future coder exactly which file to create and which function to write.
How do we force the AI to behave this way? We program it using the SKILL.md files we learned about in Chapter 1: The Skill Definition (Natural Language Programs).
Let's visualize the flow:
Let's look at a simplified version of skills/brainstorming/SKILL.md.
# Brainstorming Logic
## Overview
Turn ideas into designs.
<HARD-GATE>
Do NOT invoke any implementation skill or write code
until the user has approved the design.
</HARD-GATE>
## Process
1. Ask clarifying questions (one at a time).
2. Propose approaches.
3. Write design doc to `docs/plans/`.
4. ONLY THEN invoke `writing-plans`.
Explanation: The <HARD-GATE> tag is a prompt engineering technique. It screams at the AI to stop it from rushing ahead. The "Process" section gives it a strict order of operations.
Now let's look at skills/writing-plans/SKILL.md. This forces the "Bite-Sized" philosophy.
# Writing Plans Logic
## Overview
Write comprehensive plans assuming the engineer has zero context.
## Bite-Sized Task Granularity
Each step is one action (2-5 minutes):
- "Write the failing test"
- "Implement minimal code"
- "Run tests"
## Output Format
You MUST output a file with checkboxes [ ].
Explanation: By defining "Granularity," we prevent the AI from creating a task like "Build the whole app." We force it to think in small, testable steps (Test-Driven Development).
This separation gives you two opportunities to catch mistakes before they become expensive:
If you skipped straight to coding, you would have to rewrite hundreds of lines of code to fix these mistakes. Here, you just rewrite a few lines of English text in a plan.
The Planning Pipeline transforms the AI from a frantic junior coder into a methodical engineering team. It ensures that by the time code is written, the design is solid and the steps are clear.
We have successfully separated Thinking (brainstorming + writing-plans) from Doing.
Now we have a perfectly detailed plan.md file waiting on our hard drive. But who is going to execute it? Do we have to copy-paste tasks manually?
In the next chapter, we will introduce the "Manager," a special skill that reads the plan and assigns tasks to sub-agents automatically.
Subagent-Driven Development (The Manager Pattern)
Generated by Code IQ