skills/preparing-a-yak/SKILL.md
Use when a yak needs requirements, examples, and a plan before implementation - prepares a yak so it's ready for subagent-driven development
npx skillsauth add mattwynne/yaks preparing-a-yakInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Preparing a yak turns a vague idea into a buildable spec with
sub-yaks. Each phase stores its output on the yak itself
using yx commands, so everything travels with the yak.
Yaks come in different flavours. A feature adds or changes observable behaviour. A refactoring changes structure while preserving behaviour. A chore is everything else (dependency upgrades, CI fixes, tooling). The preparation flow adapts to the type.
Don't use when:
Before doing anything, understand what you're working with:
Read the yak's current state:
yx context --show "yak name"
yx field --show "yak name" examples
Read parent and sibling yaks for scope and constraints:
yx ls
Explore relevant code — read the files and tests that this yak will touch. Ground yourself in the codebase before brainstorming.
Skip phases that already have approved content. If the yak already has a solid spec in context, go straight to Phase 2.
Before doing any visible work, claim the yak:
yx state "yak name" wip
Preparation is active work. Other agents and the human need to see that this yak is being worked on.
Use /brainstorming to explore the idea collaboratively with
the user.
Adaptation: Instead of writing the spec to a file, store it as the yak's context:
cat <<'EOF' | yx context "yak name"
# Goal
[What this yak accomplishes]
# Type
[Feature | Refactoring | Chore]
# Success Criteria
[Specific, testable criteria]
# Design Decisions
[Key decisions from brainstorming]
EOF
Done when: The user approves the spec in context, and the yak's type (feature, refactoring, or chore) is clear.
This phase adapts based on the yak's type.
Use when the yak adds or changes observable behaviour: new commands, changed output, new CLI flags, modified user-facing semantics.
Use /example-mapping to discover rules, examples, and
questions.
Example mapping is for behavioural rules — things that need
if statements in the code. Not every acceptance criterion
is a rule. Design choices (colours, layout, formatting
constants) belong in the spec as criteria, not in the example
map. Only map rules where different inputs produce different
behaviour through branching logic.
CRITICAL: Go one rule at a time, not all at once.
The process:
Identify the behavioural rules from the spec. These are the rules where different inputs lead to different outputs — things that need branching logic. List them as a short numbered checklist (rule name only, one line each) so the user can see the full scope. Explicitly note which acceptance criteria are not rules (design choices) so the user can see you've considered them.
Present one rule at a time. For each rule:
After all rules are confirmed, go through questions one at a time. For each question:
Store the final example map on the yak:
cat <<'EOF' | yx field "yak name" examples
Feature: [yak name]
Rule: [first rule]
Example: [concrete example]
Example: [edge case]
Rule: [second rule]
Example: [concrete example]
# Deferred:
# - [deferred question or rule]
EOF
Done when: All rules confirmed, all questions answered or deferred, and the example map is stored on the yak.
Use when the yak changes code structure while preserving behaviour: extracting modules, renaming concepts, changing internal APIs, reorganising files.
The key artifact is an Architecture Decision Record capturing why the change is being made and what the target structure looks like.
Discuss the motivation and trade-offs with the user. What's wrong with the current structure? What does the target look like? What are the risks?
Write the ADR following the project's template:
cat <<'EOF' > docs/adr/NNNN-short-title.md
# Short Title
Date: YYYY-MM-DD
## Status
Proposed
## Context
[What is motivating this change? What problems does the
current structure cause?]
## Decision
[What structural change are we making? Describe the target
architecture clearly enough that someone could implement it.]
## Consequences
[What becomes easier? What becomes harder? What risks exist
during the migration?]
EOF
cat <<'EOF' | yx field "yak name" adr
docs/adr/NNNN-short-title.md
EOF
Done when: The user approves the ADR.
For dependency upgrades, CI fixes, tooling changes, and other work that doesn't change behaviour or architecture: the spec from Phase 2 is sufficient. Proceed to Phase 4.
The yak tree is the plan. Don't write a separate plan document or store a plan in a field — break the work directly into sub-yaks. The tree structure expresses dependencies (children are prerequisites, leaf nodes get done first).
Ground the plan in the codebase. Before creating sub-yaks:
Adapt based on yak type:
Create sub-yaks and arrange by dependency:
# Create sub-yaks from planned tasks
yx add task A --under "yak name"
yx ls
yx add task B --under "yak name"
yx ls
# Nest so dependencies are expressed through hierarchy
# If task B depends on task A, make A a child of B:
yx move "task A" --under "task B"
yx ls
Add context to each sub-yak with enough detail for an agent to implement it with zero prior context. Include:
cat <<'EOF' | yx context "task A"
# Goal
[What this sub-yak accomplishes]
# Files
- Create: src/path/to/new_file.rs
- Modify: src/path/to/existing.rs
- Test: features/something.feature (or tests/...)
# Definition of Done
- [Specific criterion]
- [Another criterion]
- All tests pass: `dev check`
EOF
Follow the Iron Law: run yx ls after every yx add or
yx move to keep the human in sync.
The tree enforces execution order: work leaves first, then their parents.
Done when: The user approves the sub-yak tree.
The yak now has everything needed for implementation:
Next step: Use /parallel-yak-implementation for
independent leaf yaks, or /subagent-driven-development
to execute sequentially.
| Phase | What | Skill | Stored In | Read With |
|-------|------|-------|-----------|-----------|
| 0 | Existing state | — | — | yx context --show, yx field --show, yx ls |
| 1 | Mark WIP | — | state | yx ls |
| 2 | Spec | /brainstorming | context | yx context --show "name" |
| 3a | Behaviour (feature) | /example-mapping | examples field | yx field --show "name" examples |
| 3b | Decision (refactoring) | — | adr field + file | yx field --show "name" adr |
| 3c | — (chore) | skip | — | — |
| 4 | Plan as sub-yaks | /yak-mapping | yak hierarchy | yx ls |
| Mistake | Fix |
|---------|-----|
| Jumping straight to planning without brainstorming | Phase 2 first — understand what before how |
| Not reading existing state before starting | Phase 0 — check what's already there |
| Not exploring the codebase before planning | Read the relevant files in Phase 0 and before Phase 4 |
| Example mapping a chore or refactoring | Only features need example mapping |
| Skipping ADR for a significant refactoring | If you're changing structure, capture the decision |
| Writing examples without a spec | Brainstorm the spec first, then map examples against it |
| Skipping example mapping for a feature with multiple rules | If it has rules and edge cases, map it |
| Storing outputs in files instead of on the yak | Always use yx context and yx field |
| Writing a plan field instead of sub-yaks | The tree is the plan — break work into sub-yaks directly |
| Starting implementation without user approval at each phase | Each phase ends with user confirmation |
| Leaving plan tasks as flat siblings | Use /yak-mapping nesting to order by dependency |
| Writing sub-yak context without exact file paths | Ground every sub-yak in specific files and commands |
| Adding sub-yaks without running yx ls after each | Iron Law — yx add then yx ls, always |
testing
Use when writing or reviewing Gherkin features, especially after discovering examples or edge cases that reveal a new business rule
databases
Use when running yx commands that create, modify, or delete yaks outside of real project work — provides an isolated temp environment
documentation
Use when starting work on a yak - sets up an isolated git worktree, reads yak context, and guides the full cycle from claiming through merge and cleanup
development
Use when planning work by approaching goals and discovering blockers, before creating comprehensive plans