How to Tackle Massive Tasks
You have hopefully been infected by my context window paranoia. As you can tell, I'm constantly thinking about the context, constantly thinking about the smart zone and the dumb zone.
Staying in the Smart Zone
With the current generation of models, what I advocate for is staying inside the early part of the context window, the smart zone.
And that is fine for tasks that only require you to operate in one context window. So small features or bug fixes, one session start to finish.
Tasks #1 and #2 fitting entirely within the smart zone
When Tasks Don't Fit
But what happens when you try to do something larger, something that will go into the dumb zone, like a refactor that touches every layer of the application?
Or something where it's just obvious up front that it's not even going to fit into a single context window, let alone fit into the smart zone?
Task #3 spilling into the dumb zone and task #4 overflowing the entire context window
In other words, how do you ship huge chunks of work all at once?
Breaking Down the Problem
Well, you do it in the way that devs have been doing it for decades. You take the big task and you break it down into small chunks, each of which can fit into the smart zone of the agent.
Task #4 broken down across four smart zone boxes
So the question then becomes, what kind of upfront planning do you need to do to make this work? Because up to this point, our plans have really only been to last the duration of a single context window.
We've not really considered what it might look like to have an agent work over multiple sessions, to have work that spans multiple context windows.
Two Essential Documents
I've been experimenting with this a lot and trying out lots of different approaches, and I've landed on one that relies on having two documents.
1. The Spec
Spec definition: a handoff artifact describing the destination of a multi-session piece of work
The first document we need is a description of the destination, the place that we're going. Because if we don't know where we're heading, how are we going to complete the task or know that we did it correctly?
I'm going to call this destination document a spec, a handoff artifact describing the destination of a multi-session piece of work.
This spec is going to be passed to every single session so the individual session knows how its work contributes to the final goal.
We're also going to use the spec at the end to review it, to make sure that we actually got where we said we were going.
2. Tickets
But there's a problem. If you only specify the destination in the spec, how does the agent know how to break it down into small chunks? We need to describe the journey as well as the destination.
Tickets definition showing both spec and tickets as handoff artifacts
This is why alongside the spec, you also write tickets. So one ticket per piece of work that you want to fit into a smart zone. So here we would have four tickets.
Each ticket describes what's going to be done in that session, so it's an implementation plan for that spec.
Scaling Ambitious Work
With this approach, you can take on seriously ambitious work. I've had enormous specs with 30 tickets underneath that have turned out okay.
And so that's the idea of this section. We are going to be talking about how to use specs and tickets to ship larger, more ambitious projects than you could conceive of before.
A refactor touches every layer of your application, and it is obvious up front that it will not fit inside one context window. How do you set the work up?
- Write a spec for the destination, then one ticket per chunk
- Run it as one long session and let it fill the whole window
- Write one very detailed spec and hand it to a single session
- Start on the first file and decide the next step as you go
What is the difference between a spec and a ticket?
- The spec is the destination; each ticket is one leg of the journey
- The spec is the long version; a ticket is the same plan written short
- The spec is written after the tickets, to record what got built
- The spec is for you to read; the tickets are for the agent to read
Set Up Your Issue Tracker
/setup-matt-pocock-skills skill added
AGENTS.md pointing at docs/agents/issue-tracker.md
You now know about specs and tickets, but where do you actually store these documents? Are they local files? Where do they go?
The place I recommend putting both specs and tickets is outside of the repository in an issue tracker. An issue tracker is familiar if you've ever done development - it's used to coordinate work across different teams or across members of your team.
One cool thing about working with an agent is that an agent can read from the same issue tracker that you contribute to. The most famous issue tracker out there is GitHub. You can create GitHub issues which are then able to be accessed by your coding agent via the GitHub CLI.
While this course uses GitHub, you can use any of the concepts we learn here on any issue tracker - Jira, Linear, Todoist, whatever you like. We're going to use GitHub because it's easy to set up, it's free, and you probably already have an account.
GitHub issues page showing 1,200 closed issues and 28 open issues
Steps To Complete
Install and Authenticate the GitHub CLI
The GitHub CLI is how the agent is going to communicate from your local setup to GitHub to fetch the issues.
- Install the GitHub CLI
Visit cli.github.com to find installation instructions for your platform.
- Run
gh auth loginto authenticate
gh auth login
You'll be prompted to choose where you use GitHub (choose github.com), your preferred protocol (choose HTTPS), and whether to authenticate Git with your GitHub credentials (I recommend yes). Then log in with a web browser to complete the process.
- Verify your authentication with
gh auth status
gh auth status
You should see output showing you're logged in to your GitHub account with an active account status.
Terminal showing gh auth status output with logged in account
github.com
✓ Logged in to github.com account <your-username> (...)
- Active account: true
- Git operations protocol: https
- Token: gho_************************************
Fork the Course Repo
By default, any issues you raise will be against the main version of the crash course repo, which means everything's going to be very messy because we'll all be reading each other's issues. That would be a disaster.
So you need to fork the repo to create your own private copy.
- Run
npx ai-hero-cli fork
npx ai-hero-cli fork
- Provide a name for your private GitHub repo
You'll be prompted for a new name for your repo. You can use the default or provide your own.
- Confirm the operation
The CLI will warn you that it's going to replace this folder's git history with a single fresh commit and create a new private GitHub repo. Agree to continue.
Once complete, you'll see a success message with a link to your new private repo on GitHub. All of the previous commands like pull, reset, and cherry-pick still work - the crucial difference is you now have your own set of issues.
Browser showing the newly created private GitHub repo
Configure the Repo to Use GitHub Issues
Now you need to set up this repo to use the correct issue tracker.
- Run
npm run reset
npm run reset
- Search for "setup skills skill"
This will add the /setup-matt-pocock-skills skill to the repo.
- Run
/setup-matt-pocock-skillsin Claude Code
The skill will do a brief exploration of the repo's current state and provide a recommendation on the issue tracker to use.
- When prompted, confirm you want to use GitHub
Type something like "yes, GitHub - write both files" to confirm.
The skill will add infrastructure to your setup so that the agent knows GitHub is the issue tracker. It writes two files:
- An
## Agent skillssection inAGENTS.mdwith a pointer to the issue tracker documentation docs/agents/issue-tracker.mdwith the full GitHub conventions
Claude Code showing the AGENTS.md file with the new Agent skills section
## Agent skills
### Issue tracker
Issues and PRDs live as GitHub issues on <your-username>/<your-repo>, managed with the `gh` CLI. See `docs/agents/issue-tracker.md`.
The docs/agents/issue-tracker.md file contains all the conventions for how the agent should interact with GitHub - commands for creating, reading, listing, commenting on, labeling, and closing issues.
Test Your Setup
Now let's verify everything works by creating a test issue.
- Ask the agent to add a test issue
Add an issue to the issue tracker just as a test, just for a dummy.
The agent should read docs/agents/issue-tracker.md, see that issues live in GitHub, and run:
gh issue create --title "Test issue (dummy)" --body "Dummy issue created as a test of the issue tracker. Safe to close."
- Verify the issue was created
Click the GitHub URL returned by the command to see your new issue in your repo's issue tracker.
GitHub issue page showing the test dummy issue
You are now ready to use GitHub as your issue tracker for specs and tickets. If you have any issues with this, ask in the Discord.
Write Great Specs With This Skill
/to-spec skill added
We now understand why we would want a spec. A spec is a destination document. It helps us manage context over multiple sessions, and it gives us somewhere to aim at.
So you're probably asking, how do I go and create one? Well, there is a skill for that.
The /to-spec Skill
The /to-spec skill takes the current conversation and codebase understanding and produces a spec. In other words, it's not going to grill you about the conversation. It's expecting that a grilling session has already happened in the conversation history.
You can pull it in by running:
npm run reset
Then select the to-spec-skill step from the list, reset the current branch, and the skill will appear in your working tree.
Running npm run reset and selecting the to-spec-skill step
The skill lives at .agents/skills/to-spec/SKILL.md. It's configured with disable-model-invocation: true, which means it's a slash command only - Claude will never reach for it on its own.
The to-spec skill file showing disable-model-invocation configuration
The Process
Our process is going to look something like this:
- Initial grilling session
- Turn that grilling session into a spec
- Turn that spec into tickets
- Implement each individual ticket
- Review against the spec that we initially created
Don't worry, we're going to be going back to this diagram a lot to explain it and flesh it out, but this is the basic idea.
Diagram showing the process: grilling session → spec → tickets → implement → review
In this exercise, we're only doing the first two steps - the grilling session and the spec. We're not going to implement it from there because we need to turn that spec later into tickets. We're just producing the spec in this lesson.
The Spec Template
The spec that's created uses a template that's nice and meaty. It includes:
- A problem statement
- A solution description
- A bunch of user stories (a classic software development technique)
- Implementation decisions
- Testing decisions
- Out of scope items
- Further notes
## Problem Statement
The problem that the user is facing, from the user's perspective.
## Solution
The solution to the problem, from the user's perspective.
## User Stories
A LONG, numbered list of user stories. Each user story should be in the format of:
1. As an <actor>, I want a <feature>, so that <benefit>
## Implementation Decisions
A list of implementation decisions that were made. This can include:
- The modules that will be built/modified
- The interfaces of those modules that will be modified
- Technical clarifications from the developer
- Architectural decisions
- Schema changes
- API contracts
- Specific interactions
Do NOT include specific file paths or code snippets. They may end up being outdated very quickly.
## Testing Decisions
A list of testing decisions that were made.
## Out of Scope
A description of the things that are out of scope for this spec.
## Further Notes
Any further notes about the feature.
There's enough here that anything that picks this up, the implementer agent, is going to get a really nice injection of information to complete the implementation.
The spec template showing problem statement, solution, user stories, and implementation decisions
The Feature We're Building
The thing we're looking at is the instructor dashboard. If you log in as an instructor (Sarah Chen), go to the dashboard and there's just like nothing here.
We did create a nice questions UI for the unanswered questions, but the instructor can't see any analytics, anything that might inform them on how their course is doing.
We need to give them something so that they can see:
- How many users are in their courses
- How much they are earning
- Completion rates
- Quiz scores
An analytics page is so big, so potentially scope creepy and could expand larger and larger that I think it makes a very good candidate for a grilling session followed by a spec. We need to shape this into something reasonable and it's definitely going to be larger than one Smart Zone.
Steps To Complete
Run a Grilling Session
- Run a
/grill-mesession about the Instructor Analytics dashboard
Have a conversation with Claude about what this analytics dashboard should include. Let the grilling session shape the feature into something reasonable and well-defined.
Create the Spec
- Run
/to-specon that conversation
This will synthesize everything from the grilling session into a structured spec document. The spec will be published to your GitHub issue tracker (which you set up in an earlier lesson) with the ready-for-agent triage label applied.
Review the Spec
- Read the spec that ends up in your issue tracker
Take a look at what was generated. Does it capture the conversation well? Is it detailed enough?
- See if the spec matches how you would like a spec to be built
This template is for you to fiddle with if you have any ideas on it. You can modify .agents/skills/to-spec/SKILL.md to adjust:
- The structure of the spec
- What sections are included
- How detailed each section should be
- The format of user stories
- Stop here - do not implement the feature
We're not going to implement it from the spec in this lesson. We need to turn that spec into tickets later. We're just producing the spec for now.
Write Great Specs With This Skill Solution
/to-spec skill added
Write Great Specs With This Skill
We're going to run through the /grill-me skill again, where we're going to initialize it and then use dictation to describe what we want to build.
The full spec this session produces is on GitHub: Instructor Analytics Dashboard. Worth having open alongside this article so you can read the finished document while we build up to it.
The Initial Prompt
I would like to build an instructor analytics dashboard so that instructors have something to look at when they log into the platform.
Not only that, but we also need to be able to show them crucial information. They need to be able to see:
- How much they're earning on the platform
- Completion rates
- Lesson drop-off points
I'm pretty open to suggestions that you have about anything that we might want to implement here too.
Dictating the initial prompt for the instructor analytics dashboard
I'm kind of interested in how this is going to go because we're grilling on a pretty open scope here. Part of the grilling session is going to be figuring out this scope and making sure that we're building the right thing.
The Explore Phase
It's running a pretty deep explore phase. We've got Map schema and domain model, Map routes, auth, and UI conventions. So it's going pretty deep here initially.
Claude running exploration subagents in the background
And it's come back with a good chunk of stuff here.
High-Quality Observations
It's made some observations at the start saying there is no earnings concept in the database - no fee, payout, refund, currency, price history.
How much they're earning is currently only derivable as the amount paid joined through courses.instructor_id. That's gross platform sales.
// Current reality: earnings = SUM of purchase amounts
SUM(purchases.amount_paid)
JOIN courses ON purchases.course_id = courses.id
WHERE courses.instructor_id = ?
This is really high quality information, especially about drop-off has almost no data. This is giving us some really good insights as to what is feasible based on our current data model.
This is kind of like the engineer pushing back on the product owner saying, "No, I'm not sure we can do that with our current data model. That's a bigger lift than you think."
Claude's observations about missing data in the current schema
Round 1: Answering the Questions
But let's now go through and answer these questions.
I agree with your recommendation that a new route under Instructor Analytics makes sense.
We want to see both a cross-course roll-up and a per-course deep dive.
I like the idea of having an admin see something here, and the admin should probably see all instructors with an instructor picker. That's pretty neat.
Let's say that the platform takes a 20% cut. So let's calculate that with a hard-coded rate constant.
When it comes to completion rates, that's an interesting one. I agree with your take that mean per-student calculated progress is probably the best thing, but I won't be sure about that until we see it in action.
I agree that lesson progress is probably cleaner and less lossy than video watch events.
Yes, I agree that a time range filter makes sense so we can have 30, 90 and all time.
That's the first batch done. That is feeling pretty good.
Background Exploration
There were a couple of questions in there that I couldn't really tell what the answer would be until I saw it, and that's sometimes the nature of grilling. Sometimes you do need to actually see something there before you can figure it out.
One nice feature of grilling is in the harnesses that support it, it can actually background an agent. So it can do some exploration in the background while you're continuing chatting, which I really like.
Background exploration running while answering questions
Round 2: The "Zoom Out" Technique
We're now on to round two.
I agree that there are buyers and students and they are separate stats. And we should probably also have a leaderboard for the person who's bought the most so that we can reach out and actually contact them and say, offer them further support.
Here's an interesting case. For question number two, I'm actually not quite sure what it's on about, and so I'll show you what that looks like when I ask it for more information.
Duration-weight the progress calculation? I don't know, that's a bit too jargony for me.
I'm not sure what you mean by question two. Could you zoom out a little bit and give me more, maybe a bit simpler version of that question.
"Zoom out" is like the key leading word for the agent there. It's going to give me a bit more context about the question and hopefully I'll be able to answer it at that point.
Let's look now at question three.
I'm actually having a pretty similar feeling with question three, which is, I don't know what a genuinely monotonic funnel is, or I don't know what a real cliff is. You're talking in jargon, please help me out here.
Implementation Questions
Next, it's asking about grouped SQL or reuse the student helpers in a loop.
This is a really important implementation question and it's doing a good job at explaining it from my level, but if you're not necessarily very experienced with development you might be confused by it and so you might want to ask it to zoom out again.
With number four, I think you should do whatever you feel you need to. It's very hard to anticipate performance questions beforehand, and so we may just want to build the thing that we think is the best effort and then measure performance afterwards.
For number five, yes, use recharts and shadcn's chart.tsx. That seems fine.
We want to put the course selector into URL search params, not client state.
I think for these extras let's actually just put all of them in and then we can always pull back later if needed. I think seeing everything on the screen will be helpful as a first pass and then for a V2 we can always pull it back.
That's a really interesting observation, by the way. We are doing a big chunk of work here, but we're not necessarily expecting the end state to be final, right? We're going to continue working on this. And so it makes sense sometimes to just splurge out a bunch of features and then pull them back.
Is that the end of this round? Yes.
The Restated Questions
It's now restated the questions that we asked it to in plain terms, and this is much better.
How do we turn lessons done into a percentage?
Right, you either count the lessons directly or you weight longer lessons as more in the percentage.
Claude restating the jargon-heavy questions in plain terms
In my experience, the lessons that are short in duration do not necessarily take less time to complete. You might be sending them off to do external work or sending them off to do an exercise.
So I think the only thing that makes sense is to count just purely by lessons.
Next, Q3 restated: what does each bar in the drop-off chart mean?
It's sort of pointing at a hole inside our drop-off logic, which assumes that students always do every single part of the course.
Let's have a look.
Maybe I just don't like this feature, to be honest.
I guess maybe we need to just sort of see it in action before we can tell.
I think option B is a sensible one for Q3, but I kind of need to see it in action before I know if this feature is even any good. So let's go with option B.
Round 3: Seed Data and Leaderboards
We're on to round three.
Let's modify the seed data to match what we're actually seeing here so that we can QA it properly.
We still want 30, 90 all time. We may even want the last week as well, which is especially useful for launches.
I agree with your recommendation on 10.
Let's roll this through.
Note how little context we're spending on this planning. This is only about 40K here. We've not even had to do that much in terms of talking, I suppose. Like we're just answering the questions as they come with relatively short answers.
Context usage showing approximately 40K tokens
It's sending off another sub-agent here to check the seed coupling to test. That's a really interesting question.
It's asking whether the seed data is coupled to how we're doing our testing, and I'm pretty sure it isn't, but this is something very important to verify.
Background agent checking seed coupling to tests
Round 4: Final Details
It's saying one page or tabs. I think tabs make sense, but I probably won't know until I see it.
Zooming down, what do we have?
I want you to give your best effort on 12 and then we can critique it afterwards.
I agree that database indexes are important and so let's add them as part of this.
Sure, we can delete the dead include quizzes parameter on calculateProgress. That seems cheap and easy.
We do need to build an explicit empty state for a brand new instructor. That's a good catch.
Claude catching the edge case of a brand new instructor with no data
That's a really good catch by the way. That is like a classic thing that comes out in grilling is that the agent just thinks of an edge case that you haven't realized yet and just says, what do you want to do in this case and offers you a good recommendation. So nice.
16, yes the extended seed sounds good and that's the right level of scope.
Look at this, this is awesome. It's actually picking up on our testing services skill and it's asking what test coverage we want based on the steering that we've already provided it. Beautiful.
Claude using the testing-services skill to ask about test coverage
A little bit of our steering coming in and now affecting the way that we're grilling. Beautiful, beautiful stuff.
100% agree with your recommendation on test coverage.
OK, zooming down, zooming down. OK, that's it for round four. Lovely.
It looks like after this, the frontier is empty.
Reaching Shared Understanding
We are reaching the state where we have a shared understanding with the agent. I feel pretty confident about what we're building. I'm expecting a pretty big analytics page, a big chunk of new seed data, maybe tabs I think, and lots of new queries and quite a lot of new code I think.
Frontier empty, reaching shared understanding with the agent
It's given us a very small kind of like output here of the information and so it's time to say /to-spec.
And all I'm going to do is just go forward slash to-spec here and it should just handle the rest.
Typing the /to-spec command
You just missed it there, but it immediately went off and read the information on how to issue the spec and where to put it and which issue tracker to use.
The Test Seam Checkpoint
And it says before I write and publish the spec, once the test seams agreed.
Testing is a really important part of building anything, and so in the /to-spec skill, I have a little checkpoint here where it asks the user, where do you want your tests built? At which seam in the application?
The test seam checkpoint in the /to-spec skill
This concept of test seams comes from _Working Effectively with Legacy Code_ by Michael Feathers. I do have the book, so I would do the traditional book wave, but I can't find it.
In this case, it's a very simple decision because we just have this proposed seams one here. So there's only one testing seam, which is we're testing the services themselves.
It says that only works if the root loader is a genuinely thin pass-through. And so what it's doing is it's designing around this constraint to make sure that we're using the existing test seams.
So let's zoom down here. Confirm the single-seam approach. Yes, it looks good.
Confirming the single-seam testing approach
So with that, it should have all the information it needs to go and write the spec.
Walking Through The Spec
And we have our spec.
The completed spec as a GitHub issue
Let's now walk through and just look at each individual section.
The Why: Problem and Solution
One really important part of a spec is not just to tackle the what, but also tackle the why. If the agent has the why, then even if there's a point at which it has to make a tie-breaking decision about like, what should we be doing in this specific situation, this isn't on the spec, then because it's got the why, it can make an informed decision about the purpose of the thing it's building and hopefully get towards the solution better.
This why is in the problem statement and in the solution.
So the problem statement: instructors have no idea how they are doing. When an instructor logs in, they land on the marketing homepage and the only thing built for them is a list of their courses and a per course student roster.
Reading the problem statement from the spec
And so the solution is a dedicated instructor analytics page reachable from the sidebar that gives instructor one screen answering "how is my teaching business doing."
User Stories
Then we have a bunch of user stories here, a lot of them, so 49 of them.
Many of them are as an instructor, and then we've also got a few more as an admin, as a student, as a developer.
If you've never seen a user story before, this is what they look like. They say, as a role, I want something to happen so that something, something.
For instance:
As an instructor with a course but no sales yet, I want each empty panel to explain itself, so that I can tell nothing has happened yet from this feature has broken.
That's the why.
Example user story showing the as/I want/so that structure
The number of the user stories is weirdly important because then it can go and reference the number and say, OK, this fixes user story 35, this fixes user story 37, etc.
Implementation Decisions
Then we go to implementation decisions. So this is some of the implementation decisions that need to be done in the spec.
There's an open question as to how many of these you should include. What I like to do is I like to imagine that these specs are going to be sitting around for a while before they're approved. The idea is you would pass this off to your team to say, okay, this is what I'm planning to build, this is how I'm planning to do it.
And so it doesn't necessarily reference like individual files, let's say. It's mostly saying, okay, these are the specifics of how we're implementing it.
For instance, it's got like types inside here, so analytics_range, and there are also some testing decisions here.
Implementation decisions section showing types and approaches
Testing Strategy
We explicitly say what makes a good test, we say the testing seams, and we say the module's tested, the analytics service only.
Testing strategy section of the spec
It also looks at the cases that must be covered and there's also a decently sized out of scope section.
The further notes stuff is nice.
We're even noting in here two designs the developer expects to critique. The two tabs split, and the final visual both accepted, with the explicit caveat they cannot be judged until they can be seen. Build the best version, expect iteration, do not treat either as settled.
Further notes section mentioning designs to critique
Why I Don't Read My Own Specs
You'll notice this has not really drifted at all from our conversation. And because of that, I rarely actually go and read these specs myself.
If I were to read the spec, what would I actually be testing for? I'd just be testing the agent's ability to summarize what we just talked about. And that's something that I kind of take on trust.
Overall, I'm super happy with this spec. This is a really great destination that we can then test against once we have our implemented code.
And hopefully the process of grilling and then running /to-spec made sense and especially the decision about the test seam as well.
Nice work, and I will see you in the next one.
Split Features Across Context Windows With Tickets
/to-tickets skill added
You have a spec, but you don't yet have a journey. You know the destination, but not how you're going to get there.
You need to create individual tickets for each smart zone, each session. Each ticket will be picked up and implemented one at a time.
But there are good ways to slice up work, and there are bad ways.
Horizontal Slices Are a Trap
Every application has layers. You might have a database, an API, and a front-end as separate deployable units. Within your application, you might have services that talk to the front-end, and within the front-end you might have components with their own layers.
Diagram showing application layers: database, API, front-end, services, and components
When an agent looks at breaking up work that involves different layers, it will usually break them into horizontal slices. Each layer gets its own phase.
Phase 1 focuses on the database. Phase 2 hooks it up to the service. Phase 3 hooks everything up to the front-end.
Diagram illustrating horizontal slices with separate phases for each layer
This looks well-organized and reasonable, but it's a trap. Software developers have known about this for decades.
If you do it this way, all of the code in phase 1, you don't really know if it works or if it's well designed until you're implementing phase 3. You need to cross the layers to work out if the code for that layer is well designed.
With horizontal slices, you get feedback on the whole system far too late.
Vertical Slices Give Early Feedback
The way to fix this is vertical slices. The agent works across layers from the very first phase.
From the word go, they're touching the database, the API, and the front-end. They're building out a minimal implementation first, then building from there.
Diagram showing vertical slices cutting across all layers from the first phase
This means they're getting feedback on their design, its feasibility, and seeing how all the layers integrate from the first phase.
Every phase that builds on that is pretty trivial because it's just building on work that it already knows is well integrated.
Using the phrase "vertical slices" is actually really good because the agent already understands vaguely what it means. The concept of vertical slices and tracer bullets has been around for a long time - it goes back to The Pragmatic Programmer.
The /to-tickets Skill
To get beautifully vertically sliced tickets, you use the /to-tickets skill.
You can grab it by running npm run reset inside the crash course. It's called /to-tickets and after you reset your branch, you'll see it inside .agents/skills.
Terminal showing npm run reset command and the /to-tickets skill in .agents/skills directory
The skill breaks a plan, spec, or conversation into a set of tickets - tracer-bullet vertical slices, each declaring the tickets that block it.
The /to-tickets skill description showing it breaks plans into tracer-bullet vertical slices
When to Call /to-tickets
When you reach the end of a phase, you need to decide what to do next. After /to-spec, that's definitely the end of a piece of work.
Walk through this decision tree:
Can you continue? Do you have enough smart zone left?
If yes, and your context is relevant to the next piece of work, you can keep going in the same session.
Is your context irrelevant? If the information in your context isn't relevant to the next task, start fresh.
In this case, the context is extremely relevant. All the decisions that went into the spec are in the context. It makes sense to keep this around.
Do we need to hand off? Not if we're staying within the same agent and directory.
Can this be done AFK? Not if you need human review.
This situation is a great candidate for compacting if you're outside the smart zone. However, if you don't need to, you can just continue.
Decision tree diagram for when to continue, compact, or start fresh at the end of a phase
Steps To Complete
Install the /to-tickets Skill
- Run
npm run resetto install the/to-ticketsskill
npm run reset
This will pull down the latest skills from the course repository. You should see the /to-tickets skill appear in .agents/skills.
Run /to-tickets in the Same Conversation
- Go back into the conversation where you ran
/to-spec
This is the same session where you created the spec. All the context and decisions are already there.
- Compact if you need to
Check your smart zone remaining. If you're running low, compact the conversation. Otherwise, just continue.
Claude Code status bar showing 64k smart zone remaining
- Invoke the
/to-ticketsskill
/to-tickets
The skill will present you with a breakdown of the different tickets it's going to create, and it will ask for your feedback.
Review the Ticket Breakdown
- Check whether the tickets are horizontally sliced or vertically sliced
Each ticket should cut across all layers - database, API, front-end - not focus on just one layer.
Look for tickets that say things like "implement the database schema" or "build the API endpoints" as separate phases. That's horizontal slicing.
Good vertical slices deliver end-to-end behavior in each ticket - a narrow but complete path through every layer.
- Check that the tickets are not too big
Remember, you've only got one smart zone per session to play with. Each ticket should be sized to fit in a single fresh context window.
If a ticket looks like it's trying to do too much, ask the agent to split it further.
- Provide feedback to the agent
The agent will iterate with you until you approve the breakdown. Don't move forward until the tickets are properly vertically sliced and appropriately sized.
Split Features Across Context Windows With Tickets Solution
/to-tickets skill added
You've grilled the feature, you've turned it into a spec - now you need to break it down into tickets.
Let's run /to-tickets and see what happens.
Running the /to-tickets command in Claude Code
The first proposal: 10 tickets
It comes back pretty fast and gives us 10 tickets.
10 tickets feels way too much for this. If you think of the smart zone as 150,000 tokens, then this would mean we are budgeting 1.5 million tokens for this feature.
That feels like way too much to me. I'm picturing that maximum we would need 450k. So let's say three tickets.
The way I'm able to make that judgment call is just a gut feeling really, just having done a lot of this, a lot of looking at these proposed ticket breakdowns and seeing what comes out.
450k even feels generous. I think this could probably even be done in two sessions, but I don't want to push it.
Claude's initial 10-ticket breakdown showing horizontal slicing
Horizontal slicing is still a problem
What we can see here too is doing classic horizontal slicing as well, which is frustrating because I'm really trying inside the agent to not get it to do this, but it still just persistently does it.
This is why I feel a human looking at this is so important, by the way.
I think 10 is not a good candidate, I'm just going to say:
I would like to break this down into maximum three tickets.
I think ten feels way too much.
Let's give this a go.
Three tickets, but Claude pushes back
Okay, it's now given me three pretty large pieces of work here and it's actually saying:
One trade I want to be explicit about: tickets two and three are larger than a single fresh context window.
Claude's warning about tickets exceeding context window size
So it's saying that it's pretty scared about this overview tab. Okay. Maybe we'll pull it to like five or something.
What I can see though is that these three are pretty good vertical slices. There is some groundwork that's being done here. There's some stuff that's kind of being included in this PR that probably could be elsewhere. So there's indexes, the seed rewrite, and the dead parameter prefactor.
Prefactor by the way if you've never heard of this - this is just a refactor before you do some work.
This will burn a lot of tokens because we're just like plowing in a bunch of seed data, and so just like lots of output tokens will be produced during this. And so I guess it makes sense to have it before we do any of the other vertical slices.
But the other ones, because they're now grouping a ton of work together, they are by definition vertical because they're like building out throughout an entire feature.
So let's see if it retains the vertical slices when we go to five:
Could we have five tickets instead of three?
Five tickets: the sweet spot
Okay, so the groundwork is looking the same here and then it starts then with a page shell. That's a good classic vertical slice. I really like that.
It then goes on and adds some extra overview panels, then the course detail selector, progress and drop-off funnel and course detail extras. Okay.
It's even explicitly saying here:
Every ticket lands as something you can look at
Claude's message stating every ticket lands as something you can look at
Blocking relationships and parallel work
It also, by the way, does this clever thing where it has blocking relationships here.
So technically we can do these in parallel if we wanted to. For instance, in the overview panels, like two, we've got the page shell, and then three is blocked by two and four is blocked by two.
So this means we could work on one and two and then split up to do three and four in separate context windows if we wanted to.
Dependency graph showing tickets 3 and 4 both blocked by ticket 2
That's entirely optional, you don't have to do that, but it is a little bit quicker if you can make that work. And this means that we can scale this skill up to actually fanning out, producing multiple pieces of work and merging them back together.
So, okay, I'm pretty happy with this. Let's publish them to the tracker.
The published tickets
Okie doke, here we go. We have our Instructor Analytics Dashboard and it now has five sub-issues underneath it.
GitHub issues page showing the parent issue #4 with five sub-issues
So we've got our spec and we have the first one that's unblocked, which is the groundwork.
We get an explicit link to the parent, and then we get what to build and the acceptance criteria.
Notice this ticket is pretty light here because we have the parent spec to rely on. All we're doing is really specifying which bit of the spec we're building now.
Ticket #5 showing parent link and acceptance criteria
And having this explicit acceptance criteria is really nice for giving it a point where it can stop.
Review the tickets lightly
What I recommend you do is read through some of these. Again, I don't recommend actually reviewing each of these because they're just summaries of the things that we've decided already.
These tickets are relatively light, they're just splitting up the spec so that we can go and work on it.
Share your experience
I would love to hear from you how your experience went.
- Did you create the same number of tickets as I did?
- Did you spot vertical slices?
- Did you get any weird horizontal slicing stuff?
Do ping in the Discord to join the conversation.
So we have our set of tickets. Nice work, and I will see you in the next one.
Executing Your Tickets
/implement, /tdd and /code-review skills added
We've got our spec and tickets. Now we need to actually implement them.
There are three skills that handle this: /implement, /tdd, and /code-review. They work together to build features, write tests first, and review the work before committing.
Let's look at how they fit together.
The /implement skill file open in the editor
The /implement Skill
The /implement skill is the orchestrator. It delegates most of its work to the other two skills.
Here's what it does:
- Implement the work described in the spec or tickets
- Use
/tddwhere possible, at pre-agreed seams - Run typechecking regularly, single test files regularly, full test suite once at the end
- Once done, use
/code-reviewto review the work - Commit your work to the current branch
It's very simple. The real work happens in /tdd and /code-review.
The /tdd skill file showing the TDD workflow
The /tdd Skill
The /tdd skill is where the quality comes from. Agents do their best work when they have the most feedback, and TDD is a great technique for that.
You write the unit test for the feature first, then implement it. The test gives the agent immediate feedback on whether the implementation is correct.
The skill includes:
- What a good test is - tests verify behavior through public interfaces, not implementation details
- Advice on mocking and tests
- What seams are - the public boundary you test at
- What bad tests are - implementation-coupled, tautological, or horizontal slicing
- Rules of the loop - red before green, one slice at a time, refactoring belongs in review
Test Only at Pre-Agreed Seams
A seam is the public boundary you test at. Tests live at seams, never against internals.
Before writing any test, you write down the seams under test and confirm them with the user. No test is written at an unconfirmed seam.
This keeps testing effort on the critical paths and complex logic instead of every edge case.
Tautological Tests
One anti-pattern worth calling out: tautological tests. These are tests where the assertion recomputes the expected value the way the code does.
For example: expect(add(a, b)).toBe(a + b). The test passes by construction and can never disagree with the code.
Expected values must come from an independent source of truth - a known-good literal, a worked example, the spec.
The /code-review skill file open in the editor
The /code-review Skill
The /code-review skill does a two-axis review of the diff between HEAD and a fixed point you supply.
It runs two reviews in parallel sub-agents:
- Standards - does the code conform to this repo's documented coding standards?
- Spec - does the code faithfully implement the originating issue / PRD / spec?
Why Two Axes
A change can pass one axis and fail the other:
- Code that follows every standard but implements the wrong thing - Standards pass, Spec fail
- Code that does exactly what the issue asked but breaks the project's conventions - Spec pass, Standards fail
Reporting them separately stops one axis from masking the other.
The Standards Sub-Agent
The Standards sub-agent gets:
- The full diff command and commit list
- The list of standards-source files found in the repo
- A smell baseline from Refactoring - Mysterious Name, Duplicated Code, Feature Envy, Data Clumps, and others
It reports every place the diff violates a documented standard, and any baseline smell it spots. Documented-standard breaches can be hard violations, but baseline smells are always judgement calls.
The Spec Sub-Agent
The Spec sub-agent gets:
- The diff command and commit list
- The path or fetched contents of the spec
It reports:
- Requirements the spec asked for that are missing or partial
- Behavior in the diff that wasn't asked for (scope creep)
- Requirements that look implemented but where the implementation looks wrong
This second pass massively increases the quality of the output. It often goes and fixes the really bad stuff itself.
GitHub issue showing the spec and its sub-issues
Context Management
There's a debate: do you review after all tickets are complete, or review individual tickets against the spec?
For this lesson, we're going to review each individual ticket. But sometimes you'll just do it right at the end.
Clearing vs. Compacting
Once you finish the planning phase, you need to decide: clear or compact?
The spec and tickets stay outside of context. They're in documents, so the conversation history is now disposable. It's just a more verbose version of the documents you already have.
If you compact, the next session might not have to do so much exploration because it should already have the right context for it.
However, it's just cheaper and faster to clear. That way you're going to start your new session with the maximum of the smart zone.
For this lesson, we're at ~90k tokens after planning. The planning context is now disposable because it's been encoded into the spec and the tickets. So we're going to clear it.
Context meter showing 90k tokens used
Steps To Complete
Set Up the Skills
- Run
npm run resetto reset to theimplement-skilllesson commit
This adds the /implement, /tdd, and /code-review skills to your .agents/skills directory.
- Open
.agents/skills/implement/SKILL.mdand review it
Notice how simple it is. It delegates to /tdd and /code-review.
- Open
.agents/skills/tdd/SKILL.mdand review the TDD workflow
Pay attention to:
- The "What a good test is" section
- The "Seams - where tests go" section
- The anti-patterns: implementation-coupled, tautological, horizontal slicing
- The rules of the loop: red before green, one slice at a time
- Open
.agents/skills/code-review/SKILL.mdand review the two-axis review
Notice how it runs two sub-agents in parallel - one for Standards, one for Spec.
Implement the First Ticket
- Open your spec issue on GitHub and scroll to the first sub-issue
The first sub-issue should be unblocked and ready to start.
- Copy the link to the first sub-issue
Right-click the issue link and copy the URL.
- In your agent, run
/implementwith the issue URL as the argument
/implement <issue-url>
This will kick off the implementation. The agent will:
- Use
/tddto write tests first, then implement the feature - Run typechecking and tests regularly
- Use
/code-reviewto review the work - Commit the work to the current branch
- Watch the agent work through the implementation
You'll see it:
- Propose test seams and confirm them with you
- Write failing tests (red)
- Implement the feature (green)
- Run
/code-reviewto catch issues - Fix any issues the review found
- Commit the work
Review and Close the Ticket
- Review the code review output
The agent will show you both the Standards review and the Spec review. Check that:
- No documented standards were violated
- No baseline smells were introduced
- All requirements from the spec were implemented
- No scope creep snuck in
- Close the first sub-issue on GitHub
This is good hygiene. Once you close the first one, the second one will be unblocked.
You can do this manually, or get your agent to do it for you.
Decide: Clear, Compact, or Continue
- Check your context window usage in your agent
Look at the token count in the status line.
- Decide whether to clear, compact, or continue
If you're at ~90k tokens or higher, consider clearing. The spec and tickets are outside of context, so the conversation history is now disposable.
If you're under that, you might be able to continue to the next ticket.
- If you decide to clear, clear the context and start a fresh session for the next ticket
If you decide to compact, the next session might not have to do so much exploration.
If you decide to continue, move on to the next ticket immediately.
Implement the Remaining Tickets
- Repeat the process for each remaining sub-issue
For each ticket:
- Copy the issue URL
- Run
/implement <url> - Watch the agent work
- Review the code review output
- Close the ticket
- Decide whether to clear, compact, or continue
QA the Implementation
- Once all tickets are complete, run the app locally
Start your dev server and navigate to the analytics dashboard.
- Verify all features work as specified
Check that each feature from the spec is present and working correctly.
- Check for errors in the console
Open your browser's developer console and verify no errors appear.
- Verify the UI looks correct
Ensure the analytics dashboard displays properly and matches the design.
- Verify the analytics dashboard shows the expected data
Check that the data displayed makes sense and matches what you'd expect from the seed data.
Executing Your Tickets Solution
/implement, /tdd and /code-review skills added
Alright, let's do it. Let's send off /implement with just the first issue.
Run 1 - The groundwork ticket
Claude Code exploring the codebase after reading issue #5
We can see it's read the issue. It's now exploring the code base. And it's not using a sub-agent for this, interestingly. It's just going straight ahead.
And then bam, we are in with the first update. So it's updating includeQuizzes. It is doing the stuff described in the first issue it looks like.
Auto Mode
One thing, by the way, that's really very important for these situations is Auto Mode, which is the ability to just run it and have a classifier just checking the permission requests.
So I can probably leave this for a bit and come back and the implementation for the first phase should be finished as well as hopefully the review.
This is a Claude Code-only feature, though I'm fairly sure that other harnesses also will implement their own version of Auto Mode.
The seed script
Terminal output showing the seed script creating database entries
It's gone through and added a bunch of stuff to the seed script. It's also run a database migration. It looks like it's done all of that according to the stuff that's in the local skill too, which is nice.
Token counter showing 95k tokens used
Now up to 95k, still going on this seed script.
It looks like running the seed script itself produced some errors. Here we go. No seeded students with that email.
And so now it's going ahead and fixing them, which is nice.
Verification loops
These kind of verification loops can absolutely eat tokens, which is part of the reason why we're so careful with making sure the tasks are the right size.
If it hits any trouble with the implementation or it's something isn't behaving how it wants, then it can burn tokens trying to get where it needs to.
It's now doing some final verification. So it is doing the tests and the type checking. And now it's gone over to run the code review.
The review process
Code review skill being invoked with two sub-agents
A code review is a model-invokable skill, so it's able to just chain them together without asking you. And we can see it's initialized two agents here. So it's initialized the standards review and the spec review.
Both of these are going to come back with a report that we can then take a look at to see if we want to change anything about the way it was implemented.
This is really great because we basically reset our smart zones. So with the sub-agents, because they're working in their own smart zone, we don't need to worry about the fact they're going to be made dumb by this $113k token context window that we've got.
These two agents have now finished the standards review and the spec review and it has had four things come back and it's immediately gone and fixed them.
List of four findings from the code review
It looks like it found some duplicated code, it looked at some inaccurate percentages in a comment, there's some remaining hard-coded intermediate logs, and a misleading variable name.
So I didn't have to confirm that, it just went ahead and made those updates.
And if we zoom down to the bottom and zoom out a touch as well, then we end up with about 125k tokens used and it's got a summary of what landed.
Deciding how to continue
So at this point, we need to decide how to continue. We could potentially do QA on this commit and on this issue right now, but I think I want to save my QA until right at the end.
So what I'm going to do is I'm going to open up this issue and as I'm going to immediately close it, which should then open up this issue to be worked on. So now it's number six.
I'm going to copy the link address and then we're going to implement this issue next.
Clearing the context
The next question is what do we do with our context window? It's currently at 125k. I would usually just straight up clear this context window.
The reason for that is that we have a really rich amount of context outside of the context window. We have the spec. We have the next ticket. We even have the previous ticket if it wanted to look at the intention of what was supposed to be done. And we have the commit in the commit history that it can read to see what was done.
So I'm feeling pretty positive that we can just clear the context and, you know, instantly done and we're able to implement the next issue.
Run 2 - The page shell
Issue #6 being fetched by the agent
So let's crack this off and let's see what it does.
There we go, issue six depends on five, which the latest commit appears to have landed. And it's now going to re-explore the code base structure.
This, by the way is where all of those navigation pointers that we've laid in pay off. Having a repo that's easy to explore means that it spends fewer tokens finding the information it needs which means that clearing is more possible which means you can move a bit faster.
Identifying the seams
Agent stating the seams under test
It's nice here that it says it's specifically saying the seams under test are X, Y and Y. No tests against route or component internals. All arithmetic and range resolution live behind that boundary. Very cool.
The red-green loop
Test-driven development loop in action
We can see that the red green loop is starting to kick off now so it's creating a minimal set of tests here in the analytics service. It creates a few more tests here and then it's going to once it's got the test harness in actually create the minimal implementation.
So now it's doing the green step here where it's actually creating the code and then the tests are going to go green. So we can see it ran the one shell command here if we look inside here then we can see that that individual test file is now passing.
This is a fast loop as well. This runs in under a second and it means that it can get very quick feedback on the code that it's working on.
It looks like its implementation is mostly done. 106k tokens, pretty good. And now we're into code review. So standards and spec review again.
Reviewing the changes
VS Code source control showing changed files
In VS Code, we can look through the changed files by just looking at the source control tab here. And there's a bunch of stuff in here. We've got tests for the analytics service, tests for the analytics themselves.
It looks like some, we've got some pure functions in here, functions that don't emit like strange effects or anything. So those are good candidates for tests.
And then we've also got tests around the service itself. So we got the analytics service and then the analyticsService.test.ts that tests all of that stuff. And this test file is fairly large, about 400 lines.
One cool thing about the review is not only is it reviewing the code, it's also reviewing the tests that test the code. So it's going to test or check for edge cases that you haven't considered, things in the spec that should be tested that aren't being tested.
Working while the agent cooks
By the way, while these long implementation sessions are happening, I'm usually off planning something else and kind of trying to make myself useful somewhere else in the code base, perhaps on a different branch or in a different work tree.
There's no real reason to sit around while the agent cooks here. You know, this is currently five, six minutes. And what the cool thing about this loop is that it's really minimal input from you. You just say, okay, do the next one now.
The tautological test
Okay, it found some findings here. So it looks like it needs to delete some tests, I think. Ah, here we go. This is a classic tautological test.
Code showing a test that just checks a constant equals itself
It's literally just testing that a constant here called platformFeeRate is this value. Well, that's just configuration. You don't need to test that.
it("takes a fifth of gross as the platform fee", () => {
expect(PLATFORM_FEE_RATE).toBe(0.2);
});
Looks like there were a fair few fixes, and it looks like this context window is just under the smart zone, so done a pretty good job nailing these estimates.
Verification methods
It's doing some more verification and it looks like it's trying to run the actual live page. Having a look at it and trying to find the stuff in the UI on the page, which is an interesting verification process.
The feedback loops that your agent uses to get information are super important and so designing your code base so that you can produce better feedback loops and get the agent better output is so so important.
We're doing a pretty good job with our type checking and our tests because type checking is sort of checking the correctness of the code, tests is checking how it performs at runtime.
But we don't really have a way for it to verify a running application. For that, you could use something like the Chrome DevTools MCP server or similar. It can take photos of things. There's even agent-browser as well. That's a good one.
Judgement calls
Okay, so it looks like we're up to 137k tokens, very nice. We've got 401 tests, so 32 new tests, and we've got some judgment calls to make too.
There's a kind of scoping error here. So it says that the course detail tab has real content. It looks like it actually went ahead and implemented something it wasn't supposed to but that's it says it's fine because it's easy to strip back.
It went ahead and adjusted something to basically add a gross and net instead of just gross. I mean, that's fine, I suppose.
Mostly, we don't have to worry about these too much. I'm going to do a final QA when everything lands.
Run 3 - Compacting vs clearing
Just for variety let's actually run compact this time instead of clear. I'm going to run compact to run the next phase here and this is going to compact the conversation and we'll see if this makes any difference in terms of how much exploration it does.
Copying the link address for issue #7
I'm going to close the next issue here, number six, close it like that, and then the next two are open here. So I'll grab this one by copying the link address.
Now I can go back into my conversation, I can say implement and then implement this ticket. And this will then be queued up for when the compaction ends.
The cost of compacting
To tell you the truth, I mostly use just clear after each conversation, so I'm intrigued to see if compact speeds things up a little bit, gives it a little bit more context, or whether it's just not needed.
It's certainly slower, of course. We are paying in output tokens to produce a summary of the previous conversation. I sort of wish it showed you exactly how many output tokens it was spending because it has to be a fair chunk.
Compacted summary showing restored files
We can see it's compacted and it kept some tests here, which I assume are needed for the next... It's kept quite a few files. It's restored the skill code review, so I understand we might need that too.
It's fetched the issue and it's still just continuing to explore. So it's doing, obviously it still needs to explore more than what it has. And I suppose the question is, is the compacted summary actually relevant to what it's doing? Not sure.
It is absolutely roasting here, so I've taken off my flannel shirt. Apologies.
The hard violation
Code review showing hard violation found by both axes
We now have another implementation complete, the review has been completed, both axes independently flagged the same hard violation, question count filters rows in the route. That sounds like instead of filtering on the server, they were piling them all into the client and it was doing client-side filtering. That's really bad.
The reason it's bad is that lots of material is traveling over the network just to be filtered away in the browser. That's super wasteful.
All right, this was a long one. This was 17 minutes 30 to build that ticket. We reached 140K tokens.
The spec axis caught a real gap, never enrolled was suppressed for team buyers.
You notice how far the implementation agent can actually deviate from the spec. And so having a review step does a pretty good job in catching those.
Back to clearing
So let's now close number seven. Let's now head to eight, copy the link address and plug it in.
I don't think compacting really gave us anything, so I'm just going to clear, it's much faster, it's much cheaper, and we're just going to say implement eight.
The rule of thumb is if you have a if it's 50/50 between clear and compact then you should choose clear because it's cheaper and faster.
Run 4 - The drop-off funnel
We're at the spec review for this chunk of work and we're at 77.5k tokens. Geez, okay, it's doing a really thorough job here.
Okay, it looks like it's committed again. We get another implemented, reviewed and committed summary. We've got our service, we've got our routes, got our tests.
144k tokens. These are creeping up. I'm going to clear the context.
I'm going to close the issue that we just did here, open up the final one, which is now unblocked, and let's go.
Planning for QA
Once this one is done, I think I will do a final QA and just give everything a good crack and see what came back.
We're at, ooh, 11.25 in video time, but this is more like, I don't know, this has been about an hour of filming, I think.
While this has been going, I've been answering emails, I've been doing other stuff and checking back in occasionally seeing how things are going.
Nailing the estimates
Okay, implementation is finished and looks like we've basically nailed it again. So it's 102.5k tokens, I mean, we've just smashed this.
I have to say it never ever goes this well in terms of how like task sizing. I sometimes have tasks that are so big, tickets that are so big that they go 300K tokens or something.
In those situations I mostly chalk it up as a learning experience and try to improve the skills so it catches those in future. Often they are something silly like a rename that accidentally touches way more that has a much bigger blast radius than I thought.
The benefit of large context windows
Sometimes you can catch them, and sometimes you just can't. And that is one benefit of a large context window, is even if you screw up, it's not like it's going to compact at a weird moment. It will just keep going, keep going. And that is expensive, but it does mean you can continue, at least.
And of course you can still continue even if it compacts at a weird moment, but I find that compacting at strange moments means that it loses context in funny ways and it just doesn't end up working quite as well.
The automated review
Alright, again, the reviews have found substantive findings. I'm really intrigued by that, by when we get the report at the end.
It's adding more test cases as well, which is interesting.
By the way, I think of this automated review as just like an essential part of the process. I don't think of the output and then the review. It's like these are coming from the same developer in my head, or at least the same agent in my head, which is the implementation work is not ready until it's been reviewed by another agent.
Run 5 - The final ticket
Final commit summary showing 132k tokens used
Okay, and we've got our final commit, clocking in at 132k tokens. So we've nailed it again.
So it has come back with a few judgment calls here and sometimes I will act on these judgment calls but for the purposes of this demo I'm not going to. I'm going to keep this fairly sparse. So I think though it's time to do some QA.
QA - Testing the implementation
Running npm run dev to test the application
I'm going to open up a new terminal here, I'm going to run npm run dev and let's take a look at this application.
So I'll go into the dev UI, I'm going to switch over to Priya Nair. This is a new instructor and we've got a bunch of new, whoa, loads of new students.
So the seed data must have been significantly altered here. I'm going to go into her dashboard. I'll go into the new analytics page.
Okay, usefully, Priya doesn't have any courses. Let's switch over to Marcus Johnson, who does.
Exploring the analytics
Analytics dashboard showing revenue and top buyers
Let's close that. We've got some tabs up here, so overview and then course detail. We've got revenue over time. We've got some top buyers as well.
If we zoom up to the tabs here then we have some course data and then we pick a course.
This is really nice and detailed, isn't it? I'm going to go all time here to see if this changes anything.
Course progress showing 23 of 23 reached, 1 lost inside
This data is actually really cool here. So we can see that 23 out of 23 reached, one lost inside. Slightly funny phrasing here, as though the student has been trapped within the course forever.
This is really cool analytics though, I would love to have this for my courses.
We've got some quiz results here, and we've got some revenue by country too.
This is looking really, really smart.
Admin view
What happens now if we go into the dev ui and look as an admin here? What can the admin see?
Admin view of the analytics dashboard
It looks like along with this we have now an admin page too. So it looks like in the course detail they can see everything. So an introduction to TypeScript.
They can see the drop-off here. If we look into overview, then we see the entire setup and they can filter down by instructors.
Overall assessment
Overall, this is working, you know, outrageously well, really, really nicely done.
There is some stuff I would prefer to QA, for instance. There's lots of visual bugs I don't like. I can see that the text here, the hierarchy doesn't look quite right to me.
This little piece of UI doesn't look quite right.
The importance of feedback loops
You can see though the stuff that the agent had a feedback loop for, such as the way things actually functioned and the way they worked, that seems to all be done really well.
So we can see that the analytics, I mean I haven't gone into the data to see if they're all correct, but they look plausible.
But the stuff it doesn't have a good feedback loop for, such as the user interface itself, is a little bit less refined.
Overall, I am pretty happy with this and I'm going to close the final ticket of the spec.
Wrap-up
And with that, I'm going to consider this monster recording complete.
So well done for hanging in there. I would love to understand the decisions that you made during this exercise too.
Key observations
Did you notice a difference between clearing and compacting? Did you find that the tickets that you'd created were properly vertically sliced?
I noticed that another reason this worked quite well is that the tickets were nicely vertically sliced and a lot of them just built on previous work.
This approach scales
This approach scales to really, really big tasks. I've had specs that contain 30 tickets underneath them and they take a while to complete, but the amount of work you can pile through using this is incredible.
Especially because you've got the reviewer in there reviewing every commit before it lands.
So, well done, nice work, and I'll see you in the next one.
Should You Keep Your Specs?
One question I get all the time is: what should I do with my specs once I've completed them? Once they exist in the code, what should I do with them?
GitHub issue #4 showing the Instructor Analytics Dashboard spec with its detailed user stories and implementation decisions
This spec is like a pretty nice representation of how the code actually works and looks. It's just written in plain text that the user can understand and that the agent could understand.
It feels like there's some value in keeping them around, surely, as maybe documentation for how the code works, or even just a historical record.
The Shocking Answer
Well, let me shock you. Now that this is represented in the code, I'm going to close the spec.
Matt closing issue #4 as completed on GitHub
Primary and Secondary Sources
We can think about specs and codebases as the primary and secondary source thing that we looked at before.
Whiteboard diagram showing Codebase labeled as Primary Source and Spec labeled as Secondary Source
A spec is really a condensed version of how a codebase works or even just a part of a codebase works.
And of course, the issue with a secondary source is it's only a projection. It's a summary of how the thing actually works.
The Drift Problem
And the worst part is the codebase can very quickly move away from the spec.
In other words, if you're not constantly keeping the spec up to date with the codebase, they are going to drift apart.
Why Not Spec-Driven Development?
There's a very popular approach called spec-driven development. One of the ways you can do spec-driven development is you take these specs, save them in the repo, and they become the source of truth instead of the code.
However, it's this exact drift risk that makes me terrified of that approach. If your agent is exploring your local repo and finding these old, ancient specs on how the code works, it's very likely to trust the out-of-date spec - the secondary source - instead of the primary source.
The secondary source is often easier to explore, smaller, denser. So it's unlikely to go and actually touch the primary source, which is more verbose and harder to explore, if it's seen that.
The Code Doesn't Lie
The issue is, of course, that the codebase doesn't lie about itself. If you look at the executable parts of the codebase - the functions themselves - they are unlikely to lie about what the code actually does.
This is assuming you don't have weird, stale parts of your codebase, like:
- Functions that are no longer called
- A part of the system that's kept there for legacy purposes
- Throwaway prototypes in the repo
Archive, Don't Delete
All this to say: get rid of your specs as soon as they are put into code.
GitHub issues list showing closed issue #4 alongside its five child tickets, all marked as completed
I really like this issues approach because you can close an issue, it gets moved out of the way of the main views, and it's kind of archived, specifically marked as archived. But if the agent needs to come back to it to have a look at how something was implemented or why something was implemented, then the spec is there for it to explore.
Why GitHub Issues Work
Not only that, but your team can see them. If your spec is local markdown on your laptop, then it's just yours. Whereas a spec in the tracker is the team's. It's reviewable, commentable, and findable by someone who was not in the room.
Not only that, but if you keep these tickets out of the local setup, it means that they're durable if you're switching worktrees, if you're switching laptops. The state is not colliding with your local setup.
The Verdict
So that is my message to you: archive your specs.
Closing title card reading 'Archive Your Specs' with subtitle about specs being temporary artifacts
Your specs are meant to be temporary artifacts that define a piece of work. They are not the source of truth for how the code works.
I'm very happy to debate you in Discord if you feel otherwise. There are lots of frameworks who say persist your specs, use them as a source of truth. I have found that doesn't work very well.
So hopefully that makes sense for what you should do with your specs once you've finished a multi-session piece of work.
Nice work, and I will see you in the next one.
The last ticket under your spec is merged and the work is live. What do you do with the spec?
- Close it in the tracker, so it is archived but still findable
- Commit it into the repo as documentation of how the code works
- Delete it outright, so nothing stale can ever be read again
- Keep it open and update it each time the code changes underneath
Why is an old spec sitting in the repo risky once the code has moved on?
- It is a secondary source, and the agent trusts it over the code itself
- It is verbose, so reading it burns a large share of the window
- It conflicts with the tickets, and the agent cannot resolve that
- It is local to your laptop, so nobody on the team can read it
Rerouting: When The Destination Changes
Imagine a situation where you have a spec and you've put together some tickets for it. Halfway through, maybe you're reviewing the tickets as they come in, and you realize: oh dear, this is just the wrong approach.
What do we do when we get two tickets in and we realize we need to change things?
Tickets Are Disposable
The thing you need to consider here is that these tickets are disposable.
If we realize that this set of tickets - maybe we've implemented the first two, but the second two we haven't implemented - we can just delete the tickets that we haven't implemented.
Whiteboard showing 'Tickets - Disposable' and 'Spec - Editable' badges
Then we can go back to the spec, and the spec is editable.
So we can maybe have a grilling session about where we are right now. We've had two tickets and we're not happy with the way they're coming out, so we need to go back to the spec to edit it.
The Spec Is The Destination
In other words, the spec is the destination and we are changing the destination.
What I would do is go back to the spec, have a new grilling session, and then once I'm happy with my edits to the spec, I would create a new set of tickets.
This new set of tickets might change the scope of the work a little bit, so we end up with maybe just a bit more that we're doing. But it means that we've found the journey to our new destination from where we are.
Whiteboard showing six ticket boxes with the spec bar extended underneath
The Flow
The whole flow looks like this:
1. "Oh no, this needs to change"
Realize that you want to change the destination. This is not turning out how you wanted.
2. Close the tickets
Delete any existing tickets that haven't yet been implemented. But you keep the spec because you want to modify the spec.
3. Modify the spec
Use /grill-me to adjust the spec, describing what you want changed. Probably in a new session.
4. Regenerate the tickets
Once you're happy with the spec, regenerate the tickets based on where you are. You use /to-tickets to regenerate the new tickets.
So you don't throw away your work, probably, unless it's really, really bad. And then you continue implementing from that point.
5. Continue implementing
Use /implement to implement the new tickets.
Five-step recipe diagram on the whiteboard
This is a nice simple recipe for what you need to do if you need to change direction mid-flow.
Why Two Documents?
I wanted to add a little video on this because people always ask me this, and it's a relatively simple procedure.
This is also why we have this two-document design: so that you can have the spec as the destination and the tickets are totally disposable.
If they were all part of the same document, then it would get a little bit confusing.
Two tickets in, you review the work and realise the whole approach is wrong. What do you do first?
- Delete the tickets you have not implemented yet, and keep the spec
- Revert the two tickets you shipped and start the spec from scratch
- Close the spec and write a fresh spec beside the existing tickets
- Finish the remaining tickets, then fix the direction in the review
Why do the destination and the plan live in two separate documents rather than one?
- So the destination can be edited while the journey is thrown away
- So neither document ever grows too large for one context window
- So you own one document and the agent owns the other one entirely
- So the destination can be reviewed before any plan has been written
The Goal Command
One of the things people ask me a lot is: why don't we use /goal to implement our specs?
The /goal Theory
The theory here is we would create a spec, and then we would use /goal, which is a feature of many harnesses where the agent pursues a goal in a single context window until that goal is complete.
The goal would be the destination, which is a very, very well-specified destination, and it seems like a great use case for /goal.
Diagram showing spec definition at top with /goal definition below
The Problem: The Dumb Zone
However, all of the implementations of /goal that I've seen don't really take advantage of the smart zone. It's all done in a single context window, relying on auto-compaction to manage it.
And so what you end up with is a little bit of smart zone at the start, and then a whole lot of dumb zone.
Every time I've tried this, I see the same setup. So I still believe that the spec-and-tickets approach is better than the spec-and-/goal approach.
The Caveat: If Auto-Compaction Improves
However, if auto-compaction ever got good enough that the dumb zone would not be an issue, then I would consider this to be a really nice setup.
You're still doing all of the work to kind of think about the spec. It's just that the thing you're handing it over to now is in charge of:
- Its own context management
- Its own ticket management
- Understanding all of the tasks that need to be done
And you can still do one large code review at the end to check for spec compliance.
My Current Recommendation: Use Tickets
But so far my current recommendation is to use tickets instead.
Diagram showing four equal-width rectangles each containing green 'Smart', with shorter duration bar underneath
Why Tickets Give You More Control
Tickets just give you a lot more control. They, I think, are often cheaper to use because you're doing most of your work in a lot of smart zones.
Creating tickets from the spec is often a really, really short job. It usually just takes me a couple of minutes.
On some of my workflows, which we're not really discussing in the course, I even generate tickets AFK, so I don't even review them.
Comparison: Spec-and-Tickets vs Spec-and-/goal
| Approach | Context Management | Cost | Zone Quality |
|---|---|---|---|
| Spec-and-Tickets | Multiple smart zones | Often cheaper | Mostly smart |
Spec-and-/goal | Single context window | Potentially more expensive | Small smart zone, large dumb zone |
I think right now this feels a lot more robust than just using /goal.
Your Experience May Vary
I would love to know, of course, if you have had different results from me, if you trust your auto-compaction more than I do, and /goal definitely seems like a good idea if it can work.
Nice work and I will see you in the next one.
Your harness offers a command that pursues a goal in a single context window until it is complete. You have a well-specified spec. Why still split it into tickets?
- One window gives a small smart zone and then a lot of dumb zone
- A spec is too vague to serve as a goal for the agent to pursue
- You get no chance to review the work against the spec at the end
- Making tickets from a spec is slow, and a goal skips that step
What would have to improve before pursuing a goal in one window became a good setup?
- Auto-compaction, enough that the dumb zone stopped being an issue
- Context windows, enough to hold a whole project's work at once
- Token prices, enough to make one very long run the cheap option
- Code review, enough to run inside the same window as the work
Enforcing Your Coding Standards
CODING_STANDARDS.md added to the repo
There is a line inside the /implement skill that is easy to gloss over:
Once done, use /code-review to review the work.
It is worth stopping on. Code review is where you get to impose your own coding standards on the agent.
The /implement skill showing the code review line
Three Levels Of Checks
There are really three levels of checks you want running on your code before you ship it.
| Level | What it catches | What it costs |
|---|---|---|
| Automated checks | Mechanical failures | Nothing |
| Automated review | Judgement-shaped problems | Tokens |
| Human review | Everything else | Your attention |
Automated Checks
Automated checks are linting, typecheck, and unit tests. They matter because they are deterministic. The agent can run them and always get back the same pass or fail.
They also cost you no tokens to run. They are essentially free. If everything could be done in automated checks, we would live in a dream world.
But you cannot catch every bug in an automated check. A test suite proves only the properties you asserted. So you need some kind of reviewing system on top.
Human Review
Before AI, that reviewing system was a human. Someone looked at the pull request and said: that does not look right. That test is not doing what we think it is doing. Have you considered this approach?
In other words, the human was providing qualitative feedback. Saying, I am not sure about this.
And human review was always everyone's least favourite part of development. You would always have a stack of pull requests you needed to review, and it was painful.
Stack of pull requests waiting for review
Automated Review
Now agents can help. Automated review means the agent reviews your work and provides the qualitative feedback itself.
Crucially, this does not replace human review. It makes human review easier, because the agent has already walked through the diff and done a first pass. Automated review catches more than you would catch without it. You still want a human doing a sanity check on top for most types of work.
That is what the code review skill is doing. You implement in one context window, then you review in a fresh one.
The Two Axes
The review runs along two axes. The Spec axis asks whether the code faithfully implements what was asked for:
- **Spec** — does the code faithfully implement the originating issue / PRD / spec?
The other axis is standards. Coding standards matter because you do not want your agent making the same mistake again and again and again. Those steering instructions have to live somewhere.
Slotting them into CLAUDE.md is painful, and it has real downsides. Code review is an interesting case, though, because the skill lets you customise it. You create your own CODING_STANDARDS.md file.
CODING_STANDARDS.md
The file just sits there and captures the coding standards for the repo. When you notice the agent doing something weird, you put it in the standards file, and the review catches it next time.
A brand new one can be a single line:
Don't do stupid stuff.
The skill finds it during its third step, when it works out where this repo documents how code should be written:
Anything in the repo that documents how code should be written, such as `CODING_STANDARDS.md` or `CONTRIBUTING.md`.
That step is the seam you are writing into.
Why Standards Belong In Review
The reason this makes sense is that code review is a lot less constrained than implementation is.
When you implement something, you have to explore where it fits in the codebase, write all the files, and then debug it to see whether it actually works. Three demands, all in one context window.
Code review has none of them. You do not need the exploration, because the exploration has already been done and you are handed the right file straight away. You do not need to make many changes, because you are reading what is there. And you carry no burden for testing that everything works, because the tests have been written and run already.
/implement | Code review | |
|---|---|---|
| Explore the codebase | Yes | No |
| Write the files | Yes | No |
| Debug and test | Yes | No |
So it makes much more sense to load the coding standards into code review than to try to make the implementer get it right first time. The review agent has a lot more space in its context window, and far fewer demands on it.
Comparison of demands on the implementer vs the code review agent
What A Real Standards File Looks Like
A mature standards file is loose, and that is fine. Every line in one arrives the same way: you noticed the agent do something stupid, and you wrote it down.
A real CODING_STANDARDS.md file from the course video manager repo
Context menu items should always include a leading icon (from `lucide-react`), matching the style of the surrounding items. When adding a new menu item, pick an icon that conveys the action.
That one exists because, for some reason, the agent just was not adding icons.
All files in `./app/routes` will be exposed publicly as routes. Do not include test files or utility files there.
You could break a file like this down and put parts of it behind context pointers. If a rule only makes sense for front-end work, that is where it belongs. But since the standards file is only ever loaded during code review, its size matters much less than it would in an always-on steering file. It is fine for it to get quite large.
The Baseline You Get For Free
Even with no standards file at all, the Standards axis still carries a set of code smells drawn from Martin Fowler's Refactoring:
Code smells from Martin Fowler's Refactoring book listed in the skill
- **Feature Envy** — a method that reaches into another object's data more than its own. → move the method onto the data it envies.
Shotgun Surgery. Divergent Change. Mysterious Name. These are classic coding terms, so agents already know all about them. The review will often find something even when you have documented nothing.
Your own file sits on top of that baseline and overrides it. Where your repo endorses something the baseline would flag, the flag goes away.
Don't Shout At The Agent
Here is the habit worth building. Next time you finish an implementation and notice something you do not like, do not shout at the agent.
Write it into CODING_STANDARDS.md instead, so the reviewer catches it.
Nice work, and I will see you in the next one.
You keep noticing the agent write code that breaks one of your repo conventions. Where do you write the rule down?
- In CODING_STANDARDS.md, so the review catches it
- In CLAUDE.md, so the implementer reads it every time
- In the prompt, restated for each piece of work
- Nowhere, because the linter should catch it
What separates an automated check from an automated review?
- A check is deterministic and free; a review is qualitative and costs tokens
- A check runs faster, but they catch the same class of problem
- A check runs before the commit; a review runs after it
- A check is run by tooling; a review is only ever run by a human
You run the code review skill in a repo with no CODING_STANDARDS.md. What does the Standards axis have to work with?
- A built-in set of code smells drawn from Refactoring
- Nothing, so the Standards axis reports no findings
- Whatever happens to be in CLAUDE.md at the time
- Conventions it infers by reading the whole codebase first
Ask Matt
/ask-matt skill added
You are going to finish this course with questions. That is normal. The problem is what you do in the gap between having the question and getting an answer.
You can always ask me in Discord. I am happy to answer, and so is the rest of the community. But while you are waiting for a reply, there is something you can try.
There is a tool for asking my advice without me being in the room.
Reset To The Skill
Open a terminal and reset to the lesson that adds the skill.
npm run reset add-ask-matt-skill
That commit drops an /ask-matt skill into the repo. Reset your current branch onto it, open your agent, and you can ask Matt.
Ask It A Real Question
The skill takes a situation, not a keyword. Here is the one I put to it.
/ask-matt What's the best flow for fixing a bug once I've finished doing an implementation on a spec and all the tickets are closed?
That is a real position to be in. The spec is built. Every ticket is closed. Then something turns out to be broken. There is no obvious next command to type, because the flow you were following has run out.
What It Answered
The router opened with this.
**Short answer: `/clear`, then `/diagnosing-bugs`.**
Two moves. First empty the context, because the spec thread is spent and a bug is a new starting point rather than a continuation of the build. Then reach for the skill that handles bugs.
It went further than the headline. It said to check whether you can make the bug go red with one command: if you can, and the cause is obvious, write the failing test and fix it. If you cannot, that is when the diagnosis skill earns its place. It also named two things not to do. Do not triage the bug, because triage is only for issues you did not create. Do not reopen the closed spec, because a spec that turns out to be wrong is a new idea, not a patch.
It Knows Skills The Course Does Not Cover
The skill it recommended is one we have not encountered. It does exist in my real skillset.
That is the point. This course covers the main flow and a fair few very important skills, but it does not cover everything in the skillset. There is still stuff to learn, and /ask-matt is the way you learn it. It is listed under Getting Started, and it is a good way to get up to speed with the rest of the skills.
A flow is a path through the skills, not a single skill. Most work travels along one main flow. A couple of on-ramps merge onto it. The rest are standalone, or a vocabulary layer running underneath. When you name your situation, the router puts you on a flow at the right step, which is often a different answer from the skill whose name matches your words.
The Phase Boundary Checklist
One particularly useful thing lives inside the skill itself: a phase boundary checklist.
A phase is a chunk of work inside a session: the grilling, the implementation, the QA. The boundary is the gap between two of them, and it is where you decide what happens to your context window. That decision is genuinely hard. You have five options and no obvious way to pick.
| Option | What it does |
|---|---|
| Continue | Stay in the session. No context switch at all. |
| Clear | Empty the context window and start from nothing. |
| Handoff | Write a portable markdown file and seed a session anywhere with it. |
| Subagent | Send the task to its own context window and get a report back. |
| Compact | Compress this context and seed a fresh session with the summary. |
So when you are not sure whether to continue, clear, hand off, send it to a subagent, or compact, the skill can walk you through it. It works the options top to bottom and the first yes wins, which turns a vague feeling into an ordered set of questions.
Take Its Answers With A Pinch Of Salt
Look back at the answer it gave me. It said to clear. I would say the best thing there is probably to compact instead, because some of that implementation context is worth carrying into the bug hunt. And to be honest, you might not need the /diagnosing-bugs skill at all. That skill is only for very, very tricky bugs. If it is a simple bug, you might just be able to sort it yourself.
So treat it like any agent. It is a router, not an oracle. It is a nice way to ask questions about the skills and figure out what you might want to use next, and you still apply your own judgement to what comes back.
If you notice it giving any weird answers, raise an issue on the skills repo itself. That is how the router gets better.
People have found this useful for getting to grips with the skills, as a first port of call for the things they do not quite understand yet.
Nice work, and I will see you in the next one.
What does the /ask-matt skill give you back?
- A recommendation of which flow and skill to use next
- A finished implementation of the change you described
- A spec written from the situation you described
- A list of every skill installed in the repo
The router tells you to clear and then run the /diagnosing-bugs skill. What should you do?
- Weigh it against your own read of the situation before you act
- Run both commands exactly as given, since the skill holds the full map
- Ignore it, because a router cannot see your codebase
- Ask it again until two runs agree on the same answer
Where You Go From Here
Hopefully this course has given you something solid that you can take immediately into your workplace.
The five-step process covered in this course is an essential part of how to build software:
- Grill the idea - align with the AI before you get going
- Create a spec - decide where you're going
- Create tickets - split things up to parallelize work, or to make sure you stay in the smart zone
- Implement - work through the tickets
- Review - check things that couldn't have been done during implementation
Even though things have changed over time, this process still fits into this format. And this core set of five steps is going to stick.
The five-step process overview
What To Do Next
Your next task, now that this course is finished, is to go and deepen these steps.
Consider the following areas to explore:
- AFK loops - instead of sitting there babysitting the implementation, delegate that to an AFK (away from keyboard) agent loop
- Prototyping and research - how might these help you during the initial ideation phase, before you approach a spec?
- The AI Coding Dictionary - firm up your mental model for all of this: model provider requests, turns and context windows, tools, and more
- Sandcastle - an open source attempt to do AFK agents inside isolated sandboxes
Sandcastle GitHub repository
Keep Learning
Check out Wayfinder, Prototype, and the other skills in development. AI coding will change, and the shape of this process will be iterated on, made more complex, and developed further.
Cohorts run on AI Hero are opportunities to deepen all of this work too, so keep your eyes peeled if you or your company are interested.
Join the Community
The Discord and the community inside it are going nowhere.
If you run into something in the real world that you find confusing, don't know how to adapt the agent to do, or if the course raised questions you need answering, come to the Discord. We'll have a good time figuring it out together.
Thank you so much for watching and joining. See you very soon.