Shadowing Practice: Claude Code: The Advanced Guide (99% of Devs Skip These Features) - Learn English Speaking with Video

Creando lección...
1
In this video, I'm going to show you nine advanced cloud code features that most people don't even know exist.
2
We're going to go through custom subagents, skills, hooks, MCP servers, parallel sessions with things like Git Work Trees, Headless Mode, and much more.
3
Now, every single one of these is going to come with a real demo, so you can see how you would actually use it.
4
And by the end of this video, you'll be able to set it all up in your own project.
5
Now, if you want the references in this video, I'll leave a link below.
6
You can join my school community.
7
It is completely free and I'll have everything here so you can follow along with a text-based guide.
8
With that said, let's get into it and look at the first feature.
9
So the first feature on my list here is custom subagents.
10
Now, most people know that Claude is capable of creating its own subagents.
11
That means you can give it a prompt, and automatically it can delegate to other agents or do things in parallel, right?
12
So it can have multiple agents running at the exact same time.
13
Now, Claude will do this automatically, and it can make its own agents without you doing anything.
14
However, you can also create your own custom sub-agents that Claude can then invoke.
15
Now the way you do that is you create a .claud folder, you then create a nested agents folder, and inside of there you create some markdown files that specify what the agents are.
16
So you can see I have two here, I have a debugger agent and a reviewer agent, and the format and syntax looks like this.
17
Now you don't need to manually write all of this yourself, you can tell Claude to create the agent spec for you,
18
but when you have this it will specify a list of agents that Claude can then invoke.
19
So you'll notice we have a reviewer and a debugger and for these we have a name, description, the tools that they're allowed to use, as well as optionally the model that we want them to run.
20
This can be helpful especially if you're running a lot of subagents to reduce the cost.
21
So once we have those set up what we can do is run Claude inside of our project
22
so inside of the subagents folder here and
23
if we want to make sure that these subagents are appearing we can run slash context.
24
When we do that it should show us here that we have two custom subagents.
25
You can see they're specified right here.
26
And then if we ask Claude to do something that would involve invoking the subagents, you should see it spin that up automatically.
27
So for example, I may say something like, please review this PR before I merge it.
28
Tell me if there's any issues.
29
Okay, let's go ahead and press on enter.
30
And we should see that it pulls up our reviewing subagent here and does that automatically.
31
Boom, so you can see I'll have the reviewer agent examine.
32
And then you can see that it is calling the reviewer subagent and running that in its own thread.
33
Okay, so we can see the review agent is done and then we get back the overall response.
34
And effectively what Claw does here is it will invoke the sub-agent
35
and then it will only take the response from that sub-agent
36
and bring that into context for the main thread that we're currently chatting inside.
37
The reason this is important is it means
38
that our main thread stays a little bit leaner
39
so we can have separate context windows for each of the individual sub-agents
40
that only need to know what it is that they're specifically working on, which typically will give us better accuracy than doing everything in one massive thread where
41
when we start getting near the context window limit, as you guys probably see the agents start to get a lot dumber.
42
So that's custom subagents.
43
I would only create them when you want to delegate things out of the main thread, when you want specific rules to be set up in terms of tools, read-only models to be used,
44
et cetera, but they are super useful and you can create them in the way that I showed you.
45
Moving on, we talk about skills, but I'm going to show you some advanced features that you haven't seen before related to them.
46
If you're unfamiliar, a skill is just a markdown file
47
that outlines a set of procedures or a set of steps that are kind of like a reusable workflow.
48
Rather than constantly telling the model to do the same thing over and over again, you create a skill, so it's kind of a reusable workflow, and then you can trigger.
49
Now, the model can automatically call the skill, and it will discover it when it needs to use it, or you can manually invoke the skill yourself and force the model to go through the process.
50
Now, that's actually the first feature of skills that I want to talk about here.
51
first skills sit inside of .clawed slash skills, similar to how we have this agents folder for the subagents.
52
You can make them manually by writing them yourself.
53
You can ask the agent to create them for you, or you can import them from something like a GitHub repo or someone else's skill that's already been written.
54
Now, when you create the skill, you'll see that you can have a name and a description, and this is the only thing the model will see before it decides to invoke the skill.
55
Now, inside the skill, you then have all of the steps.
56
Now, another interesting thing you can do is add this flag called disable model invocation to your skill, which most people don't know about.
57
Now, what this will do is actually tell the model whether
58
or not it can call this skill itself or whether you have to invoke it manually.
59
So when you set this to true, essentially that will prevent the agent from automatically loading this skill.
60
So it won't sit inside of the context.
61
And this will only be used when you invoke the skill yourself.
62
So I'm going to show you what I mean by that.
63
But if I go into my terminal here and I invoke Claude from this folder, First, we can type slash skills and see all of the ones available.
64
So you can see that we have this deploy skill and this rollback skill.
65
These are project based skills.
66
So they're just available in this specific folder.
67
And you'll see that one of them is locked because I have that disable model invocation.
68
Now, if I want to actually run that skill, I can invoke it manually by just typing slash rollback, and then it should go through the process of actually invoking the skill.
69
Now, I'm just gonna cancel it for right now because I don't wanna do that.
70
Alternatively, if I wanna run a different skill, so let's say maybe the deploying skill, I can actually add an argument to this when I run it, so slash deploy and then staging,
71
so you don't just have to do the slash command, You can say afterwards what you want to be done.
72
Then again, Claude should find the skill, discover it, figure out what needs to be done, and then go ahead and actually run the entire process.
73
I'm not going to walk you through the full thing.
74
I'm sure you guys understand what skills are.
75
I also could tell Claude to do something
76
that would involve invoking the skill and then it would just figure it out and call the correct one.
77
Point is that they have a few more features and wanted to show you that kind of locking feature, which is quite useful when you want to have to manually invoke it
78
and not accidentally have the model do it on your behalf.
79
So the next feature to talk about is called hooks.
80
Now this is a much more advanced feature, it really deserves its own video, but I'll quickly cover it here so you can look into it more if it seems useful.
81
Now Claude has a bunch of different events that will happen throughout its agentic loop.
82
The events look something like this and while they look a little bit confusing, you can at least get an idea of kind of the flow.
83
For example, we have session start, user prompt submit, pre-tool use, right?
84
You get the idea and all of these things will occur throughout some kind of process while you're using Cloud Code.
85
Now, what you can actually do is you can hook into these events
86
and you can trigger a bash command to run whenever these events occur.
87
So for example, if we scroll down, you can see all the events like session, start, setup, user prompts, submit, whatever.
88
So you can do something like, hey, whenever it's set up, I want to automatically create a markdown file, or I want to automatically test my application.
89
Or hey, after we use a tool or before we use a tool, I want to make sure that tool is permitted.
90
You get the idea, okay?
91
So there's a lot of interesting stuff you can hook into here to customize how Claude works.
92
And the way you do that is by writing a config file that looks something like this.
93
So let me show you an actual example here on Windows.
94
You can see that this is an example of a config file
95
that you can create right inside of a hooks folder inside of Claude.
96
So what you'll do if you want to create hooks is you'll create a Claude folder, you'll create a hooks folder, you'll create a settings.json, and then the hooks can include different files
97
that you want to actually run or different scripts that you want to run when an event occurs.
98
So for example, what we have here is post-tool use and pre-tool use.
99
And what will happen here is that we're going to match against edit and write.
100
And whenever there's a tool that has edit or write, we're going to run this Python, Claude, Hooks, Format, Hook.py, Python script.
101
So that's going to automatically format all of the code for us before any tool is ran.
102
Or sorry, after any tool is ran.
103
Then we have pre-tool use.
104
And what this is going to do is run the block dangerous.
105
So what that's going to do is it's going to block any dangerous commands
106
or whatever from being ran before it allows those to run.
107
So if we have an exit code two, that means block the tool call so that it cannot work in Claude.
108
I'm not going to go through exactly how you set it up, but the point is we can have these hooks and I'm going to show you now how they actually work.
109
So let me get out of Claude.
110
Let's change into the other directory, which is 03 hooks and let's run Claude and give it some prompts.
111
You can see how they trigger.
112
Okay.
113
So we're just going to say something like add a function called get average age to messy.js
114
that returns the average age of all of the users.
115
Okay.
116
And let's see what we get here.
117
So you can see we're reading a file, messy.js, searching for a pattern.
118
Okay.
119
So we're going to go, yes, we do want to allow this.
120
So let's proceed.
121
Okay.
122
Keep going, read file.
123
And we should see that the hook will actually trigger now because it's gone with that process.
124
Perfect.
125
So you can see the post tool use hook then ran prettier on the file automatically.
126
So the whole file got reformatted after my edit.
127
So you can see this ran, right?
128
Both our hooks went through and essentially it just worked, right?
129
So we didn't need to do anything.
130
It just automatically formatted the file.
131
And if we go back here, maybe we can have a look at, let's see here, message.js and you can see that it was formatted.
132
So the next feature I want to show you is related to MCPs or model context protocol.
133
Now, these are servers that you can add inside of Claude that allow you to connect to external tools.
134
Of course, there's tons of different MCPs that are worth adding and I'll make an entire video on that.
135
But one that I want to highlight here that I've been using a lot recently is Granola.
136
Now they've kindly sponsored this video and been a long-term partner of the channel, but this is an AI note-taking app
137
that I use pretty much every single day that automatically transcribes your meetings without joining your call.
138
So rather than having that little annoying note-taker that joins in, it just sits on your computer, it reads your computer audio, and it keeps track of all of your notes,
139
keeps track of your calendar and sends you reminders and then saves everything in a nicely formatted way.
140
So you can view it and also pull it into AI to have additional context.
141
So earlier this year, they actually released an official MCP server.
142
You can see I'm connected to it right here.
143
It allows us to query all of the different meetings
144
and I want to show you just in live time how it works.
145
Using the Granola MCP server, tell me what I learned in my most recent Indonesian lesson.
146
And that's because using Granola, I actually automatically transcribe all of my lessons with my teacher.
147
So it should tell me some words that I actually learned here.
148
Let's see.
149
Cool.
150
So we can see it pulled the most recent transcript and gave me all of the information.
151
Now we'll just open up the UI so you can see what it looks like.
152
Notice that we have the Indonesian language lesson, a bunch of other stuff that I was going through, and you get the point.
153
Granola is great.
154
Download it from the link in the description.
155
And now let's move to the next feature.
156
So the next feature to discuss here is work trees.
157
Now this is super useful whenever you're going to run Claude in parallel
158
and you want to make sure that agents aren't changing things that other agents are working on.
159
It's effectively essential if you want to have multiple agents that are working on the same pieces of projects.
160
Now work tree is really an isolated copy of your project that's on your own computer.
161
It's similar to something like a git branch but it differs just slightly and works better with agents.
162
Now you don't really need to understand the mechanics of the work tree, but what you need to know is how to invoke one and create one.
163
Now, Claude will sometimes do this automatically for you, but you can do it manually and it's best practice to create it on your own.
164
So for example, I'm inside of a folder, you know, work trees, right, where I have a quick demo setup.
165
What I can do is run Claude, but rather than just running Claude, I can add this work tree flag.
166
Now for the work tree flag, after this, I can do something like fix delete bug.
167
Now what I'm doing is giving this work tree a name, And when I go ahead and press on enter here, Claude is now going to be running inside of my folder,
168
but inside of this work tree.
169
So it's on its own isolated version, which is essentially a copy of whatever was inside of my project.
170
And from here, I can give this a prompt.
171
So let me just copy this in, read bug.md, reproduce the bug, right, find the root cause and fix it.
172
And then at the same time, I can create a new work tree and another terminal.
173
So Claude work tree, and let's go maybe feature dark mode or something, because we want to add a dark mode feature.
174
And again, I'm just going to copy in another prompt from here.
175
Let's put it in this, I don't know, auto mode and same thing here.
176
Okay.
177
So let's go.
178
Yes.
179
And just put it in auto mode and you'll see
180
that both of these are now going to work in their own repo or own copy of the repo.
181
So they're not accidentally going to mess something up.
182
All right.
183
So we can see that both of the agents have finished.
184
So now let's just open up another cloud code session here.
185
This one I didn't put in a work tree and I'm going to say, can you find all of the changes
186
that have been made across the different work trees for this repo
187
or for this project and tell me which ones are there and just ensure that they are actually in isolation.
188
And then I want to combine them together.
189
Okay.
190
So let's press enter here.
191
And by the way, if you guys are wondering what I'm using to dictate, I'm using a really cool tool called whisper flow.
192
You can see I have almost 300,000 words at this point.
193
I use it literally every single day.
194
I do have a partnership with them.
195
It's free to try out.
196
So I'll leave a link to it in the description, but it's just the fastest way to work with AI, as you guys can see from my own usage.
197
So anyways, I would highly recommend from here.
198
Let's go.
199
Yes.
200
I'm just going to put this in auto mode so it can run and let's see what it tells us.
201
So you can see right away that it found both the work trees
202
and now it's inspecting them
203
and then what we'll be able to do is actually combine these changes together without losing anything
204
or messing up either one of these branches right that we're running in isolation.
205
Okay we can see it was able to kind of reconcile all of this together
206
and now it told us what was in both work trees
207
and then it combined them or merged them so that now everything is in this one repo.
208
Anyways that's work trees definitely use them especially when you have multiple agents.
209
So the next feature I want to show you here is headless mode.
210
And this allows you to run Claude without actually being in the interactive terminal, which is super useful
211
when you want to use this as a part of something like a bash script or kind of a one step process.
212
So I'm just going to show you a few really quick examples.
213
And of course, if it's going to be useful to you, you'll know.
214
So you can see that I'm inside of the headless folder.
215
And what I'm going to do is actually, let's make sure we get the full thing.
216
I'm going to run the cat command.
217
So this is just going to log out whatever's in this build log dot TXT.
218
And then it's going to pipe that into this where we have clod-p, which essentially is prompt, and then we place a prompt right here.
219
So what's going to happen when I run this is clod is going to run, but it runs in headless mode where it's not opening up the interactive window for us, and it just gives us the response.
220
So I was able to take the result of the build log, I was able to include that as part of the context in this clod prompt, and then just tell it, hey, why did this fail?
221
And then it gave me the response right here directly in my terminal, which means you can then use this as a part of other scripts.
222
Now I'm going to show you even how we could use this with something like JSON.
223
So for example, now I said, hey, I want the output format to be in JSON and I want to use JQ to actually parse out the result.
224
And now we're going to have this in a format where I could use it more kind of reliably in a script.
225
So here you can see build failed, gives us the errors, you get the idea.
226
Now let's have a look at maybe some of the metadata here.
227
So same thing, I'm going to do this again, summarize this build failure in one sentence, output format JSON, and notice this is what the result looks like we get the result, we get the total cost,
228
the number of turns and the duration in milliseconds.
229
And of course, the cost doesn't really make sense in this context because I have the subscription, but you get the idea.
230
Let's do one more.
231
So maybe I want to run this, but I only want to allow it to read something.
232
So I don't want it to actually have access to a bunch of tools.
233
I can add allowed tools read.
234
The reason I'm showing this to you is that you don't need to use Claude from the interactive terminal.
235
You can trigger it from scripts.
236
You can run it on one-off prompts using this command, which I always thought was really useful.
237
So to kind of prove what I mean here, notice that I wrote this triage script and you can see
238
that what we actually do here is we run this Claude headless mode automatically
239
and then get the result and print it out.
240
Now I'm not going to run this script, but the point is I can do something like this where I'm actually triggering it inside of a script.
241
All right.
242
So the next feature that I want to show you here is checkpoints and rewinding.
243
Now in order to do this, I'm just going to do a prompt in a new example
244
that I have here where I tell it to rewrite app.js from scratch as a single tip calculator class.
245
We have like, you know, a quick kind of react example or whatever, and we'll just give this a second here to rewrite it.
246
I want to show you how I can roll back
247
so we can actually go back to different checkpoints in case Claude makes a mistake.
248
So this is effectively the app I had super simple, right?
249
Where we can just calculate the tip based on the bill amount splitting between a certain number of people.
250
You get the idea.
251
Now let's do one more prompt here where I'm just going to tell it to rename every function and its ID, not to touch index.html.
252
And hopefully I'm going to have this actually break the app
253
so I can show you how we can roll back to a working version.
254
So now you're going to see that actually the app is completely broken.
255
And if I try to do anything, it just doesn't work because I intentionally broke it.
256
So let's say you were to do that, but obviously unintentionally, and you want it to go back to a previous point.
257
Well, Claude will actually checkpoint different builds for you.
258
So what you can do here is you can use the command slash rewind.
259
Now when you do that, it's going to show you whatever was in the current conversation and you can go back at any point.
260
So we have current, we have rename every function, we have rewrite every app, whatever.
261
So I'm going to go to rewrite and I'm going to go restore code and conversation.
262
Now it brings me back to this stage where if I go back to my application here and I refresh, okay, let's put in a hundred and you can see now the app is working.
263
So basically just understand that you have that slash rewind feature
264
so you can always roll back in case you make a mistake.
265
Now this next feature is super useful
266
when you want to go back into an old conversation that you had in a particular project.
267
So let's say I go into, I don't know, three hooks, right?
268
And I want to go back into the previous conversation that we had at that point.
269
Well, in order to do that, I can actually just type claw dash dash continue.
270
Now this is going to bring me back into whatever
271
that conversation was because the session is stored and saved on our machine.
272
There's actually multiple ways to get into different sessions, which I'm going to show you in a second.
273
But the point is that you can do this, right?
274
So you don't need to always restart a new session.
275
You can resume different sessions.
276
You'll even notice here that it has various IDs for each session, which you can manually invoke to get back into regardless of what directory you're in.
277
So now that you understand continue, let's talk about being a little bit more proactive with our sessions.
278
So you saw that random ID we had for sessions previously.
279
That's great, but you can actually name your sessions as well.
280
So for example, when I run clod, I can do dash n and then call this something like auth refactor.
281
Now I've just named the session auth refactor, so it's always going to be saved as that.
282
And again, I can give this a long prompt, so let's paste something in like this.
283
And notice in the bottom right of my screen that it shows us what session we're in.
284
We'll just put this in auto mode so it can go.
285
So I'm going to say, look at source, you know, auth.js, make a change, whatever.
286
And then we can get out of this session and come back into it any point that we want.
287
Okay.
288
So let's get out of this.
289
And I'm going to show you again, if I want to resume this one, I can do claw dash dash resume and then auth refactor.
290
And it's going to bring me right back into where I was before.
291
And there's some other interesting stuff we can do in here.
292
For example, we can use slash branch.
293
Now when we do that, it's going to create a branch of the current conversation, but not override this session.
294
So when I do that, notice that I'm now in a branch.
295
Okay, and then I can ask it to do something
296
that may be risky that I want to potentially have to get back to the main conversation for.
297
So let's say actually scrap incremental changes, rewrite the entire module as a class with static methods and see how that looks.
298
Okay, and you can see that we're now working inside of this branch of the main conversation.
299
Okay, so this is finished.
300
And now what I can do if I want to go back to the original branch, so not the one that I just branched off on, I can type slash resume and I can go back into this before the branch.
301
So we no longer have those changes that were applied.
302
And then same thing, I can go slash resume here
303
and you can see we have the branch and I can go back into that.
304
The point of me showing this to you is that you can be really clever how you manage sessions inside of Claude.
305
There's actually a lot more that you can do
306
that I haven't shown you in this video because it's meant just to be kind of a quick run through, but you can name them, you can branch them, you can resume them, you can go in and out of them
307
and you can be really clever and have a lot of parallel work going on that's also going to be safe.
308
So anyways, guys, with that said, that's going to wrap up this video.
309
If you enjoyed, leave a like, subscribe, and I will see you in the next one.

Sobre esta lección

¿Qué es la Técnica de Shadowing?

Shadowing es una técnica de aprendizaje de idiomas respaldada por la ciencia, desarrollada originalmente para la formación de intérpretes profesionales y popularizada por el políglota Dr. Alexander Arguelles. El método es simple pero poderoso: escuchas audio en inglés nativo y lo repites en voz alta de inmediato, como una sombra que sigue al hablante con solo 1-2 segundos de retraso. A diferencia de la escucha pasiva o los ejercicios de gramática, el shadowing obliga a tu cerebro y músculos de la boca a procesar y reproducir simultáneamente patrones de habla reales. Las investigaciones muestran que mejora significativamente la precisión de la pronunciación, la entonación, el ritmo, el habla conectada, la comprensión auditiva y la fluidez al hablar, convirtiéndola en una de las metodologías más efectivas para la preparación del IELTS Speaking y la comunicación en inglés en el mundo real.

Técnica de shadowing: lee la guía completa paso a paso →