Jak napisać nowy skill dla agenta AI
Agent zamienia metodę albo proces w skill, który ładuje się na właściwe zadania i daje się wykonać bez autora obok.
Pisanie, dla początkujących. Opublikowano
Co robi
Agent zaczyna od krótkiego wywiadu: co skill zmienia, jakimi słowami ludzie o niego proszą, czego nie powinien łapać i jak wygląda gotowy wynik. Potem dzieli materiał: kroki trafiają do SKILL.md, ustawienia każdego czytelnika do szablonu kontekstu, długie materiały do osobnych plików. Opis we frontmatterze pisze pod decyzję o załadowaniu, słowami użytkownika. Treść układa w stałej kolejności: problem, kroki, reguły decyzji, przykłady, kształt wyniku, samokontrola, typowe błędy. Na końcu uruchamia cztery testy w świeżej sesji: czy skill się ładuje, czy obca sesja potrafi go wykonać, czy wynik zgadza się z kontraktem i czy w folderze nie ma prywatnych danych.
Kiedy używać
Kiedy używać
- Chcesz zamienić proces, który robisz ręcznie, w skill dla agenta.
- Masz dokument, rozdział albo framework i chcesz, żeby agent go stosował, a nie streszczał.
- Twój skill istnieje, ale się nie ładuje albo agent i tak improwizuje.
- Chcesz udostępnić skill innym bez swoich ścieżek, nazw i danych.
Kiedy nie używać
- Jednorazowe polecenie. Wystarczy prompt w rozmowie.
- Reguła na jedną linijkę, która pasuje do istniejącego pliku instrukcji projektu.
- Proces, którego sam jeszcze nie przeszedłeś ani razu. Najpierw zrób go ręcznie.
Tabela decyzyjna
| Sytuacja | Co robi skill |
|---|---|
| Kroki powtarzane za każdym razem | Wpisuje je do SKILL.md jako numerowane, sprawdzalne kroki |
| Wartości inne u każdego czytelnika | Przenosi je do szablonu kontekstu jako puste pola z przykładem |
| Długi materiał potrzebny czasem | Wydziela go do osobnego pliku i pisze, kiedy go otworzyć |
| Skill się nie ładuje | Przepisuje opis słowami, których ludzie naprawdę używają |
| Skill ładuje się przy niepowiązanych zadaniach | Zawęża opis albo dzieli skill na kilka |
| W folderze są prywatne nazwy albo ścieżki | Przenosi je do kontekstu czytelnika i powtarza test |
Szablon
Metoda: wywiad, wybór kształtu, frontmatter jako wyzwalacz, kolejność treści, szablon kontekstu i cztery testy w świeżej sesji.
---
name: skill-authoring
description: Write a new SKILL.md for an AI agent from a method, a document, a book chapter or a workflow you already run, then test that it triggers and that a fresh session can follow it. Use it when someone asks to "turn this into a skill", "write a skill for X" or "package this workflow for the agent".
---
# Writing a new skill
A skill is a folder the agent loads when a task matches it: a `SKILL.md` with a short frontmatter and a
body of instructions, plus any files the instructions point to. Most skills that fail do so in one of two
ways. They never load, because the description does not match how people phrase the task. Or they load
and the agent still does the wrong thing, because the body is a summary of the topic instead of
instructions it can act on. This workflow writes skills that avoid both and tests them before calling
them done.
Read `CONTEXT.md` next to this file first. It says where skills live in the reader's tool, the house
conventions, and what must never go into a skill file. If `CONTEXT.md` is missing or a field is blank,
ask the user for it in the language they write in, then write the answer into `CONTEXT.md`. For example:
- English: "Which agent do you use, and where does it load skills from?"
- Polish: „Którego agenta używasz i skąd wczytuje skille?"
## Before you start / What you need
- **An AI coding agent that can write files:** Claude Code, Codex CLI or Cursor. In a chat with no file
access you hand back the file contents to copy instead.
- **Your tool's own skills documentation**, so the folder, frontmatter and loading rules match what your
tool expects. Read the page for the tool you use:
- Claude Code skills: https://code.claude.com/docs/en/skills
- Anthropic Agent Skills overview: https://platform.claude.com/docs/en/agents-and-tools/agent-skills/overview
- OpenAI Codex skills: https://developers.openai.com/codex/skills
- Cursor rules: https://cursor.com/docs/context/rules
- **Source material:** a process description, a document or notes.
- **A way to open a fresh session** for the tests in step 6.
## 1. Interview before drafting
Ask only what the material does not already answer. Stop at five questions.
1. **The job:** what does the agent do differently once this skill is loaded? One sentence.
2. **Triggers:** three to five phrasings a real person would type when they need it. Include the lazy ones.
3. **Non-triggers:** tasks that look similar but should not load it.
4. **Inputs:** what the agent needs from the user or the project each time (a file, a URL, a setting).
5. **Done:** what the output looks like when the skill worked. Something you can see, not a feeling.
If the source is a document, book chapter or framework, read all of it first. Pull out the decisions and
procedures, not the prose. A skill is not a book summary.
## 2. Decide the shape
| The material is... | Put it in... |
|---|---|
| Steps the agent follows every time | the `SKILL.md` body, as numbered steps |
| Settings that differ per reader (paths, tools, thresholds, names of their things) | a `CONTEXT.template.md` the reader copies and fills in |
| Long reference (tables, full checklists, schemas) the agent needs only sometimes | a separate file in the folder, linked from the body with when to open it |
| A fixed output shape | a template file the agent copies |
| Anything that must run the same way every time (a check, a transform) | a small script in the folder, called from the body |
Keep the `SKILL.md` body short enough to read in one pass. Move reference material out and link it with a
sentence that says when to open it. The agent reads a linked file only when the body tells it to.
## 3. Write the frontmatter
Start from `SKILL.skeleton.md` in this folder: copy it into the new skill's folder as `SKILL.md`, then
fill in its frontmatter here and its body in step 4.
```yaml
---
name: lowercase-with-hyphens
description: <what it does>. Use it when <trigger situations, in the user's words>.
---
```
- `name` matches the folder name.
- The `name` and `description` are the only parts the agent sees before deciding to load the skill.
Write the description for that decision: what it does, then when to use it, in the words from your trigger list. Name the non-obvious
triggers. Leave out the history of the method and any praise.
- One description, one job. A description with three unrelated jobs is three skills.
## 4. Write the body
Use this order. Skip a section only when it would be empty.
1. **Title and why:** two to four sentences on the problem the skill solves and what goes wrong without it.
2. **Read first:** which context file or setting to load before starting.
3. **Steps:** numbered, imperative, each one checkable. "Check the X" is weak; "list every X with its Y,
and stop if any Y is missing" is a step.
4. **Decision rules:** the forks the agent will hit, as a table of situation and action.
5. **Examples:** one good and one bad output, short, on a neutral fictional case. Mark invented numbers
as invented.
6. **Output contract:** the exact shape of what the agent returns or writes.
7. **Self-check:** three to seven yes/no questions the agent answers before replying.
8. **Failure modes:** a table of symptom, cause and fix.
Writing rules:
- Instructions, not descriptions. "Ask for the order export before analysing" beats "order data is
important".
- Say what to do instead, not only what to avoid.
- Give the reason for a rule in one line when the reason changes how it is applied.
- No private facts: no names, paths, keys, hostnames, account ids, prices, customer data or internal
incident stories. Those belong in the reader's `CONTEXT.md`, as blanks with an example.
- Relative paths inside the folder. Absolute paths break on every other machine.
## 5. Write the context template
For every setting that differs per reader, add a section to `CONTEXT.template.md`:
```
## <setting>
(what it is and how to decide it)
<field>: ___
Example: <a neutral, invented example>
```
Open the file with "copy this to CONTEXT.md and fill in every blank" and a line saying never to put
passwords or access keys in it.
## 6. Test before calling it done
Run these in a fresh session, not the one that wrote the skill. The writing session knows what you meant.
1. **Trigger test:** type each phrase from your trigger list. The skill should load for each. Then type
each non-trigger. It should not load. Fix the description until both hold.
2. **Cold-follow test:** give a fresh session a real task and only the skill folder. Watch where it
stalls, guesses or asks. Each stall is a missing step or a missing context field.
3. **Output test:** compare the result with the output contract, line by line.
4. **Leak test:** search the folder for your own names, paths, hostnames, account ids and numbers. The
count should be zero.
Record what failed and what you changed. Rerun until all four pass.
## 7. Package
- Folder name equals `name`.
- Every file the body links to exists in the folder.
- `CONTEXT.template.md` present if any setting varies per reader.
- If your tool installs skills from an archive, zip the folder itself, not its parent.
## Self-check before handing the skill over
- Does the description say both what the skill does and when to use it, in the user's words?
- Would a stranger on a different machine be able to follow every step?
- Is every per-reader value a blank in the context template, not a fact in the body?
- Did the trigger test and cold-follow test pass in a fresh session?
- Is the folder free of private names, paths, keys and numbers?
## Failure modes
| Symptom | Cause | Fix |
|---|---|---|
| The skill never loads | description written as a title, not as trigger situations | rewrite it with the phrases people actually type |
| The skill loads on unrelated tasks | description too broad, or several jobs in one | narrow it; split into separate skills |
| The agent loads it and improvises | body summarises the topic instead of giving steps | numbered, checkable steps and a decision table |
| Works for the author, fails for others | private paths, names or tools baked into the body | move them to the context template |
| The agent ignores the reference file | the body never says when to open it | link it with an explicit "open this when..." |
Pozostałe pliki
CONTEXT.template.mdTwoje ustawienia: gdzie narzędzie trzyma skille, jak je ładuje, konwencje i lista rzeczy, które nie mogą trafić do skilla.
# Skill authoring: your context
Copy this file to CONTEXT.md next to SKILL.md and fill in every blank. Never put passwords, access keys or
card numbers here.
## Where skills live in your tool
(The folder your agent loads skills from, per project and for every project.)
Project skills: ___
Skills for every project: ___
Example: .claude/skills/<name>/ in the repository; ~/.claude/skills/<name>/ for all projects.
## How your tool loads a skill
(Automatically from the description, by a command, or both. If your tool has no skill system, where the instructions go instead.)
Example: loads automatically when the description matches, or by typing /<name>. A tool without skills: paste into the project instruction file.
## House conventions
(Language of skill files, heading style, whether every skill ships a context template, maximum body length you want.)
Language: ___
Context template in every skill: yes / no
Body length you want to stay under: ___
Example: English, a context template whenever any value differs per user, body readable in one pass with reference moved to separate files.
## Never in a skill file
(Your own list of things that must stay out: the kinds of private facts specific to your work. They go in CONTEXT.md as blanks instead.)
Example: client names, internal hostnames, account ids, prices, file paths on my machine, anything from customer records.
## Where you test
(How you open a fresh session for the trigger and cold-follow tests.)
Example: a new terminal session in a scratch copy of the project.
SKILL.skeleton.mdPusty szkielet nowego skilla z frontmatterem i wszystkimi sekcjami do wypełnienia.
---
name: your-skill-name
description: (What it does, in one sentence.) Use it when (trigger situations in the words a user types), for example "(phrase one)" or "(phrase two)".
---
# (Title)
(Two to four sentences: the problem this solves and what goes wrong without it.)
Read `CONTEXT.md` next to this file before starting. (Say what it holds.)
## 1. (First step)
(Imperative, checkable. Say what to do and when to stop.)
## 2. (Next step)
(...)
## Decision rules
| Situation | Action |
|---|---|
| (a fork the agent will hit) | (what it does) |
## Examples
Good:
```
(short output on a neutral, invented case; mark invented numbers as invented)
```
Bad:
```
(the tempting wrong output, with one line on why it is wrong)
```
## Output contract
(The exact shape of what the agent returns or writes, and where.)
## Self-check before replying
- (yes/no question)
- (yes/no question)
- (yes/no question)
## Failure modes
| Symptom | Cause | Fix |
|---|---|---|
| (what you see) | (why) | (what to change) |
Czego potrzebujesz
An AI coding agent: Claude Code, Codex CLI or Cursor (otwiera się w nowej karcie)
Pisze pliki nowego skilla i uruchamia testy w świeżej sesji. W czacie bez dostępu do plików dostaniesz treść do skopiowania.
- Zainstaluj jednego agenta według jego oficjalnej dokumentacji: Claude Code (code.claude.com/docs), Codex CLI (developers.openai.com/codex) albo Cursor (cursor.com/docs).
- Umieść folder szablonu tam, skąd Twój agent wczytuje skille lub instrukcje, zgodnie z krokami instalacji.
- Upewnij się, że możesz otworzyć nową sesję w kopii projektu do testów.
Claude Code skills and Anthropic Agent Skills docs (otwiera się w nowej karcie)
Dla Claude Code: gdzie leżą skille, jakie pola ma frontmatter i jak skill się ładuje.
- Przeczytaj stronę o skillach w dokumentacji Claude Code.
- Ogólny opis formatu Agent Skills: platform.claude.com/docs/en/agents-and-tools/agent-skills/overview.
- Wpisz w CONTEXT.md folder skilli i sposób ładowania, które tam znajdziesz.
OpenAI Codex skills docs (otwiera się w nowej karcie)
Dla Codex: gdzie Codex szuka skilli i co musi zawierać SKILL.md.
- Przeczytaj stronę o skillach w dokumentacji Codex.
- Jeśli Twoja wersja nie obsługuje skilli, użyj AGENTS.md: developers.openai.com/codex/guides/agents-md.
- Wpisz w CONTEXT.md folder skilli, którego używa Twoja wersja.
Cursor rules docs (otwiera się w nowej karcie)
Dla Cursor: jak dodać instrukcje jako regułę projektu albo przez AGENTS.md.
- Przeczytaj stronę o regułach w dokumentacji Cursor.
- Wpisz w CONTEXT.md, czy używasz reguł projektu, czy AGENTS.md.
Instalacja
- Claude Code: skopiuj folder do .claude/skills/skill-authoring/ w projekcie albo do ~/.claude/skills/skill-authoring/ dla wszystkich projektów. Claude ładuje skill, gdy opis pasuje do zadania, albo gdy wpiszesz /skill-authoring.
- Codex: skopiuj folder do .agents/skills/skill-authoring/ w repozytorium albo do ~/.agents/skills/skill-authoring/ dla wszystkich projektów. Jeśli twoja wersja nie obsługuje skilli, wklej treść SKILL.md do AGENTS.md.
- Cursor: dodaj SKILL.md jako regułę projektu albo wklej go do AGENTS.md.
- Czat bez plików: wklej SKILL.md na początku rozmowy i dołącz materiał, z którego ma powstać skill.
- Skopiuj CONTEXT.template.md jako CONTEXT.md obok SKILL.md i uzupełnij każde pole.
- Zostaw SKILL.skeleton.md w folderze. Agent kopiuje go przy każdym nowym skillu.
Działa, jeśli
- Zanim agent zacznie pisać, zadaje najwyżej pięć pytań o zadanie, wyzwalacze i gotowy wynik.
- Nowy folder ma nazwę równą polu name, a w nim SKILL.md i szablon kontekstu.
- Opis we frontmatterze mówi, co skill robi i kiedy go użyć, słowami z listy wyzwalaczy.
- W świeżej sesji skill ładuje się na każdą frazę z listy i nie ładuje się na zadania spoza niej.
- Agent oddaje raport z czterech testów z tym, co poprawił po każdym nieudanym.
Wymagania
- Agent, który potrafi zapisywać pliki. W czacie bez plików dostaniesz treść do skopiowania.
- Materiał źródłowy: opis procesu, dokument albo notatki.
- Możliwość otwarcia świeżej sesji do testów.
Pytania
Dlaczego opis we frontmatterze jest taki ważny?
Nazwa i opis to jedyne części skilla, które agent widzi przed decyzją o załadowaniu. Opis w stylu tytułu, na przykład nazwa metody, nie pasuje do tego, jak ludzie formułują zadanie, więc skill nigdy się nie ładuje. Opis z sytuacjami i frazami użytkownika pasuje.
Po co test w świeżej sesji, skoro skill działa w tej, w której powstał?
Sesja, która pisała skill, wie, co autor miał na myśli, i wypełnia luki z kontekstu rozmowy. Świeża sesja ma tylko folder. Każde miejsce, w którym się zatrzymuje albo zgaduje, to brakujący krok albo brakujące pole w kontekście.
Czy mogę zrobić skill z książki albo kursu?
Możesz zrobić skill, który stosuje metodę do twojej pracy: kroki, decyzje, samokontrolę. Nie kopiuj treści źródła i nie udostępniaj jej dalej bez zgody autora. Skill, który tylko streszcza, i tak nie działa, bo agent nie ma z czego wykonać zadania.
Ile treści może mieć SKILL.md?
Tyle, żeby dało się go przeczytać za jednym razem. Tabele referencyjne, pełne listy i schematy przenieś do osobnych plików w folderze i napisz w treści, kiedy agent ma je otworzyć.
Gdzie to pasuje
Ten skill produkuje kolejne skille. Szablon dziennika poprawek dokłada do gotowego skilla pamięć błędów, a szablon recenzji adwersaryjnej przydaje się, gdy skill dotyka kodu lub danych, które mogą coś zepsuć. Każdy szablon w tej bibliotece ma ten sam kształt, który opisuje ten skill: SKILL.md (albo CLAUDE.md w szablonach instrukcji dla agenta), szablon kontekstu i pliki pomocnicze.
Wszystkie skilleŹródła
- Claude Code docs: skills (dostęp 2026-09-22)
- OpenAI Codex docs: skills (dostęp 2026-09-22)
- OpenAI Codex docs: AGENTS.md (dostęp 2026-09-22)
- Cursor docs: rules (dostęp 2026-09-22)
Pytania o wdrożenie zadajesz na Discordzie.Dołącz za darmo