쉐도잉 연습: How to actually force Claude Code to use the right CLI (don't use CLAUDE.md) - 영상으로 영어 말하기 배우기

레슨 만드는 중...
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.

맥락 및 배경

이 비디오에서는 Claude Code를 사용하면서 잘못된 CLI 명령어 사용을 강제로 막는 방법에 대해 설명하고 있습니다. 주로 개발자들이 자주 묻는 질문 중 하나인 '어떻게 내 작업 흐름에 맞게 Claude를 조정할 수 있을까?'에 대한 답변을 제공합니다. 이로 인해 팀이나 개인의 효율성을 높일 수 있는 방법을 다루고 있으며, 이 과정에서 영어로 의사소통하는 능력을 개선할 수 있는 기회를 제공합니다.

일상적인 의사소통을 위한 주요 5 문구

  • 어떻게 하면 PNPM을 사용할 수 있을까요? - 프레임워크의 설정을 변경하고 싶을 때 유용함.
  • 이번 작업에 어떤 명령어를 사용하는 것이 좋을까요? - 자신이 원하는 작업 흐름을 설명할 때 사용할 수 있음.
  • 이 코드는 어떤 기능을 하나요? - 다른 사람에게 코드의 기능을 질문할 때 적절함.
  • 명령어를 어떻게 막을 수 있을까요? - 특정 명령어의 실행을 방지하고 싶을 때 필요함.
  • 설정 파일은 어디에 있나요? - 작업 환경에 대해 궁금할 때 사용할 수 있는 질문임.

단계별 쉐도잉 가이드

이 비디오의 내용을 효과적으로 이해하고 영어 말하기 능력을 향상시키기 위해 아래 단계를 따르세요:

  1. 비디오를 처음부터 끝까지 시청하세요. - 내용의 전반적인 흐름을 파악하는 것이 중요합니다.
  2. 핵심 문구를 반복하세요. - 본문의 주요 문구를 선택한 후, 여러 번 소리 내어 말해보세요. 이는 영어 발음 교정에 도움이 됩니다.
  3. 문장을 바꾸어 보세요. - 비디오에서 제공하는 문장들에 비슷한 의미의 다른 단어를 사용하여 재구성해 보세요.
  4. 쉐도잉 기술을 활용하세요. - 영상을 틀어놓고 뒷부분에서 스피커의 발음을 따라 해 보세요. 이를 통해 shadowspeak 능력을 기를 수 있습니다.
  5. 자신의 속도로 연습하세요. - 처음에는 느린 속도로 따라하고, 점차 속도를 증가시켜 실제 대화에 적응해 가세요. - 이렇게 하면 IELTS 스피킹 준비에도 큰 도움이 됩니다.

위의 단계를 통해 영어 쉐도잉 능력을 향상시키고, 실제 생활에서 필요할 수 있는 의사소통 스킬을 키워나가세요.

쉐도잉이란? 영어 실력을 빠르게 키우는 과학적 방법

쉐도잉(Shadowing)은 원래 전문 통역사 훈련을 위해 개발된 언어 학습 기법으로, 다언어 학자인 Dr. Alexander Arguelles에 의해 대중화된 방법입니다. 핵심 원리는 간단하지만 매우 강력합니다: 원어민의 영어를 들으면서 1~2초의 짧은 지연으로 즉시 소리 내어 따라 말하는 것——마치 '그림자(shadow)'처럼 화자를 따라가는 것입니다. 문법 공부나 수동적인 청취와 달리, 쉐도잉은 뇌와 입 근육이 동시에 실시간으로 영어를 처리하고 재현하도록 훈련합니다. 연구에 따르면 이 방법은 발음 정확도, 억양, 리듬, 연음, 청취력, 말하기 유창성을 크게 향상시킵니다. IELTS 스피킹 준비와 자연스러운 영어 소통을 원하는 분들에게 특히 효과적입니다.