Shadowing Practice: How to actually force Claude Code to use the right CLI (don't use CLAUDE.md) - Learn English Speaking with Video

Creando lección...
1
One of the most common questions I get about agents
2
and about claw code is how do I force it to use the right CLI command?
3
How do I force it to adopt my workflow instead of the workflow that it knows best?
4
For instance, how do I get it to use PNPM instead of NPM?
5
How do I get it to call this wrapper script that we wrote instead of calling the thing directly with NPX?
6
How do I prevent it from using certain commands and only allow it to use other commands?
7
If you're interested in these kind of questions, this is the stuff that I answer on my newsletter.
8
I'm working on a Claude code course right now for real engineers, not Vibecoders.
9
So if you dig that stuff, the link is down below.
10
The first thing that you probably think about
11
when you think about steering Claude in one direction but not another is to put information in a Claude.md file.
12
In other words, to proactively tell it to use PNPM, not NPM.
13
Now, this will be pretty effective most of the time, especially if like this, you have a Claude.md file that is nearly empty apart from that one instruction.
14
However, in various places, including in the previous video I just posted, I've advocated almost always deleting your claw.md.
15
Because if you think about it, this instruction here is only relevant for certain tasks, and putting it in claw.md makes it global for every action that you're going to do in the repo.
16
LLMs have an instruction budget
17
that you can really only put about 500 instructions in before it starts getting less
18
and less powerful and more and more confused.
19
And we want our LLM thinking about the complicated plans and the implementation that it's going to put together, not having irrelevant instructions about using NPM or PNPM.
20
And the final thing that makes me uncomfortable about this is the fact
21
that it's not a deterministic way of preventing a command.
22
For instance, we may want to disallow it from running destructive commands.
23
For instance, we never want it to git push.
24
These kind of negative instructions to the LLM are really bad,
25
I think, because they burn instruction budget in something that we're not actually using the instruction budget to prevent deterministically.
26
By adding this, we're reducing our chances of running git push or reducing our chances of running NPM, but we're not preventing it.
27
So instead, I'm going to show you an approach that prevents it deterministically and guides the LLM towards the correct solution.
28
The way to do this is via Claude Code hooks.
29
Hooks allow you to run deterministic code at certain points during Claude Code's execution cycle.
30
When one of these events fire, all matching hooks run in parallel.
31
So for instance, you can run a hook when the session starts.
32
You can run a hook when a permission dialogue appears to automatically approve things.
33
The one that we're interested in is pre-tool use before a tool call executes can block it.
34
Our plan here is to use this pretool use hook to before it calls npm to use pnpm instead.
35
And the cool thing about this is that Claude code already knows how to do this.
36
And I've actually prepared a prompt inside this file to take the Claude.md, turn it into deterministic hooks, and then put those hooks into your project.
37
Here's what it looks like.
38
Take the instructions in your Claude.md file, turn them into deterministic Claude code hooks in this project directory.
39
Not Once all the instructions will be deterministic, only do the ones you can, such as instructions to use one CLI command over another or disallowing certain CLI commands.
40
Use separate bash scripts for running the hooks, in other words this is its own .sh file and it gives some syntax here for how to construct that.
41
This is directly lifted from the Claude code docs.
42
And then finally below here, first confirm with the user which hooks will be created,
43
second implement the hooks, third provide the user with instructions on how to test the newly created hooks.
44
I'll include this in an article which is linked below for you.
45
So I'm going to copy and paste this, I'm going to go into a fresh Claude Code session here, I'm going to zoom up the terminal a bit, I'm going to paste it in and see what happens.
46
Alright, it's given me two options here.
47
It says there are two rules that can be enforced deterministically, block NPM commands or block git push.
48
Now I've actually it already got some git push blockers in my global setup so I'm just going to say, yeah, do the npm one only.
49
So that sounds good.
50
Let's run this and see what happens.
51
So it's now given us something to review.
52
It's given us a nice version of the bash command that we saw earlier, except it just checks if it's npm.
53
Crucially it's checking if the command starts with npm as a command.
54
It echoes use pnpm not npm and then it exits with an exit code of 2.
55
So that is looking good to me.
56
Let's accept that.
57
It's then going to make it executable by running chmod plus x, so I'm happy with that.
58
It's then created the configuration inside settings.json here, where we've got now hooks, which is a property on the settings, pretool use, which is the one we saw earlier.
59
It's matching any bash tools here.
60
And then when it matches any bash tool, it runs this command, block npm.sh.
61
So that looks good to me.
62
We're in a good spot.
63
And it's now appearing to verify that the hook works in line.
64
I'm just going to try and run this to see what happens.
65
And you can see here just up there it said blocked use PNPM not NPM.
66
So we're definitely getting somewhere.
67
And finally it's given us some instructions here to test it.
68
To restart claw code in this project try asking it to run something like NPM install foo.
69
Alright the first thing I'm going to do is actually remove the instruction from claw.md here.
70
And then we're going to pull open a fresh clawed code instance
71
and we're going to say npm install let's say React query.
72
Okay, let's give it something kind of juicy.
73
And we can see that the pre-tooled use here,
74
it said bash hook error blocked use pnpm not npm and now it's running pnpm install tanstat react query instead.
75
So that's it.
76
We have prevented one command and we've automatically steered it to use another command.
77
And crucially we've managed to kill an instruction inside our global clawed.md file.
78
This is what I love so much about this approach.
79
You get to take instructions out of your instruction budget and enforce them deterministically.
80
This means that the instructions that we have in clawed.md, they are available just in time.
81
They get to hover in the background until clawed actually progressively kind of discovers them.
82
And this idea of these rules just being enforced just in time, you can take this and apply it to lots of different things.
83
For instance, I've been turning my style rules, like I really hate positional parameters in functions, and turning them into ESLint rules so
84
that I can lint Claude into the right thing without needing to warn it or instruct it.
85
So creating these feedback loops for Claude is so, so powerful.
86
Now if you dig this, then this and all of my ideas are going to be in my newsletter, so you never miss a trick.
87
And the link for that is below if you want to click it and sign up.
88
But thank you so much for watching.
89
I've been having a blast making these videos and discovering lots of new ideas about Clawed.
90
What else do you think you can do with Hooks?
91
What else do you want to see me cover with Clawed Code?
92
And now of course Clawed is not the be all and end all, right?
93
Like I'm pretty keen to try out other coding agents too.
94
And the Hooks idea is not exclusive to Clawed too, so you can take this knowledge and probably take it to Codex or whatever you're using.
95
But anyway, that's enough rambling.
96
Thanks for watching and I'll see you in the next one.

Vocabulario y notas de pronunciación para esta lección

Esta lección de conversación de nivel C1 se basa en el vídeo “How to actually force Claude Code to use the right CLI”. Las palabras que más se repiten: instruction, hook, npm, Claude, command. Este vídeo tiene 96 frases y 1424 palabras para practicar shadowing. La parte hablada dura 6:50. El hablante habla rápido, unas 208 palabras por minuto, así que espera sonidos enlazados y reducidos. Solo el 80 % de las palabras está entre las 3.000 más comunes del inglés, por lo que el vocabulario es exigente.

Vocabulario clave de este vídeo

Las 15 palabras más avanzadas del vídeo, con su pronunciación y significado:

PalabraPronunciaciónSignificado
claw sustantivo/klɔ/garra
deterministic adjetivo/dɪˌtɜː.mɪˈnɪs.tɪk/determinístico, determinista
bash verbo/bæʃ/hostiar
enforce verbo/ɪnˈfoɹs/hacer cumplir/respetar, enforzar
disallow verbo/ˌdɪsəˈlaʊ/rechazar como inválido, rechazar como falso
query sustantivo/ˈkwɪɹ.i/consulta, pregunta
steer verbo/stɪɹ/dirigir, conducir
newsletter sustantivo/ˈn(j)uzˌlɛtɚ/boletín de noticias, boletín informativo
pasta sustantivo/ˈpɑ.stə/pasta
blocker sustantivo/ˈblɑkɚ/bloqueador, bloqueadora
executable adjetivo/ˈɛksəkjutəbl/ejecutable
instruct verbo/ɪnˈstɹʌkt/instruir
proactively adverbio/pɹoʊˈæk.tɪv.li/propositivamente
progressively adverbio/pɹəˈɡɹɛsɪvli/progresivamente
ramble verbo/ˈɹæmbəl/vagar, errar

Phrasal verbs que vas a escuchar

PalabraSignificado
put together verboconstruir, elaborar
sign up verboinscribir, alistar
try out verboprobar, ensayar

Frases que vale la pena repetir

Frases cortas y completas del vídeo que puedes reutilizar en la conversación diaria:

  • Alright, it's given me two options here.
  • Let's run this and see what happens.
  • We're in a good spot.

Gramática en este vídeo

Las estructuras que más usa el hablante, con las palabras exactas del vídeo:

EstructuraEn el vídeo
Present perfect continuous have/has been + -ing — una acción que empezó antes y continúaI've been turning · I've been having
Present perfect have/has + participio pasado — una acción pasada que sigue importando ahoraI've advocated · I've actually prepared · have prevented
Voz pasiva be + participio pasado — importa lo que ocurre, no quién lo hacewill be created · is linked · can be enforced
Oraciones de relativo who / which + oración — información extra sobre una persona o cosaarticle which is · hooks, which is

Pronunciación a tener en cuenta

El hablante usa 32 contracciones y formas reducidas, como I'm, we're, I've. Dilas en su forma corta, tal como las oyes.

  • Los sonidos de “sh” y “zh”: bash /bæʃ/, crucially /ˈkɹuːʃəli/, configuration /kənˌfɪɡ.əˈɹeɪ̯.ʃən/
  • Palabras largas — cuida el acento: deterministic /dɪˌtɜː.mɪˈnɪs.tɪk/, executable /ˈɛksəkjutəbl/, proactively /pɹoʊˈæk.tɪv.li/, progressively /pɹəˈɡɹɛsɪvli/, parameter /pəˈɹæm.ə.tɚ/

Sonidos difíciles para hispanohablantes:

  • /v/ — no es /b/: los dientes tocan el labio inferior: proactively /pɹoʊˈæk.tɪv.li/, progressively /pɹəˈɡɹɛsɪvli/, verify /ˈvɛɹɪfaɪ/, destructive /dɪˈstɹʌktɪv/, irrelevant /ɪˈɹɛləvənt/
  • /z/ — sonora, no /s/: newsletter /ˈn(j)uzˌlɛtɚ/, zoom /zuːm/

Cómo practicar con este vídeo

  1. Escucha el vídeo entero una vez sin hablar y anota las palabras que no conoces.
  2. Empieza a velocidad 0,75×, haz shadowing frase por frase y vuelve a la velocidad normal cuando te resulte fácil.
  3. Grábate y compara con el original, prestando atención a palabras como claw, deterministic, bash.

¿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 →