HomeVideos

Claude Code tried to improve /init... Is it any better?

Now Playing

Claude Code tried to improve /init... Is it any better?

Transcript

354 segments

0:00

So, 3 weeks ago I made a video called

0:02

never run Claude in it. My reasoning

0:05

being that it creates these huge bloated

0:07

Claude.md files, which don't end up

0:09

actually serving you that well. Turns

0:11

out this relatively unknown YouTuber

0:13

with quite nice hair was doing this

0:15

about a month ago as well. So, we both

0:17

had the same idea. A week or so later

0:18

Tarik from the Claude code team said, "I

0:20

want to make init more useful. What do

0:22

you think it should do to help set up

0:23

Claude code in a repo?" It's worth

0:24

noting that I then said use progressive

0:26

disclosure much more aggressively and

0:27

propose a set of skills for the agent to

0:30

understand the repo's best practices.

0:31

The stuff inside Claude.md should be

0:33

extremely minimal, basically only

0:35

environment info. Of course, lots of

0:36

people had good ideas in this channel

0:37

like Dex did as well, you know,

0:40

progressive disclosure, you get the

0:41

idea. And so, just a couple of days ago

0:43

they are now testing out a new version

0:45

of init based on our feedback. And you

0:47

can try it out with this environment

0:48

variable. So, it's actually in the

0:50

Claude binary, so we can try it now. So,

0:52

I feel like I have a duty to check out

0:54

whether this thing is actually good to

0:55

see if I need to like deprecate my old

0:58

video or anything like that. I also kind

0:59

of want to give Tarik and the team some

1:01

feedback. And so, this is me and my

1:03

honest kind of assessment of what init

1:05

looks like now. So, I'm going to take

1:07

this command here and I'm going to run

1:09

it inside my work repo. This repo is my

1:11

course video manager repo, which you

1:13

will have seen before if you watched my

1:15

feature build video. It is a React

1:17

router application with the usual

1:19

TypeScript, Prettier, Vitest kind of

1:21

setup. So, let's run this and let's see

1:24

what this new init thing does. I'm going

1:26

to kick this off then by simply running

1:28

init and seeing what happens. Now, full

1:30

disclosure, I did try this out once and

1:32

so I have seen this before. It appears

1:34

that it immediately asks you a couple of

1:36

questions, kind of like setup questions

1:38

that you might see in a normal init CLI.

1:40

It asks you which Claude.md files should

1:43

init set up, either a project Claude or

1:45

personal or both project and personal.

1:47

Since I'm a solo developer working on

1:48

this, I don't really need a personal

1:50

one. I'm happy with just a project one.

1:51

Now, should you also set up skills and

1:54

hooks? Like, this seems like a weird

1:56

question to me because I don't know what

1:58

skills and hooks I need, Claude. Why

1:59

don't you tell me? So, I'm just going to

2:01

go down here and dictate, "I have no

2:03

idea. Why don't you tell me? Go on,

2:04

Claude. Show me off your secret menu

2:06

what you think I should go for." And

2:08

let's see what it says next. Okay, it's

2:09

going to do the classic thing where it's

2:10

going to explore the code base and

2:12

recommend whether skills and hooks make

2:13

sense for this project. Okay, it spent 1

2:16

minute 54 and it surveyed the code base

2:18

thoroughly. Cool. There we go. Skills

2:20

plus hooks make sense for this project

2:21

because you already have three skills. A

2:23

format on edit hook would auto run

2:24

prettier after every edit and a verify

2:26

skill would give you a quick way to run

2:28

type check and tests on and okay. So, I

2:30

don't think this thing should actually

2:32

ask you these questions. It should just

2:34

say, "Okay, let me explore what

2:35

opportunities there are for skills and

2:36

hooks." Now, okay. A lot of people ask

2:38

me about why I don't tend to use the ask

2:42

user question tool. For instance, in the

2:44

skills I write I don't tend to write use

2:46

the ask question tool. A lot of people

2:49

ask me about this, especially in this

2:50

little grill me skill, which you may

2:52

have seen me use before if you follow

2:54

this channel. Now, the reason I don't

2:56

like this one is because I freaking hate

2:58

the UI. Look at this crap. Look. Does

3:00

this proposal look right for your

3:01

Claude.md skills and hook setup? I have

3:02

no idea if it looks right cuz I can't

3:04

bloody see it. What happens if I press N

3:06

to add notes here? I can't add notes on

3:08

the design, can I?

3:09

Okay, and now I just escaped and I'm

3:12

gone out of it. Don't use the ask user

3:13

question UI. That UI is pants. There we

3:16

go. Let's insult it and see what it does

3:18

next. Okay, so it's come back with a

3:20

document which at least an output

3:22

describing what it wants to do. It wants

3:24

to create a Claude.md file, which I

3:26

don't currently have in the repo. It

3:27

wants to create a format on edit hook,

3:30

which automatically runs prettier after

3:31

every edit, so Claude code stays

3:33

formatted. I'll get to that in a minute.

3:35

And then it wants to add some steering

3:37

stuff. So, it wants to say use npm run

3:39

type check, never npx tsc. Let's tackle

3:41

this one first. I already have a hook

3:43

that checks npx tsc. And if it

3:46

encounters it in a bash tool, then it

3:49

tells it to run npm run npm run type

3:52

check instead. What would adding this to

3:54

the Claude.md add that the hook doesn't

3:56

already guarantee? So, let's see what it

3:58

responds to that. Nothing. You're right.

4:01

The hook already enforces it

4:02

deterministically. Adding it to

4:04

Claude.md would be redundant. I'll drop

4:06

it. Okay. So, let's go through the rest

4:07

of the items and just check that it

4:09

actually wants to do it. So, let's start

4:11

with useEffect reducer, not React's

4:13

useReducer. Now, useEffect reducer is an

4:15

interesting one because it's a library

4:17

built by my friend David, who it

4:20

basically only has like just over 4,000

4:23

weekly downloads. Usually I wouldn't use

4:25

a library like this, but because I've

4:27

used it many, many times before and I

4:29

used to work with David on XState. I

4:31

know it's really, really, really, really

4:33

good and it just is not that popular.

4:36

So, having something in the Claude.md

4:38

that actually tells it to use useEffect

4:40

reducer, not React's useReducer, might

4:42

be useful. Except this stuff is

4:43

trivially discoverable from the code

4:45

itself. I never use useReducer in the

4:47

code base. I only use useEffect reducer.

4:50

So, I'm going to ask it, "What value

4:52

does having the useEffect reducer in the

4:54

Claude.md have that is not because it's

4:58

like trivially discoverable in the code

5:00

base itself? I'd like you to stand up to

5:01

me on this one. Give me the best

5:03

possible justification that you have for

5:05

including this in the Claude.md." LLMs

5:07

are sort of naturally sycophantic and so

5:09

telling it to stand up to me is a nice

5:11

way that you can sort of prompt it to

5:13

justify its decision a little bit more.

5:14

Okay, the strongest case when Claude

5:16

writes new reducer code from scratch,

5:17

its default instinct is useReducer. It's

5:19

the standard React pattern. But we've

5:21

already got this in a skill actually.

5:22

We've already got this in a do work

5:24

front end TDD skill. And also, I just

5:26

don't think that Claude is ever writing

5:28

new reducer code, right? Like, if it's

5:30

going to write React code, it's going to

5:32

use useState cuz that's what most of its

5:35

training data is going to be using. One

5:37

line in Claude.md is cheap insurance

5:38

against a mistake that's annoying to

5:40

catch in review. I guess this is like

5:42

probably true, right? And this is the

5:44

nasty thing about this is that these

5:46

things would be really annoying to have

5:48

to catch in review. And having it always

5:52

in the LLM's context might actually be

5:54

quite useful. The thing is though is I'm

5:56

not thinking about this purely in terms

5:57

of tokens. I'm thinking about this in

5:59

terms of the budget that the LLM has for

6:01

instructions. I talked about this before

6:03

in my previous video on Claude init.

6:05

It's like the LLM can reasonably only

6:08

handle like 500 instructions. And if you

6:11

think about it, the conversation itself

6:12

is full of instructions, right? I

6:14

already have a hook that checks npx tsc.

6:16

I would like you to stand up to me on

6:18

this one. That's another one in the

6:19

budget gone. But he's probably right, I

6:20

think. I'm willing to go with it on this

6:22

one that one line in Claude.md is worth

6:24

trying out at least. So, let's zoom up

6:26

and see what else it wanted to add. It

6:28

wanted to add testing patterns effect

6:30

Vitest light create test DB truncate all

6:33

tables. So, we do a lot of integration

6:35

testing in this repo and we do use each

6:37

of these patterns create test DB and

6:39

truncate all tables. But we might not

6:40

use those forever, right? And I suppose

6:43

if we put them in Claude.md, it creates

6:45

a dependency from one to the other. In

6:47

other words, we need to update our

6:49

Claude.md when we update our tests. And

6:52

what I'm thinking is that every time you

6:54

do an integration test, you'll probably

6:56

do an explore phase in that repo and

6:58

then it's going to pull out any

7:00

integration tests that you do. So,

7:02

that's what I will tell it here. In

7:04

fact, I'll just tell it that it looks

7:05

fine sticking a line about the useEffect

7:07

reducer. But next, let's say, "When we

7:10

do integration testing, there's always

7:12

going to be an explore phase where the

7:14

LLM actually goes in and explores the

7:16

repo before it goes and writes a test.

7:18

Do we really need something in the

7:19

Claude.md is going that's going to

7:21

naturally be surfaced through

7:23

exploration?" I feel kind of sorry for

7:24

the agent at this point because I really

7:26

am just grilling and grilling and

7:27

grilling it. No, you're right. If Claude

7:29

is going to explore the code base before

7:30

writing tests anyway, it'll find effect

7:32

Vitest light create test blah blah blah

7:34

in the existing test files. Documenting

7:36

those patterns in Claude.md is

7:38

redundant. They're right there in the

7:39

code. Now, this one's interesting. npm

7:41

install force for effect packages. This

7:43

one is like super rare because

7:46

we're not really installing effect

7:47

packages that often. And effect, if you

7:50

don't know, is a kind of back end

7:51

TypeScript framework that I use for

7:53

building really robust stuff and lots of

7:55

people use it and it's wicked. It would

7:56

be very easy here to just say yes, but I

7:58

just want to be super super strict about

8:00

our instruction budget. I don't want to

8:01

burn it on something that doesn't happen

8:03

very often. Let's put the effect package

8:05

installation stuff inside a specific

8:07

skill that's invoked whenever we run

8:09

effect packages. Then we'll be able to

8:11

progressively disclose the rationale

8:13

behind the effect packages and it won't

8:14

burn the instruction budget of the LLM

8:16

to include just a brief description. So,

8:18

let's see what it says to that. And it

8:20

says, "Smart. That's a better home for

8:22

it." I don't like this sycophancy, you

8:24

know? I just want it to really like um

8:27

you know, interrogate me and say, "No, I

8:29

have an opinion about where it is best

8:31

to be used." It feels to me like this

8:32

init script is just kind of going with

8:34

all of my suggestions here. I want it to

8:36

stand up to me. Finally, we don't need

8:37

the build and type check commands inside

8:39

Claude.md because they're trivially

8:40

discoverable in the package.json and

8:43

we've already got a built-in hook for

8:44

handling the type check. So, I'm just

8:46

slapping it down one more time. So,

8:48

Claude.md is just the useEffect reducer

8:50

line. That's refreshingly minimal.

8:52

That's I mean, that's refreshingly

8:54

minimal is like this generation's

8:56

version of you're absolutely right. So,

8:58

okay. We are down to

9:00

just a really minimal Claude.md file

9:02

with a questionable useful useEffect

9:06

reducer inside here. Let's just see what

9:08

it says if I just say yes and let's see

9:11

the final outputs. Okay, so it wrote two

9:12

files. It wrote this Claude.md and it

9:15

wrote a skill. Let's take a look at the

9:16

skill first. When installing any effect

9:18

package, always use npm install force.

9:20

That's nice.

9:21

I like that it has a why not. That's

9:24

really useful. I really don't like these

9:26

currently installed effect packages

9:27

because this may change in the future.

9:29

So, kill that. I only want to make

9:31

recommendations here that are durable,

9:32

right? That actually are likely not to

9:34

change in the code base. And because

9:36

this skill is really only for models to

9:39

invoke, I'm going to say user invocable

9:41

is false here. This means it's not going

9:42

to appear in my list of skills that I

9:45

can invoke. Let's take a look at

9:46

Claude.md and see it in all its glory. I

9:47

really don't like this top line here.

9:49

This file provides guidance to Claude

9:50

code when working with code in the

9:52

repository. Why am I passing that to the

9:53

LLM? The LLM already knows that. Then it

9:55

says, "Use use effect reducer from the

9:57

use effect reducer package for reducer

9:58

based states, not React's built-in use

10:00

reducer." I mean, this is really narrow,

10:02

right? Like, how often are we creating

10:04

new reducers? We're really not in this

10:06

repo very much. I'm just going to kill

10:07

it. Screw that. I'm not having it. So,

10:09

we end up with this skill, which is uh

10:12

quite useful for extremely narrow

10:14

situations. But, I feel like it's quite

10:16

possible that someone with uh less

10:18

context paranoia than I would have would

10:20

have ended up with a fairly decently

10:22

sized claw.md. However, I do like this

10:25

skill, and I will keep this skill, which

10:27

is more than I could say from the

10:28

previous uh claw.init. The previous one

10:31

would have asked me no questions,

10:32

created an enormous claw.md file, and

10:34

then just pieced out. So, this, I

10:36

suppose, is an improvement. If you're

10:38

digging this stuff I'm putting out, I'm

10:40

running a cohort course on Claude code

10:43

for real engineers. We're going to be

10:44

looking at the decades-old actual

10:46

engineering techniques that are

10:47

translatable into AI coding, and are key

10:50

for producing great outputs. If you're

10:52

into that, then you should definitely

10:53

check it out.

10:55

But, if you're not, thanks for watching

10:56

anyway. I really appreciate you. I would

10:58

love it if you could test out this init

10:59

script as well, and tell me in the

11:01

comments how you got on. And hopefully,

11:02

hello Claude code team, this was useful

11:04

feedback to you if you want to improve

11:06

it further. Make it less sycophantic,

11:08

make it more proactive in suggesting

11:10

skills, and make it provide the steel

11:12

man argument against why it should

11:13

include things in claw.md. Thanks for

11:15

watching, and I'll see you in the next

11:16

one.

Interactive Summary

The video documents an assessment of the updated 'init' command for Claude Code, which aims to help developers set up their repositories with minimal Claude.md configuration and specialized skills. The creator tests the new version, focusing on the importance of progressive disclosure and maintaining a strict 'instruction budget' for the LLM to ensure performance. Throughout the process, the creator critiques the tool's tendency toward sycophancy, its UI, and the redundancy of certain instructions, concluding that while this version is an improvement over the previous one, there is still room for better, more proactive, and more critical LLM interactions.

Suggested questions

3 ready-made prompts