YouTube Deep SummaryYouTube Deep Summary

Star Extract content that makes a tangible impact on your life

Video thumbnail

Claude Code - 47 PRO TIPS in 9 minutes

Greg Baugues • 2025-05-22 • 9:19 minutes • YouTube

📚 Chapter Summaries (12)

🤖 AI-Generated Summary:

Основные выводы и инсайты

  • Claude Code — мощный CLI-инструмент для написания кода, который можно интегрировать с другими командными утилитами и запускать с аргументами.
  • Работа с изображениями в Claude Code упрощает создание интерфейсов и обратную связь через скриншоты, которые можно вставлять вручную или автоматизировать через Puppeteer MCP сервер.
  • MCP (Modular Code Protocol) серверы позволяют интегрировать Claude Code с базами данных, API и документацией, расширяя возможности разработки.
  • Файл claude.md — ключевой элемент, задающий контекст и правила работы с проектом, который загружается при каждом запросе к Claude Code.
  • Слэш-команды (slash commands) — шаблоны запросов, которые можно настраивать и запускать с параметрами для автоматизации типовых задач.
  • Важно активно управлять контекстом и сессиями: использовать отмену, прерывать генерацию, регулярно коммитить изменения в систему контроля версий.
  • Мониторинг использования токенов и управление затратами — необходимая практика, особенно при оплате за токены. Интеграция с системами мониторинга (например, Data Dog) помогает контролировать расходы.
  • Обновление до тарифных планов Claude Max значительно снижает стоимость использования.

Практические стратегии

  • Использовать командную строку для запуска Claude Code с параметрами, в том числе в headless режиме (-p).
  • Вставлять изображения в терминал (через drag-and-drop или сочетания клавиш) для передачи макетов и обратной связи.
  • Настроить Puppeteer MCP сервер для автоматического снятия скриншотов и интеграции с Claude Code.
  • Создавать и регулярно обновлять claude.md с инструкциями по проекту, стилю кода, тестированию и др. Использовать команду /init для автоматического создания файла.
  • Создавать слэш-команды для часто повторяющихся задач (рефакторинг, линтинг, ревью PR) и запускать их с параметрами.
  • Часто прерывать генерацию (клавиша Escape), отменять последние действия и возвращаться к предыдущим версиям.
  • Интегрировать Claude Code с Git и GitHub CLI для управления версиями и автоматизации PR, ревью, коммитов.
  • Следить за индикатором автокомпактизации контекста, выполнять компактирование на естественных точках завершения задач, а при необходимости очищать память.
  • Использовать внешнюю память (GitHub Issues, scratchpads) для планирования работы и снижения нагрузки на контекст.
  • При оплате за токены отслеживать расход и анализировать данные через OpenTelemetry и системы мониторинга.
  • Рассмотреть переход на подписку Claude Max для снижения стоимости и расширения возможностей.

Конкретные детали и примеры

  • Вставка изображений на Mac: drag-and-drop или Shift+Command+Control+4 для скриншота + Control+V для вставки.
  • Использование Puppeteer MCP сервера для автоматизации сбора скриншотов приложения.
  • Пример использования MCP сервера Postgres для прямой работы с базой данных.
  • Пример создания игры Bluey Uno, где правила подтянулись с сайта unorules.com.
  • Команда /init для создания файла claude.md с обзором структуры проекта.
  • Стоимость использования Claude Code: около $150 за 3 дня на тарифе $100 Claude Max.
  • Возможность использовать GitHub MCP сервер вместо установки GitHub CLI.
  • Инструмент Anthropic prompt optimizer для улучшения claude.md.

Предупреждения и типичные ошибки

  • Не перегружать claude.md избыточной или повторяющейся информацией — это ухудшает качество работы модели.
  • Не бояться прерывать генерацию Claude Code при ошибках — это улучшает результативность сессий.
  • Избегать чрезмерной амбициозности Claude Code, которая приводит к сложным для отката изменениям.
  • Всегда использовать систему контроля версий и часто делать коммиты, чтобы легко откатываться.
  • Следить за использованием токенов, чтобы не переплатить.
  • Не забывать регулярно очищать или компактировать контекст, чтобы избежать потери производительности.
  • Не полагаться только на внутреннюю память сессии — использовать внешние инструменты для хранения данных.

Ресурсы и дальнейшие шаги

  • Статья Бориса Чёрни (Boris Churnney) — основной источник советов (ссылка в описании видео).
  • Anthropic prompt optimizer — инструмент для оптимизации claude.md.
  • Puppeteer MCP сервер — для автоматизации скриншотов.
  • Интеграция с Data Dog через OpenTelemetry для мониторинга использования.
  • Использование GitHub CLI и GitHub MCP сервер для работы с репозиториями.
  • Подписка Claude Max для экономии на токенах и увеличения лимитов.
  • Рекомендуется изучить подробнее документацию по MCP серверам и слэш-командам.

Основные темы видео

  • Работа с Claude Code как CLI-инструментом
  • Использование и вставка изображений в терминал
  • Автоматизация через MCP серверы и Puppeteer
  • Настройка и поддержка файла claude.md для контекстных подсказок
  • Создание и использование слэш-команд для типовых задач
  • Советы по управлению сессиями и контекстом
  • Интеграция с Git и GitHub для контроля версий и ревью кода
  • Управление затратами и мониторинг использования токенов
  • Лучшие практики и рекомендации по работе с Claude Code

📝 Transcript Chapters (12 chapters):

📝 Transcript (229 entries):

Hey, my name is Greg. I'm a developer and over the last few months, Claude Code has become my default way of writing code. And so in this video, I want to walk you through some Claude Code pro tips. These pro tips are primarily based on this post written by Boris Churnney, who's the creator of Claude Code at Enthropic. And we're going to go through these uh pro tips pretty quickly. First tip, cla code is a CLI. So all the things that you're used to doing with other bashbased CLIs, you can probably do with cloud code. For instance, you can pass in command line arguments which will be run on startup. You can use -p to run it in headless mode. You can chain it with other command line tools. You can pipe data into it. You can run multiple instances of it at once. You can actually have cloud code launch instances of claude code. In fact, anytime you ask it to spin up a sub agent or anytime you see task, that's exactly what clog code is doing. Next category, images. You can use an image simply by dragging it in to the terminal on OSX. You can use shift command control 4 to copy the screenshot and then use controlV to paste it into claude. That's controlV, not commandV like you're used to. There's two ways that you might find yourself using images a lot. The first is mockups. You can design a mockup, paste the mockup into Claude, and then ask it to build that interface. Second, you can use images to close the feedback loop with Claude. Ask it to build something, open up what it built, and then take a screenshot, feed that back into Claude, and it's pretty good at iterating when you're giving it feedback. Now, that's a manual process for taking images. You can also automate the screenshotting by using the Puppeteer MCP server, which is pretty easy to set up and run locally. Then you can ask Claude to use Puppeteer to go open up the app, take a screenshot of it, and it can save those screenshots to your local directory. Speaking of MCP service, Cloud Code can function as both an MCP server and an MCP client. So that means that you can actually turn clogged code into an MCP server that can then be used by other agents. There's a whole bunch of MCP servers that you could use. It would be a whole video on its own just to go through some of the most popular ones. So we'll just hit a couple. For instance, you might find it useful to use the Postgres server to hook up Cloud Code directly to your database. You can use MCP servers that are effectively wrappers around APIs. Other dev tool companies like Cloudflare are using their MCP servers to provide up-to-date documentation to Claude. Not all dev tool companies are making their docs available via MCP just yet. So if you just paste in a link, Claude code can fetch that URL and then use those docs to build against. You might also want to use fetch URLs to retrieve knowledge from the world that you use in your app. For instance, I built a game for my four-year-old daughter that was uh Bluey Uno. Instead of trying to describe the rules myself or relying on the training data for Uno rules, I pasted in unorules.com and had Claude code the gaming logic based on what it read there. Next category, claude.mmd. This is actually the first pro tip that's mentioned in Boris's post. A claw.md is a prompt that is loaded with every request that you make to claude code. This might include instructions for your project such as common bash commands to use, style guidelines, linting guidelines, how to run your tests, repository etiquette. If you type /init after you launch claude in a directory, it will create this claude. MD file for you after scanning the directory and summarizing its structure. If as you're coding you want to add instructions to the cloud.MD, you can use the hash sign. You can also set a global cloud. MD in your home directory/cloud. This will be loaded anytime that you're using cloud code across any project. You can also add a cloud.md file in subdirectories. You should also refactor your cla.md files often. So, it's common for them to grow in complexity as you continue to work on a project. But remember that this is a prompt that is being loaded on every turn of conversation with clawed code. And these models do much better the more specific you are. So, you don't want this to be crammed with a bunch of duplicative extraneous information. You can use Anthropic's prompt optimizer tool to help you write better cla.md files. Slash commands. You can define these in thecloud/comands folder, and they're just prompts. So, for instance, here's one mentioned in Boris's post about solving GitHub issues. You might write a slash command for refactoring. You might write a slash command for linting. You might write a slash command for reviewing a PR. slash commands are prompt templates. So you can pass command line arguments when you run the slash command that will then be interpolated into the prompt template. Couple of UI tips. One, you can use tab to complete files and directories. Cloud code does better the more specific you are. So if you can actually let it know what files or what directories to work with, you'll generally get better results. Hit escape often. I know that I when I started was hesitant to interrupt Claude when I saw it going off path, but you will find your sessions go so much better if you just stop Claude as soon as you see it go in the wrong direction. You can hit escape and ask it to undo its work from the previous turn. And that will help you go back as well. Speaking of undoing Claude's work, I think the biggest failure mode here when working with Cloud Code is you use it to build a project. You get that project to a place where it's working really well, and then it gets overly ambitious, does a bit too much, makes breaking changes, and then you have a hard time rolling them back. And the easiest way to mitigate this failure state is to use Cloud Code in conjunction with version control. Ask Cloud Code to commit after every major change. Have Claude Code write your commit messages. there's a good chance they'll be the best commit messages that have ever been submitted to a repository that you own. When working with Claude code, revert more often than what you're used to. Often times, the best way to fix things is just to clear out the conversation history in Claude, revert back to a previous save point, and try again with slightly more specific instructions. Install the GitHub CLI, and it will use this for all of its interactions with GitHub. If for some reason you don't want to install this tool, you can also interact with GitHub via the GitHub MCP server. You can have Cloud Code file PRs for you. You can have Claude Code do code reviews on those PRs. Managing context can certainly be a bit of a challenge when working with Claude Code. You want to always keep an eye on the auto compacting indicator. You always want to know about how long you have until Claude autoco compacts. prematurely compact when you're at natural break points. So if you see you're 35% of the way to autoco compacting and you just finished up a task, you just made a commit, you might just want to go ahead compact right there and start the next task with all of the tokens available to you. Also consider often clearing instead of compacting. Work in such a way that you can use claude code with fresh memory. One way to do this is to tell Claude to use scratchpads to plan its work. Alternative to Scratchpads, you can use GitHub issues. If you are paying per token, then you're going to really want to monitor that uh context window usage and you're going to want to use external memory as much as possible. If you're looking for more robust cost tracking across a team, for instance, one way to achieve that is by using Cloud Code's open telemetry support. So, for instance, you could hook up Claude Code to Data Dog and produce dashboards that look like this. And for more details on this, you should check out Martin AMP's blog post, which is linked in the description. But in my opinion, the best way to manage your cost is just to upgrade to one of those Claude Max plans at either $100 or $200. I'm on the $100 plan. I spent about $150 worth of Claude Code tokens over the course of about 3 days. If there's a common complaint of Claude Code, it is it's very expensive. So, I was very excited to see Claude Code use bundled in with Claude Max. I don't even know if I got through half of the pro tips that are included in this post. If you want to learn more, uh, check out this excellent post here by Boris and check out some of the other links that I left below in the description.