Назад к подкастамClaude
Claude Code skills
Создаём первый навык
So, let's create a skill.
Итак, давайте создадим skill.
This skill will teach Claude how we would like it to explain code using visual diagrams and analogies.
Этот skill научит Claude, как мы хотим, чтобы он объяснял код с помощью визуальных диаграмм и аналогий.
[music]
[музыка]
Then, we'll look at what happens under the hood when Claude uses it.
Затем мы посмотрим, что происходит под капотом, когда Claude его использует.
First, [music] let's create a directory for your skill.
Сначала, [музыка] создадим директорию для вашего skill.
We're going to be making a personal skill, so it'll live in many projects, so it will go in your home directory.
Мы создаём личный skill, поэтому он будет доступен во многих проектах и будет храниться в вашем домашнем каталоге.
Take into consideration that we're creating a directory with the skill name inside of the skills directory.
Учтите, что мы создаём директорию с именем skill внутри директории skills.
Now create the skill.
Теперь создайте skill.
The name identifies your skill.
Имя идентифицирует ваш skill.
The description tells Claude when to use it.
Описание сообщает Claude, когда его использовать.
This is the matching criteria.
Это критерий совпадения.
And then everything after the second dashes is the instructions that Claude follows.
Всё после второго разделителя это инструкции, которым следует Claude.
Cloud code loads skills at startup.
Claude Code загружает skills при запуске.
So restart your session.
Перезапустите сессию.
Then verify it's available.
Затем убедитесь, что он доступен.
You should see PR description in the list.
В списке должен появиться PR description.
Now test it.
Теперь протестируйте его.
Make some changes on a branch and say, "Write a PR description for my changes."
Внесите несколько изменений в ветку и скажите: «Напиши PR description для моих изменений.»
Claude will then show you that it's using the PR description skill.
Claude покажет, что использует skill PR description.
After that, it'll check your diff and write a description following your template.
После этого он проверит ваш diff и напишет описание в соответствии с вашим шаблоном.
Same format every single time.
Одинаковый формат каждый раз.
When Cloud Code starts, it scans four locations for skills.
При запуске Claude Code сканирует четыре места в поисках skills.
Enterprise paths, your personal Claude skills, the project's Claude skills, and installed plugins.
Enterprise-пути, ваши личные Claude skills, Claude skills проекта и установленные plugins.
It loads only the name and description of each skill, not the full content.
Загружается только имя и описание каждого skill, но не полное содержимое.
This is important later.
Это важно в дальнейшем.
When you send a request, Claude compares it to the descriptions of your skills.
Когда вы отправляете запрос, Claude сравнивает его с описаниями ваших skills.
Explain what this function does matches a skill described as explain code with visual diagrams because the intent overlaps.
«Объясни, что делает эта функция» совпадает со skill, описанным как «объяснение кода с визуальными диаграммами», потому что намерения пересекаются.
It will then ask you to confirm loading up the skill.
Затем Claude попросит подтвердить загрузку skill.
This confirmation step keeps you aware of what context Claude is using.
Этот шаг подтверждения позволяет вам знать, какой контекст использует Claude.
After you confirm, Claude reads the complete file and follows its instructions.
После подтверждения Claude читает полный файл и следует его инструкциям.
Now, let's say you clone a Git repository and have an overlapping skill name.
Теперь представьте, что вы клонируете Git-репозиторий и обнаруживаете совпадающее имя skill.
Well, which one wins?
Так какой из них победит?
Here's the priority list.
Вот список приоритетов.
The highest is enterprise, which lives in the manage settings.
Наивысший это enterprise, который находится в настройках управления.
Two is the personal, which lives in your root directory configuration like we're doing right now.
Второй это личный, который находится в конфигурации корневого каталога, как мы делаем сейчас.
Three is the project which is the claw directory inside of your repository.
Третий это проект, который находится в директории .claude внутри вашего репозитория.
And the lowest is the plugins where you store your plugins that you got online.
И наименьший это plugins, где хранятся plugins, полученные онлайн.
This lets organizations enforce standards while allowing individual customization through differently named skills.
Это позволяет организациям применять стандарты, одновременно допуская индивидуальную настройку через skills с разными именами.
If your company has an enterprise code review skill and you create a personal code review skill, the enterprise version of that takes precedence.
Если в вашей компании есть enterprise skill code review и вы создаёте личный skill code review, enterprise-версия имеет приоритет.
To avoid conflicts, use descriptive names.
Чтобы избежать конфликтов, используйте описательные имена.
Instead of review, use front-end PR review or security review.
Вместо review используйте front-end PR review или security review.
To update a skill, edit it skill.md file.
Чтобы обновить skill, отредактируйте файл skill.md.
Simple.
Просто.
To remove one, delete its directory.
Чтобы удалить его, удалите директорию.
Restart clock code after changes for them to take effect.
Перезапустите Claude Code после изменений, чтобы они вступили в силу.
Creating a skill means making a directory with a skill.md file containing metadata and instructions.
Создание skill означает создание директории с файлом skill.md, содержащим метаданные и инструкции.
Claude loads skill names and descriptions at startup.
Claude загружает имена и описания skills при запуске.
matches incoming requests against those descriptions and asks for confirmation before loading the full content.
Сопоставляет входящие запросы с этими описаниями и запрашивает подтверждение перед загрузкой полного содержимого.
Priority rules handling name conflicts.
Правила приоритетов управляют конфликтами имён.
Enterprise overrides personal personal overrides project overrides plugins.
Enterprise перекрывает личный, личный перекрывает проект, проект перекрывает plugins.
[music]
[музыка]
Edit the skill.md file to update a skill and restart cloud code for changes to take effect.
Отредактируйте файл skill.md, чтобы обновить skill, и перезапустите Claude Code, чтобы изменения вступили в силу.