- Claude Code functions as an AI coding assistant, embodying a "pure agent" model that leverages powerful tools and instructions to operate in a loop, akin to an expert co-worker skilled in terminal commands.
- Instead of traditional code indexing, it understands codebases through "agentic search," dynamically exploring files using tools like
grepandfind, similar to how a human developer would. - Best practices include using
claude.mdfiles for persistent context and instructions, intelligently managing permissions, integrating with CLI tools, and actively managing the AI's context window.
Claude Code best practices | Code w/ Claude
- Mental Model: Conceive of Claude Code as a "terminal whiz" co-worker who never uses a GUI, performing all tasks via command-line tools.
- Agentic Architecture: Claude Code operates as a "pure agent" with instructions and tools that run in a loop. It employs "agentic search" (e.g.,
glob,grep,find) to explore codebases on the fly, avoiding prior indexing or embedding. - Versatile Use Cases: Leverage Claude Code for supercharging codebase discovery and onboarding, acting as a thought partner to plan features or debug, writing new code (especially unit tests and commit/PR messages), supporting deployments via SDK, and assisting with large-scale migrations or debugging CLI tools like Git or Docker.
- Context Management with
claude.md: Utilizeclaude.mdfiles in your project or home directory to provide Claude with persistent instructions, style guides, project overviews, or test-running commands. These files are automatically loaded into the agent's context. - Smart Permission Handling: Configure permissions to speed up workflow by auto-accepting routine commands (e.g.,
npm run test), but retain manual approval for actions that modify files or run potentially dangerous bash commands. UseShift+Tabfor auto-accept mode. - Tool Integration: Enhance Claude Code's capabilities by installing more CLI tools (e.g., GitHub's
gh) or attaching MCP servers, making it effective with a wider range of external services and internal tools. - Context Window Management: Monitor the context window warning. Use
/clearto start a session fresh, or/compactto generate a summary of the current conversation, effectively seeding a new session to continue a long task without exceeding token limits. - Efficient Workflow Strategies: Encourage planning by asking Claude to develop a plan before executing code (e.g., "figure out what's causing this bug and tell me a plan to fix it"). Use the built-in to-do list feature, implement "Smart Vibe Coding" with TDD, linting, and regular commits, and use screenshots for guiding or debugging multimodal tasks.
- Advanced Techniques: Experiment with running multiple Claude instances simultaneously, use
Escapeto pause and interject (double-escape to jump back in the conversation history), expand tools using MCP servers, and explore headless automation via the SDK for programmatic integration in CI/CD pipelines. - Stay Updated: Regularly check the Anthropic Claude Code GitHub project's changelog for new features, models (
/model), configurations (/config), and improvements like Claude 4's ability to "think hard" between tool calls and new IDE integrations (VS Code, JetBrains).
agent — An AI system designed with a set of instructions and tools that operates in a continuous loop to achieve a defined goal.
agentic search — A dynamic search process where an AI model iteratively performs searches, analyzes results, and decides whether further searches are needed based on its findings.
glob — A pattern used in Unix-like shell commands to match file paths or names (e.g., *.txt).
grep — A command-line utility used to search for specific text patterns within files.
claude.md — A special Markdown file used by Claude Code to store persistent instructions, context, or project information that is automatically loaded into the agent's prompt.
context window — The maximum amount of input text (measured in tokens) that an AI model can process and "remember" at any given moment.
tokens — The fundamental units of text (e.g., words, sub-words, punctuation) that large language models process.
headless automation — Running a software application or process without a graphical user interface, typically for programmatic control or integration into other automated systems.
MCP server — A mechanism or server used to extend Claude Code's capabilities by integrating additional or custom tools and functionalities.
rebase — A Git command that rewrites the commit history of a branch to integrate changes from another branch, often used to create a linear history.
Let's get started welcome everyone to Claude Code best practices in this talk I'm going to talk about kind of what Claude Code is at a high level then we'll peer under the hood a little bit to kind of understand How Claude Code works and then knowing that because it's useful to kind of know how your tools work We're going to talk about good use cases for Claude Code and also best practices We've figured out both internally and And from our users for getting the most out of this tool But before I get started like to introduce myself real quick and talk about how I ended up on the stage So my name's Cal and I joined in Theropik about a year and a half ago To help start up a team we call a pladei And it's the apply day eyes kind of mission our teams mission is to help our customers and partners Build great products and features on top of Claude So what that really means is I spend a lot of my day Prompting Claude to get the absolute best outputs out of these models That said I also love to code and I'm definitely one of those coders that like starts a lot of projects Has some crazy idea and they just never finishes them So I have this graveyard of just like code that I started never really finished But I'm always spinning new things up and late last year I was in Slack and I was hearing about this new tool that a few people are using they're saying it was really cool And so on a Friday night I downloaded the tool that would become Claude Code And I threw it at this kind of new note taking app that I wanted to build and Like that whole weekend just kind of totally changed the way that I code and think about software engineering I was carrying around my laptop with me all weekend I was super addicted to just watching Claude Code work and I would press enter and I'd switch over to my browser and Refresh and I watched this huge powerful Application come together in front of my eyes and I got way farther into this thing than I ever would have on my own and it just blew my mind And while I was doing this I was a little worried I was like, you know, I you know I kind of know how these things works I'm like man I'm using a lot of tokens I hope I don't get in trouble or anyone like notices. I'm not really contributing to an anthropic code But what I didn't know is that the Claude Code team had built this internal like leaderboard Tracking how much all the anthropic employers were using this and over the weekend I had shot to the top And so through that I got to meet Boris and cat and some of the early Claude Code team and I was able to start talking to them and say Hey, I love this tool. I also know a lot about prompting. Can I help you all out? And so through that I got involved and now I'm one of the core contributors on the team And I do a lot of I work a lot on the prompting the system prompts how the tools work the tool descriptions And tool results as well as I work on how we evaluate this tool So when we think about changing the prompts how do we make how do we know we made things better or the same and we didn't totally room Claude Code So with that said, let's kind of dive in So here's my current mental model of Claude Code and how I describe it to people when people ask me Claude Code is like that co-worker that does everything on the terminal So sort of person that just never touches the gooey. They're a whiz I think of when I was a junior engineer I had this mentor and I would walk over his desk and I would say hey Tony Can you help me with this bug and you whip it over his terminal and you'd be like doing all these crazy commands and changing things around at VIM and I'd always walk away thinking wow that was crazy I should learn how to do that I never did But having Claude Code on your computer is kind of like having Tony next to all the time So how does Claude Code kind of work under the hood? At Anthropic we try to always do what we call the simple thing that works And what that means for Claude Code is it's what we would consider a very pure agent And Anthropic when we talk about agents what we really mean is Some instructions some powerful tools and you let them all just run in a loop until it decides it's done And that's really what Claude Code is So it's tools powerful tools and the tools that you know someone that was really good in a terminal would be able to use tools to create and edit files To use the terminal and then you can also do things like pull in other things with mcp Now on top of that There's how Claude understands the code base And if you're going to build a coding agent or a coding tool a year ago You'd probably have ideas like well, okay, I'm going to get this user message About something about this code base and I'll need to figure out which files are relevant So maybe I'll like index the whole code base and embed it and do this fancy like kind of rag retrieval thing That is not how Claude Code works We don't do any sort of indexing instead Claude Kind of explores and understands the code base How you if you were new to a team and new to a code base would explore code base And that is through a gentic search As the same sort of search tools you or I would use things like glob and grep and find and it can work its way through a code base And understand what's going on And when we talk about a gentic search that really means the model can go do some searches And then it can look at the resulting to say Maybe I need to figure out a few more things. I'm going to go do some more searching and then come back And then on top of these primitives on top of this agent We have a few things. We have a very nice light UI layer Where you get a watch, Claude code work. You see all the text fly by And we have this nice permission system that allows the agent to work And allows and kind of forces the human to button when the agent is doing something dangerous And then on top of that we also care a lot about security in this tool And so because Claude code is just such a lightweight kind of Layer on top of the model and the fact that our model is available not just behind anthropic APIs But also with our cloud providers AWS and gcp It's very easy and native to point Claude code at one of these other services if you feel more comfortable consuming Claude that way Now a lot of people ask me hey, Kel what can I use Claude code for like what is it good at? Where is it interesting? And the reality is it's kind of great at everything So let's start with discovery Oftentimes in your career you will Be dropped into a new code base whether it means you're switching teams, you're switching companies I don't know you're starting to work on some sort of open source project And probably when you're first getting started and getting familiar Not very productive because you're just trying to figure out where things are in the code base What patterns kind of the team is using things like that And Claude code can kind of help supercharge that onboarding process You can ask Claude hey, where is this feature implemented? Or since it's great at the terminal You can say hey look at this file and look at the git history And just kind of tell me a story about how this code has changed over the past couple weeks One thing you can use Claude code for and I think this is underrated Is instead of just diving in and starting to work You can use Claude code as a thought partner So oftentimes when I'm working with Claude And I want to implement a feature or we're going to change something up Open up Claude and say hey Claude I'm thinking about implementing this feature Can you just kind of like search around and kind of figure out how we would do it And maybe report back with like two or three different options Don't start working, don't start running any files, writing any files yet And Claude will go off and use those agentic search capabilities And come back with a few ideas And then I can work with Claude to kind of validate things And then we can jump into the project Of course Claude code is great at building and writing code And I would say this in two different fronts One it can do the zero to one sort of stuff You drop it in an empty directory and you say hey Build me an app, build me a game That demos were very well, it's very fun to do, it's very gratifying Of course in reality what really matters is Is Claude code good working in existing code bases And this is primarily what we focus on And the Claude code team, we have in our code base Abnormally high I would say unit test coverage And that's because Claude code makes it so easy And just straightforward to add unit tests So we have great code coverage And then the other thing we have in Claude code in our own code base Is we have great commits in PR messages Because when we finish working we'll just say hey Claude write the commit for me Write the PR message for me We also see great opportunities to use Claude code in kind of the deployment like Deployments and in other parts of the lifecycle And this is a few other people have talked about this But this is using the Claude code SDK So using it headlessly, using it programmatically Being able to sprinkle in a coding agent Agent anywhere And so that's things like sprinkling it into CICD To use it in GitHub for instance To help people programmatically And then finally it's great kind of with support and scale It can help you debug Heirs faster One thing that we saw when we started giving Claude code to customers And talking them about it We didn't totally predict this It was a lot of customers Or potential customers said hey we've been We've been kind of putting off this like large code base migration People that are on old versions of Java trying to get it to a new one Or a team that's on PHP and they're trying to get to reactor angular We've talked to multiple teams like this And having a tool like Claude code Makes projects like that a little more digestible When you go to your team you say hey we're going to spend a month You know refactoring or rewriting large parts of the code base And then on top of that and this kind of matters across All these is once again remember Claude is great at the terminal And that means it's going to be great at all those different CLI tools Things like Git, Docker, BigQuery, things like that I never have to worry about oh I'm going to get myself How do I get myself out of this sticky rebase I'll just fire up Claude code and tell it the situation And be like hey can you fix this for me It's incredible Now let's talk about best practices And the first one is not going to be a surprise But the first one is use CLAUDE.md files So remember that Claude code like I said Is an agent and it has some tools It has some lightweight instructions in the prompt But it doesn't really have memory And so the main way we share state across kind of sessions Or across our team when we fire up Claude code And the same code base over and over again Is this CLAUDE.md file So when we start Claude What happens is if there's this CLAUDE.md file in the working directory It's just plopped into context It's plopped into the prompt And basically what it says is Hey Claude by the way, these are important instructions The developer let for you Be sure to pay close attention to this And there's various places you can put the CLAUDE.md file You can put in a project And check it in So all your teammates share it You could put one in your home directory If there's things you just want Claude to always know about Regardless of what you're working on And the things you put in here are things like Hey by the way Maybe this is how you run the unit test Or just so you know to make kind of your searching and life easier Here's like just like an overview of kind of how this project is laid out Where the tests live What different modules are things like that Or here's our style guide All sorts of things like that To just make Claude's life a bit easier And you can build these things up over time The other thing you can do Which is important is permission management When you're running Claude code There's all sorts of different kind of permission things flying by Kind of out of the box What happens when you start our tool Is for read actions If Claude is searching or reading We just let it go But once it starts writing Or running bash commands Or doing things that could change Change stuff on your machine potentially That's when we kick in this UI And it says something like Yes Yes always allow this Or no I want to do something else And using that permission management And being smart about it Can help you work faster So there's something called auto accept mode Or if you're working with Claude code And you press shift tab Claude will just start working There's things you can do Like you can can fear Claude in the settings Where specific commands like on bash Like if you just are like tired of saying Yes run MPM run test You can just always approve that So fiddling with your permission management Is a great way to speed up your workflow Integration setup So one thing that is going to help you get the most Out of Claude code is remember That it's great at the terminal And if there's applications that you use Which have kind of a way to access them through CLI And GitHub is a great example of that That have a powerful tool called CH You can basically give more work to Claude code And you can do that either by just installing more CLI tools Or you can attach more MCP servers I would say just through experience that If you're using something like a CLI tool That's well known and well documented And you're trying to choose between the CLI tool And just installing it on your machine And grabbing an MCP server I would recommend using via CLI tool And then also if you internally have your own tools At Anthropic with something called Koo That does a whole bunch of stuff for us You can also tell Claude about that And you probably that's the sort of thing You'd put in Claude to MD And then context management So remember that Claude is an agent And when it's an eight, what it does It calls these tools And the context builds up and up over time And at least for Anthropic Our models have a context window Of 200,000 tokens And you can max this thing out So you kind of have two options When you're in a long session with Claude And you're working and you're going back and forth You'll see in the bottom right You'll start to get this little warning That'll say hey, you're starting to fill up the context window And kind of depending on what's going on You have two options You can run slash clear and just start over And that clears everything out Except for for instance, Claude.MD Or you can run slash compact And what'll happen is basically It's like a user message is inserted And it just says something like Hey, I need to go Summary's everything we've been up to I'm going to give this to another developer And they're going to pick up where I left off And then that summary is what kind of seeds the next session You can go from there We spend a lot of time tuning this kind of compact functionality So that as you max out the context window And then run compact You can start back over and keep going Efficient workflows What can you do with Claude Code And how do you get the most about it So using planning and to do As I talked a little bit about this before But one of the best things you can do Is when you open up Claude Code Instead of saying hey, I need you to fix this bug You can say hey, I have this bug Can you search around figure out what's causing it And just like tell me a plan how we're going to fix it And this can save you a lot of time Because you can verify You can read Claude's plan And you can verify what it's going to do And then the other thing that we have Is we have this to-do list feature So often when Claude's working on a big task It'll create a to-do list And if you're kind of paying attention You can kind of watch this to-do list And if you see anything kind of Weirder in there or something that doesn't make sense That's when you can press escape And say hey, Claude, let's change the to-do list I think you're on the wrong path Smart vibe coding So it's very tempting And it's very powerful to just like Claude work And press enter and see what happens at the end I think there's a few things that can help make this better And there's I think to talk later today About just this for 30 minutes But doing things like having test-driven development Having Claude makes small changes Run the tests, make sure they pass Always having Claude do things like check the TypeScript And the Linting And then commit regularly So that if it's kind of going off the rails You can always fall back and try again You can use screenshots to guide and debug So Claude is built on top of our models Which are multimodal You can always just grab a screenshot Paste it in or if you have a file somewhere That's an image, you can just say hey, Claude Look at this mocked png And then build the website for me or whatever And then advanced to make So as you're getting used to using Claude What are some things you can think about To kind of push things to the next level And one of the things we see both internally And with customers is when you've started to use this tool for a while It's going to be very tempting to use multiple Claude's at once And so I know people add Anthropic And a few customers that run four Claude's at the same time There's various ways to do this You can have it in T-Mox Or just different tabs All sorts of crazy things So I would challenge you to try getting multiple Claude's running at once And kind of be orchestrating all these things It's quite fun I can only do two But I know people that do four Use Escape So Escape is your best friend While Claude is working You can kind of keep an eye on what it's up to And you can press Escape to stop it And interject and say Hey, I think you're going on the wrong path Or I want you to do something else Knowing when the right time to press Escape is Versus just letting Claude figure it out Is key to getting the most out of the tool And there's a hidden feature Not too many people know about it But if you press Escape twice You can actually jump back in your conversation You can go back and you can kind of reset Tool expansion and MCP So this is taking into the next level If you feel like with Bash and with the tools that Claude has That it still can't do something This is when you should start looking at MCP servers And then headless automation I think this is a thing we're most excited about But also we are still trying to wrap our heads around internally Which is how can we use Claude programmatically We have that in GitHub actions We want to figure out other creative places We can start using it I would challenge you all to do the same So with that said I'm going to jump over to my computer Because there's one other best practice Which is It's always good to stay on top of everything that's new So we're shipping super fast I'm going to throw I'm just going to go over a few things that are new as of today One thing is when you're in Claude now And you fire it up You can do slash model You can see what model you're running on I'm on default which happens to be Sonic We can jump over to Opus You can do the same thing and slash config Switch it here So that's new Make sure you're running the model that works for you There's another thing that's new about these models Which is You can say something like Can you figure out what's in this project And for a long time For a while we've had this like think hard Or extended thinking Now this is great But with our past models That we won't let our model think between tool calls And that's probably when the thinking matters most So starting with Claude 4 They can now our models now think between tool calls And we can watch this happen So we have Claude in this project There's a few different files in here And I'm just going to tell it to think hard And figure out what's in this project And we can watch Claude start to work And so the way you know you triggered thinking Is you'll see kind of this lighter gray text And then it'll call some file It'll call some tools It'll read some stuff And then we see some more thinking And this is awesome So I encourage you when you're working on tasks And solving bugs Throw a think hard in there And then the other thing And you know what We'll just throw it up real quick Is I have this in VS Code But of course this is in JetBrains as well But we have these new great integrations With VS Code and JetBrains We can do things like Clouds going to know what file I'm in What file I'm in That is not what I meant to say But Clouds going to figure it out And you can do things like this So these are the sort of things I would encourage you to stand top of We have a public kind of GitHub project Called Claude Code under Anthropic You can post issues there But we also post our change log there And so I check this once a week And make sure that I'm on top of all the new stuff For shipping Because even I can't keep up with it So with that said We have like four minutes left I'm having to answer questions About anything Claude Code related We have it here I can live demo some stuff if you're interested Let's do a few Thanks real quick This might be obvious But multiple CLAUDE.md files In a project I presume that's possible And it just figures it out or no So there's a few options Of course like In the same directory You couldn't But you could have one here And one in the sub directory And I think we changed this So that all the sub directory ones aren't read in Because like Anthropic we have a monorepo And people would open it at the top And blow up their context with all the CLAUDE.mds So we encourage Claude When it's searching around And it discovers CLAUDE.md files in Child directories that are relevant To be sure to read them But by default It just reads the CLAUDE.md file And the current working directory When you fire it up And then also you can set one in like your home directory There are things you can do though We have this new thing Like in your CLAUDE.md you can start referencing other files So you could for instance Do something like this with an at sign If you have other CLAUDE.md files That you just kind of know you always want to read in To do something like that Hi okay I have not had luck getting Claude to respect my CLAUDE.md Like there's one thing particular Yes Where I'll ask a refactor something And then it will leave in line comments Explaining the what Of it is And it's like something that's extremely obvious And so I'll tell it like Go and remove any in line comments That describe the what of what's happening And then it will remove it And then immediately do it again And like the same pass So do you have any strategies for dealing with that So there's kind of two things that fix that So that was actually kind of a model problem There's nothing in the prompt We have actually a lot in the prompts For 3.7 that said Whoa do not leave comments And despite that the model just loves to leave comments So it doesn't surprise me that your CLAUDE.md didn't help much Either we already did a lot I did a lot of work to try to tamp it down From what happens out of the box So we mostly fix that in Claude 4 Now there might be some new weird behavior quirks But the other thing we made better in Claude 4 Is it's just better at following instructions And we've gotten a lot of feedback from early testers That all of a sudden, whoa My CLAUDE.md is being followed way more closely And it might be a good chance to go look in your CLAUDE.md And decide do I still need this stuff Maybe I can take some of it out Maybe I need to add a few new things So moving over to the new miles Might be a good time to take another look at what's in there And see what you need and what maybe can go For the record, I'm trying to think of something that you might not have thought of Doing multi-agent execution and parallelization Can you make it to that for four agents say agents two and three use the context for agent one Maybe agent four uses the context for agent two at a certain point Yeah Yeah, etc That's interesting, we're trying to... So like I said at the beginning We're trying to do the simple thing that works It was just one agent that's great at coding and does everything I think we want to figure that out Probably what's going to happen is if you wanted to do that You would ask all your agents to probably like write to a shared markdown file Or something like that so they can all kind of like check in and communicate Sometimes like I'll be working with CLAUDE.md or Claude And I'll just say like Hey, I need you to write some stuff in like ticket.MD for another developer And then I'll fire up another Claude Code And I'll be like hey, read ticket.MD like Another developer left this note for you Like this is what you're going to work on So think about trying to write that state to a file And then just kind of like count on the model's ability To just like read files and make sense them It's probably the best you can do today And maybe we'll figure out clever ways to expose that In the product is something more native Cool All right And with that said I have some rare Claude code stickers that found in my backpack So come find me. I'll be hanging out over there something Happy to share it and thank you
TL;DR
- Claude Code functions as an AI coding assistant, embodying a "pure agent" model that leverages powerful tools and instructions to operate in a loop, akin to an expert co-worker skilled in terminal commands.
- Instead of traditional code indexing, it understands codebases through "agentic search," dynamically exploring files using tools like
grepandfind, similar to how a human developer would. - Best practices include using
claude.mdfiles for persistent context and instructions, intelligently managing permissions, integrating with CLI tools, and actively managing the AI's context window.
Takeaways
- Mental Model: Conceive of Claude Code as a "terminal whiz" co-worker who never uses a GUI, performing all tasks via command-line tools.
- Agentic Architecture: Claude Code operates as a "pure agent" with instructions and tools that run in a loop. It employs "agentic search" (e.g.,
glob,grep,find) to explore codebases on the fly, avoiding prior indexing or embedding. - Versatile Use Cases: Leverage Claude Code for supercharging codebase discovery and onboarding, acting as a thought partner to plan features or debug, writing new code (especially unit tests and commit/PR messages), supporting deployments via SDK, and assisting with large-scale migrations or debugging CLI tools like Git or Docker.
- Context Management with
claude.md: Utilizeclaude.mdfiles in your project or home directory to provide Claude with persistent instructions, style guides, project overviews, or test-running commands. These files are automatically loaded into the agent's context. - Smart Permission Handling: Configure permissions to speed up workflow by auto-accepting routine commands (e.g.,
npm run test), but retain manual approval for actions that modify files or run potentially dangerous bash commands. UseShift+Tabfor auto-accept mode. - Tool Integration: Enhance Claude Code's capabilities by installing more CLI tools (e.g., GitHub's
gh) or attaching MCP servers, making it effective with a wider range of external services and internal tools. - Context Window Management: Monitor the context window warning. Use
/clearto start a session fresh, or/compactto generate a summary of the current conversation, effectively seeding a new session to continue a long task without exceeding token limits. - Efficient Workflow Strategies: Encourage planning by asking Claude to develop a plan before executing code (e.g., "figure out what's causing this bug and tell me a plan to fix it"). Use the built-in to-do list feature, implement "Smart Vibe Coding" with TDD, linting, and regular commits, and use screenshots for guiding or debugging multimodal tasks.
- Advanced Techniques: Experiment with running multiple Claude instances simultaneously, use
Escapeto pause and interject (double-escape to jump back in the conversation history), expand tools using MCP servers, and explore headless automation via the SDK for programmatic integration in CI/CD pipelines. - Stay Updated: Regularly check the Anthropic Claude Code GitHub project's changelog for new features, models (
/model), configurations (/config), and improvements like Claude 4's ability to "think hard" between tool calls and new IDE integrations (VS Code, JetBrains).
Vocabulary
agent — An AI system designed with a set of instructions and tools that operates in a continuous loop to achieve a defined goal.
agentic search — A dynamic search process where an AI model iteratively performs searches, analyzes results, and decides whether further searches are needed based on its findings.
glob — A pattern used in Unix-like shell commands to match file paths or names (e.g., *.txt).
grep — A command-line utility used to search for specific text patterns within files.
claude.md — A special Markdown file used by Claude Code to store persistent instructions, context, or project information that is automatically loaded into the agent's prompt.
context window — The maximum amount of input text (measured in tokens) that an AI model can process and "remember" at any given moment.
tokens — The fundamental units of text (e.g., words, sub-words, punctuation) that large language models process.
headless automation — Running a software application or process without a graphical user interface, typically for programmatic control or integration into other automated systems.
MCP server — A mechanism or server used to extend Claude Code's capabilities by integrating additional or custom tools and functionalities.
rebase — A Git command that rewrites the commit history of a branch to integrate changes from another branch, often used to create a linear history.
Transcript
Let's get started welcome everyone to Claude Code best practices in this talk I'm going to talk about kind of what Claude Code is at a high level then we'll peer under the hood a little bit to kind of understand How Claude Code works and then knowing that because it's useful to kind of know how your tools work We're going to talk about good use cases for Claude Code and also best practices We've figured out both internally and And from our users for getting the most out of this tool But before I get started like to introduce myself real quick and talk about how I ended up on the stage So my name's Cal and I joined in Theropik about a year and a half ago To help start up a team we call a pladei And it's the apply day eyes kind of mission our teams mission is to help our customers and partners Build great products and features on top of Claude So what that really means is I spend a lot of my day Prompting Claude to get the absolute best outputs out of these models That said I also love to code and I'm definitely one of those coders that like starts a lot of projects Has some crazy idea and they just never finishes them So I have this graveyard of just like code that I started never really finished But I'm always spinning new things up and late last year I was in Slack and I was hearing about this new tool that a few people are using they're saying it was really cool And so on a Friday night I downloaded the tool that would become Claude Code And I threw it at this kind of new note taking app that I wanted to build and Like that whole weekend just kind of totally changed the way that I code and think about software engineering I was carrying around my laptop with me all weekend I was super addicted to just watching Claude Code work and I would press enter and I'd switch over to my browser and Refresh and I watched this huge powerful Application come together in front of my eyes and I got way farther into this thing than I ever would have on my own and it just blew my mind And while I was doing this I was a little worried I was like, you know, I you know I kind of know how these things works I'm like man I'm using a lot of tokens I hope I don't get in trouble or anyone like notices. I'm not really contributing to an anthropic code But what I didn't know is that the Claude Code team had built this internal like leaderboard Tracking how much all the anthropic employers were using this and over the weekend I had shot to the top And so through that I got to meet Boris and cat and some of the early Claude Code team and I was able to start talking to them and say Hey, I love this tool. I also know a lot about prompting. Can I help you all out? And so through that I got involved and now I'm one of the core contributors on the team And I do a lot of I work a lot on the prompting the system prompts how the tools work the tool descriptions And tool results as well as I work on how we evaluate this tool So when we think about changing the prompts how do we make how do we know we made things better or the same and we didn't totally room Claude Code So with that said, let's kind of dive in So here's my current mental model of Claude Code and how I describe it to people when people ask me Claude Code is like that co-worker that does everything on the terminal So sort of person that just never touches the gooey. They're a whiz I think of when I was a junior engineer I had this mentor and I would walk over his desk and I would say hey Tony Can you help me with this bug and you whip it over his terminal and you'd be like doing all these crazy commands and changing things around at VIM and I'd always walk away thinking wow that was crazy I should learn how to do that I never did But having Claude Code on your computer is kind of like having Tony next to all the time So how does Claude Code kind of work under the hood? At Anthropic we try to always do what we call the simple thing that works And what that means for Claude Code is it's what we would consider a very pure agent And Anthropic when we talk about agents what we really mean is Some instructions some powerful tools and you let them all just run in a loop until it decides it's done And that's really what Claude Code is So it's tools powerful tools and the tools that you know someone that was really good in a terminal would be able to use tools to create and edit files To use the terminal and then you can also do things like pull in other things with mcp Now on top of that There's how Claude understands the code base And if you're going to build a coding agent or a coding tool a year ago You'd probably have ideas like well, okay, I'm going to get this user message About something about this code base and I'll need to figure out which files are relevant So maybe I'll like index the whole code base and embed it and do this fancy like kind of rag retrieval thing That is not how Claude Code works We don't do any sort of indexing instead Claude Kind of explores and understands the code base How you if you were new to a team and new to a code base would explore code base And that is through a gentic search As the same sort of search tools you or I would use things like glob and grep and find and it can work its way through a code base And understand what's going on And when we talk about a gentic search that really means the model can go do some searches And then it can look at the resulting to say Maybe I need to figure out a few more things. I'm going to go do some more searching and then come back And then on top of these primitives on top of this agent We have a few things. We have a very nice light UI layer Where you get a watch, Claude code work. You see all the text fly by And we have this nice permission system that allows the agent to work And allows and kind of forces the human to button when the agent is doing something dangerous And then on top of that we also care a lot about security in this tool And so because Claude code is just such a lightweight kind of Layer on top of the model and the fact that our model is available not just behind anthropic APIs But also with our cloud providers AWS and gcp It's very easy and native to point Claude code at one of these other services if you feel more comfortable consuming Claude that way Now a lot of people ask me hey, Kel what can I use Claude code for like what is it good at? Where is it interesting? And the reality is it's kind of great at everything So let's start with discovery Oftentimes in your career you will Be dropped into a new code base whether it means you're switching teams, you're switching companies I don't know you're starting to work on some sort of open source project And probably when you're first getting started and getting familiar Not very productive because you're just trying to figure out where things are in the code base What patterns kind of the team is using things like that And Claude code can kind of help supercharge that onboarding process You can ask Claude hey, where is this feature implemented? Or since it's great at the terminal You can say hey look at this file and look at the git history And just kind of tell me a story about how this code has changed over the past couple weeks One thing you can use Claude code for and I think this is underrated Is instead of just diving in and starting to work You can use Claude code as a thought partner So oftentimes when I'm working with Claude And I want to implement a feature or we're going to change something up Open up Claude and say hey Claude I'm thinking about implementing this feature Can you just kind of like search around and kind of figure out how we would do it And maybe report back with like two or three different options Don't start working, don't start running any files, writing any files yet And Claude will go off and use those agentic search capabilities And come back with a few ideas And then I can work with Claude to kind of validate things And then we can jump into the project Of course Claude code is great at building and writing code And I would say this in two different fronts One it can do the zero to one sort of stuff You drop it in an empty directory and you say hey Build me an app, build me a game That demos were very well, it's very fun to do, it's very gratifying Of course in reality what really matters is Is Claude code good working in existing code bases And this is primarily what we focus on And the Claude code team, we have in our code base Abnormally high I would say unit test coverage And that's because Claude code makes it so easy And just straightforward to add unit tests So we have great code coverage And then the other thing we have in Claude code in our own code base Is we have great commits in PR messages Because when we finish working we'll just say hey Claude write the commit for me Write the PR message for me We also see great opportunities to use Claude code in kind of the deployment like Deployments and in other parts of the lifecycle And this is a few other people have talked about this But this is using the Claude code SDK So using it headlessly, using it programmatically Being able to sprinkle in a coding agent Agent anywhere And so that's things like sprinkling it into CICD To use it in GitHub for instance To help people programmatically And then finally it's great kind of with support and scale It can help you debug Heirs faster One thing that we saw when we started giving Claude code to customers And talking them about it We didn't totally predict this It was a lot of customers Or potential customers said hey we've been We've been kind of putting off this like large code base migration People that are on old versions of Java trying to get it to a new one Or a team that's on PHP and they're trying to get to reactor angular We've talked to multiple teams like this And having a tool like Claude code Makes projects like that a little more digestible When you go to your team you say hey we're going to spend a month You know refactoring or rewriting large parts of the code base And then on top of that and this kind of matters across All these is once again remember Claude is great at the terminal And that means it's going to be great at all those different CLI tools Things like Git, Docker, BigQuery, things like that I never have to worry about oh I'm going to get myself How do I get myself out of this sticky rebase I'll just fire up Claude code and tell it the situation And be like hey can you fix this for me It's incredible Now let's talk about best practices And the first one is not going to be a surprise But the first one is use CLAUDE.md files So remember that Claude code like I said Is an agent and it has some tools It has some lightweight instructions in the prompt But it doesn't really have memory And so the main way we share state across kind of sessions Or across our team when we fire up Claude code And the same code base over and over again Is this CLAUDE.md file So when we start Claude What happens is if there's this CLAUDE.md file in the working directory It's just plopped into context It's plopped into the prompt And basically what it says is Hey Claude by the way, these are important instructions The developer let for you Be sure to pay close attention to this And there's various places you can put the CLAUDE.md file You can put in a project And check it in So all your teammates share it You could put one in your home directory If there's things you just want Claude to always know about Regardless of what you're working on And the things you put in here are things like Hey by the way Maybe this is how you run the unit test Or just so you know to make kind of your searching and life easier Here's like just like an overview of kind of how this project is laid out Where the tests live What different modules are things like that Or here's our style guide All sorts of things like that To just make Claude's life a bit easier And you can build these things up over time The other thing you can do Which is important is permission management When you're running Claude code There's all sorts of different kind of permission things flying by Kind of out of the box What happens when you start our tool Is for read actions If Claude is searching or reading We just let it go But once it starts writing Or running bash commands Or doing things that could change Change stuff on your machine potentially That's when we kick in this UI And it says something like Yes Yes always allow this Or no I want to do something else And using that permission management And being smart about it Can help you work faster So there's something called auto accept mode Or if you're working with Claude code And you press shift tab Claude will just start working There's things you can do Like you can can fear Claude in the settings Where specific commands like on bash Like if you just are like tired of saying Yes run MPM run test You can just always approve that So fiddling with your permission management Is a great way to speed up your workflow Integration setup So one thing that is going to help you get the most Out of Claude code is remember That it's great at the terminal And if there's applications that you use Which have kind of a way to access them through CLI And GitHub is a great example of that That have a powerful tool called CH You can basically give more work to Claude code And you can do that either by just installing more CLI tools Or you can attach more MCP servers I would say just through experience that If you're using something like a CLI tool That's well known and well documented And you're trying to choose between the CLI tool And just installing it on your machine And grabbing an MCP server I would recommend using via CLI tool And then also if you internally have your own tools At Anthropic with something called Koo That does a whole bunch of stuff for us You can also tell Claude about that And you probably that's the sort of thing You'd put in Claude to MD And then context management So remember that Claude is an agent And when it's an eight, what it does It calls these tools And the context builds up and up over time And at least for Anthropic Our models have a context window Of 200,000 tokens And you can max this thing out So you kind of have two options When you're in a long session with Claude And you're working and you're going back and forth You'll see in the bottom right You'll start to get this little warning That'll say hey, you're starting to fill up the context window And kind of depending on what's going on You have two options You can run slash clear and just start over And that clears everything out Except for for instance, Claude.MD Or you can run slash compact And what'll happen is basically It's like a user message is inserted And it just says something like Hey, I need to go Summary's everything we've been up to I'm going to give this to another developer And they're going to pick up where I left off And then that summary is what kind of seeds the next session You can go from there We spend a lot of time tuning this kind of compact functionality So that as you max out the context window And then run compact You can start back over and keep going Efficient workflows What can you do with Claude Code And how do you get the most about it So using planning and to do As I talked a little bit about this before But one of the best things you can do Is when you open up Claude Code Instead of saying hey, I need you to fix this bug You can say hey, I have this bug Can you search around figure out what's causing it And just like tell me a plan how we're going to fix it And this can save you a lot of time Because you can verify You can read Claude's plan And you can verify what it's going to do And then the other thing that we have Is we have this to-do list feature So often when Claude's working on a big task It'll create a to-do list And if you're kind of paying attention You can kind of watch this to-do list And if you see anything kind of Weirder in there or something that doesn't make sense That's when you can press escape And say hey, Claude, let's change the to-do list I think you're on the wrong path Smart vibe coding So it's very tempting And it's very powerful to just like Claude work And press enter and see what happens at the end I think there's a few things that can help make this better And there's I think to talk later today About just this for 30 minutes But doing things like having test-driven development Having Claude makes small changes Run the tests, make sure they pass Always having Claude do things like check the TypeScript And the Linting And then commit regularly So that if it's kind of going off the rails You can always fall back and try again You can use screenshots to guide and debug So Claude is built on top of our models Which are multimodal You can always just grab a screenshot Paste it in or if you have a file somewhere That's an image, you can just say hey, Claude Look at this mocked png And then build the website for me or whatever And then advanced to make So as you're getting used to using Claude What are some things you can think about To kind of push things to the next level And one of the things we see both internally And with customers is when you've started to use this tool for a while It's going to be very tempting to use multiple Claude's at once And so I know people add Anthropic And a few customers that run four Claude's at the same time There's various ways to do this You can have it in T-Mox Or just different tabs All sorts of crazy things So I would challenge you to try getting multiple Claude's running at once And kind of be orchestrating all these things It's quite fun I can only do two But I know people that do four Use Escape So Escape is your best friend While Claude is working You can kind of keep an eye on what it's up to And you can press Escape to stop it And interject and say Hey, I think you're going on the wrong path Or I want you to do something else Knowing when the right time to press Escape is Versus just letting Claude figure it out Is key to getting the most out of the tool And there's a hidden feature Not too many people know about it But if you press Escape twice You can actually jump back in your conversation You can go back and you can kind of reset Tool expansion and MCP So this is taking into the next level If you feel like with Bash and with the tools that Claude has That it still can't do something This is when you should start looking at MCP servers And then headless automation I think this is a thing we're most excited about But also we are still trying to wrap our heads around internally Which is how can we use Claude programmatically We have that in GitHub actions We want to figure out other creative places We can start using it I would challenge you all to do the same So with that said I'm going to jump over to my computer Because there's one other best practice Which is It's always good to stay on top of everything that's new So we're shipping super fast I'm going to throw I'm just going to go over a few things that are new as of today One thing is when you're in Claude now And you fire it up You can do slash model You can see what model you're running on I'm on default which happens to be Sonic We can jump over to Opus You can do the same thing and slash config Switch it here So that's new Make sure you're running the model that works for you There's another thing that's new about these models Which is You can say something like Can you figure out what's in this project And for a long time For a while we've had this like think hard Or extended thinking Now this is great But with our past models That we won't let our model think between tool calls And that's probably when the thinking matters most So starting with Claude 4 They can now our models now think between tool calls And we can watch this happen So we have Claude in this project There's a few different files in here And I'm just going to tell it to think hard And figure out what's in this project And we can watch Claude start to work And so the way you know you triggered thinking Is you'll see kind of this lighter gray text And then it'll call some file It'll call some tools It'll read some stuff And then we see some more thinking And this is awesome So I encourage you when you're working on tasks And solving bugs Throw a think hard in there And then the other thing And you know what We'll just throw it up real quick Is I have this in VS Code But of course this is in JetBrains as well But we have these new great integrations With VS Code and JetBrains We can do things like Clouds going to know what file I'm in What file I'm in That is not what I meant to say But Clouds going to figure it out And you can do things like this So these are the sort of things I would encourage you to stand top of We have a public kind of GitHub project Called Claude Code under Anthropic You can post issues there But we also post our change log there And so I check this once a week And make sure that I'm on top of all the new stuff For shipping Because even I can't keep up with it So with that said We have like four minutes left I'm having to answer questions About anything Claude Code related We have it here I can live demo some stuff if you're interested Let's do a few Thanks real quick This might be obvious But multiple CLAUDE.md files In a project I presume that's possible And it just figures it out or no So there's a few options Of course like In the same directory You couldn't But you could have one here And one in the sub directory And I think we changed this So that all the sub directory ones aren't read in Because like Anthropic we have a monorepo And people would open it at the top And blow up their context with all the CLAUDE.mds So we encourage Claude When it's searching around And it discovers CLAUDE.md files in Child directories that are relevant To be sure to read them But by default It just reads the CLAUDE.md file And the current working directory When you fire it up And then also you can set one in like your home directory There are things you can do though We have this new thing Like in your CLAUDE.md you can start referencing other files So you could for instance Do something like this with an at sign If you have other CLAUDE.md files That you just kind of know you always want to read in To do something like that Hi okay I have not had luck getting Claude to respect my CLAUDE.md Like there's one thing particular Yes Where I'll ask a refactor something And then it will leave in line comments Explaining the what Of it is And it's like something that's extremely obvious And so I'll tell it like Go and remove any in line comments That describe the what of what's happening And then it will remove it And then immediately do it again And like the same pass So do you have any strategies for dealing with that So there's kind of two things that fix that So that was actually kind of a model problem There's nothing in the prompt We have actually a lot in the prompts For 3.7 that said Whoa do not leave comments And despite that the model just loves to leave comments So it doesn't surprise me that your CLAUDE.md didn't help much Either we already did a lot I did a lot of work to try to tamp it down From what happens out of the box So we mostly fix that in Claude 4 Now there might be some new weird behavior quirks But the other thing we made better in Claude 4 Is it's just better at following instructions And we've gotten a lot of feedback from early testers That all of a sudden, whoa My CLAUDE.md is being followed way more closely And it might be a good chance to go look in your CLAUDE.md And decide do I still need this stuff Maybe I can take some of it out Maybe I need to add a few new things So moving over to the new miles Might be a good time to take another look at what's in there And see what you need and what maybe can go For the record, I'm trying to think of something that you might not have thought of Doing multi-agent execution and parallelization Can you make it to that for four agents say agents two and three use the context for agent one Maybe agent four uses the context for agent two at a certain point Yeah Yeah, etc That's interesting, we're trying to... So like I said at the beginning We're trying to do the simple thing that works It was just one agent that's great at coding and does everything I think we want to figure that out Probably what's going to happen is if you wanted to do that You would ask all your agents to probably like write to a shared markdown file Or something like that so they can all kind of like check in and communicate Sometimes like I'll be working with CLAUDE.md or Claude And I'll just say like Hey, I need you to write some stuff in like ticket.MD for another developer And then I'll fire up another Claude Code And I'll be like hey, read ticket.MD like Another developer left this note for you Like this is what you're going to work on So think about trying to write that state to a file And then just kind of like count on the model's ability To just like read files and make sense them It's probably the best you can do today And maybe we'll figure out clever ways to expose that In the product is something more native Cool All right And with that said I have some rare Claude code stickers that found in my backpack So come find me. I'll be hanging out over there something Happy to share it and thank you