Hi.
In this lesson, I want to show you and explain how to work with plan mode.
It's something new from windsurf.
So let's go.
Uh, the planning mode.
Uh, it can help you tackle some big, really complex tasks by breaking them into smaller, easy to
handle steps.
Instead of trying to describe everything in one long prompt, you can work with Cascade to plan the
process step by step.
This makes it easier to stay organized, track progress, and make sure each part of work is done correctly
before moving to the next part, which is really important.
Also, planning mode is is available on all paid plans and currently no extra cost.
So if you're using windsurf uh plan you won't be able to use it unfortunately.
Okay, let's now talk about when you can use the planning mode about the use cases.
So we can use it for multi-part changes.
It's like features that touch many files or systems.
You can use it for big code changes when you do some big refactoring or updating your project structure.
When you use when you're going to create some complex feature, like you need to work carefully and
have some coordination between different parts of your project, or when you're going to create a new
project.
And you need a clear plan to understand and change some unfamiliar code.
So this is all nice use cases for using the planning mode.
How planning mode works.
So you first you need to start.
You go.
You click the planning icon.
I will show you where to find it.
You describe just your goal and add any rules or requirements.
For example, I don't know what libraries you want to use, what you expect from AI, etc...
Then you get the plan cascade.
Create a markdown plan with goals for you with all the steps, challenges and some dependencies, and
it saves this file locally for the reference.
And then you execute it together with Cascade.
You ask Cascade to do some steps, update the plan if needed, track progress, and if at any moment
you can pause or resume the plan.
So let's now talk and quickly, um, I will explain you some benefits of structured approach.
Why you might need to use the plan mode, like what is the benefit for you?
It's better to keep the context the plan stay as a reference.
So cascade, always remember your goals, even for some long tasks where you have, you know, many,
many files.
It's less mental effort because breaking big tasks into smaller steps let you focus on scene at a time
so you don't think about the whole plan.
You think it's the same period of time we just focus on, like only one step.
It's more accurate.
A clear roadmap helps you avoid missing some requirements or making some mistakes.
And of course, it's easy to adjust.
You can update the plan as you go while still staying aligned with your main goal.
So now let's switch to the windsurf and I will show you there is an icon right here.
You can enable the plan mode.
Uh, okay.
As you see it's a better feature for now, but maybe when you will see this video it won't be better
anymore.
So when you click on it, um, just remember that if you use a free plan, you won't be able to use
this feature.
It's only for paid plans.
Okay, I prepared, uh, I prepared some.
prompt and I will explain what you are doing if you open the password strength class.
You see, it's really a big class.
It's fine.
But what I'm wondering that we have the check method, which contain really a lot of checks, and it's
difficult to maintain this method.
And I want to ask Cascade to split up this method on different methods for easier maintenance and testability.
So I will write my message.
So I just explain the goal what you need to do.
Just split the logic of check method from password strength checker class.
I clearly say about the context and what you need to do in the separate class methods for every check
update.
Also unit tests with new changes because we have unit tests, they also should be updated for the new
structure and double check all logic and unit tests test works.
Uh, for this go.
I will use a different model.
I will group it by provider.
And for example, we will use the cloud.
So.
Net four because I am on trial and I can and I can use the premium model.
And let's see what the result will be.
So I will have it a refactor.
Uh he's creating a plan.
You see it's updating.
You can view the plan.
Let's click view.
You see it's a plan MD file.
And you see some notes that user wants to split the logic, blah blah blah.
It's my request.
This task lists the first analyze the class and check method logic, then identify distance which can
be separated.
Okay, it's now updated.
So let's click view it again.
Uh yeah I can just updated that he did it.
So for the first two plants, and the next step is just to refactor movies.
Check into its own class method, separate step, the separate step for update unit tests, and separate
step for double check all the logic.
So if we scroll down we will see that he analyzes the files.
Then he updated the plan.
Okay, he say perfect.
Now I will refactor the password check.
Strange.
So he's doing everything step by step and we can review not everything at once, but for example every
step.
So I will just close the plan right now and we'll wait.
He will update it.
Okay.
We see he edited the password.
Strange.
So strange.
Check.
Okay.
We see the separate method for check.
Common patterns.
Check symbols?
Check numbers?
Check.
uppercase.
He also added a Jsdoc documentation, so it's really nice.
It's much more readable.
Okay.
Um, okay.
Let's see.
There is a check function still where, uh, what he did.
Uh, yeah.
Where he, he run individual checks.
Yeah, but it's still a lot of code.
So a of course, always can refactor it and, uh, and improve and improve it.
Okay.
He's finished.
Uh, what he did, he show what files was refactored.
Okay.
I split it up by six separate class methods.
He explains all the methods.
So you can click on the method and see every method.
When you click on it, you will scroll into the right position in your editor.
Then you update architecture a bit.
Uh, enhance unit test.
Added 15 new test cases.
So and all the test cases passing.
So if we open the test cases, we will see.
Okay.
Uh, yeah it did.
He splitted up by the sections like the just initialization then individual check methods separate uh
section for check lens method.
Some different use cases for check lowercase.
You see now we have much more test cases.
It's much better for our project and we can be sure it works.
Okay, I will accept all the changes.
Uh, as we if we open the plan, uh, you can also accept all the branches we see.
He marked everything as done.
And when we go we're back to our method.
Yeah, we see all the changes right there.
The old code was deleted.
It updated.
So now let's run the test command.
If you forget what the test command, you can always open package.json file and see the scripts right
here.
And run this command.
You can use npm run run test and we will double check how the test works.
And you see this is a summary of what test was run and how it works.
Okay I hope now you much more clear why you need to use the planning mode.
Uh, of course, if you have much bigger tasks, uh, so it will be more relevant because it's really
difficult to do everything at once and you have ability to review it step by step.
So and see you in the next lesson where I will explain you about the context.