skills/btt/SKILL.md
Write bulloak tree specifications (.tree files) for smart contract integration tests. Trigger phrases - write a tree, create test tree, BTT spec, bulloak tree, Branching Tree Technique, or when writing integration tests for contract functions.
npx skillsauth add sablier-labs/agent-skills bttInstall 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.
Write bulloak tree specifications for smart contract tests.
| Reference | Content | When to Read |
| ------------------------------------- | ----------------------------------------- | ----------------------------- |
| ./references/examples.md | Complete tree and generated test examples | When learning BTT syntax |
| ./references/sablier-conventions.md | Sablier-specific terminology and examples | When working in Sablier repos |
Bulloak is a Solidity test generator that creates test scaffolds from .tree specification files. It offers a
structured approach to test case design that ensures comprehensive coverage of all possible scenarios and edge cases in
your smart contract tests.
cargo install bulloak
bulloak scaffold -wf --skip-modifiers --format-descriptions <path/to/file.tree>
where:
--format-descriptions capitalizes the first letter of the branch in the test contract and add a period at the end of
it.--skip-modifiers skips the generation of modifiers. We do this because we put all the modifiers in a separate
Modifiers.sol file.bulloak check --skip-modifiers <path/to/file.tree>
Tree files should not have periods at the end of it branches. The --format-descriptions flag automatically:
# Correct (no period)
└── it should revert
# Wrong (has period)
└── it should revert.
FunctionName_ContractName_Integration_Test
├── condition1
│ └── outcome1
└── condition2
└── outcome2
| Keyword | Purpose |
| ------- | -------------------------------------------- |
| when | Conditional branch (user input or timestamp) |
| given | Pre-condition contract state branch |
| it | Action/assertion (leaf node) |
when and given become modifiers if they have nested branches._Integration_Concrete_Test.Contract::function, using :: as a separator, and
all roots must share the same contract name (e.g., Foo::hashPair, Foo::min).when or given, it is a condition. when and given are interchangeable.it, it is an action. Any child branch an action has is called an action description.For examples, see ./references/examples.md.
tests/integration/concrete/{function} directory.- format. For example, if the function name is createFlowStream, the corrresponding
test tree and test file must be placed in the tests/integration/concrete/create-flow-stream directory.{function}.tree.{function}.t.sol.{FunctionName}_Integration_Concrete_Test.Location for tree file: tests/integration/concrete/{function-name}/{functionName}.tree
Note: Your repo's agent will provide the exact directory structure.
bulloak scaffold -wf --skip-modifiers --format-descriptions <path/to/file.tree>
This generates a .t.sol file.
bulloak check --skip-modifiers <path/to/file.tree>
If it returns false, your repo agent will look into it and fix the issues.
Start with guard conditions that cause early reverts:
├── when delegate call // First: delegation check
│ └── it should revert
└── when no delegate call
├── given null // Second: existence check
│ └── it should revert
└── given not null
├── when amount zero // Third: input validation
│ └── it should revert
└── when amount not zero
└── ... // Finally: business logic
Some examples below:
| Concept | Convention |
| ---------------------- | ------------------------- |
| Resource doesn't exist | given null |
| Resource exists | given not null |
| Caller check | when caller {role} |
| Amount check | when amount {condition} |
Whenever possible, try to use less words and more concise language for the branches.
└── when withdrawal address not zero
├── when withdrawal address not owner // Non-owner cases
│ ├── when caller sender
│ ├── when caller unknown
│ └── when caller recipient
└── when withdrawal address owner // Owner cases
└── ...
For success cases, enumerate all side effects:
└── it should make the withdrawal
├── it should reduce the entry balance by the withdrawn amount
├── it should reduce the aggregate amount by the withdrawn amount
├── it should update the entry state
├── it should update the timestamp
└── it should emit {Transfer}, {Withdraw} and {MetadataUpdate} events
Put events in parenthesis: {EventName}.
A test function should NEVER have a modifier that matches its own name. The function name already encodes the condition — adding a same-name modifier is redundant.
// WRONG: modifier matches the function name
function test_WhenWithdrawAmountNotZero()
external
whenWithdrawalAddressNotZero
whenWithdrawAmountNotZero // <- WRONG: redundant, same as the function name
{ }
// CORRECT:
function test_WhenWithdrawAmountNotZero() external whenWithdrawalAddressNotZero { }
Child branch symbols (├/└) must align with the tail of parent's └── or ├── (3 spaces, not 4):
└── when withdrawal address not zero
├── when withdrawal address not owner ✓ Correct (3 spaces)
│ └── when caller sender
# Scaffold tests from tree
bulloak scaffold -wf --skip-modifiers --format-descriptions <path/to/file.tree>
# Check all trees in a directory
bulloak check --skip-modifiers tests/**/*.tree
https://github.com/alexfertel/bulloak/blob/main/README.md
Test this skill with these prompts:
deposit function that reverts when amount is zero and succeeds otherwise"withdraw that checks null stream, caller authorization, and amount
validation"cancel in the Lockup protocol with proper stream state checks"development
This skill should be used when the user asks to "create a state machine", "add xState", "use xState with React", "implement actor-based state", "manage complex state with state machines", "use xState with Effect", "integrate Effect-ts with xState", mentions xState hooks (useMachine, useActor, useSelector), or discusses finite state machines in React applications.
tools
This skill should be used when the user asks about "viem", "viem client", "viem actions", "TypeScript Ethereum", "createPublicClient", "createWalletClient", "parseEther", "formatEther", "readContract", "writeContract", or mentions using viem for blockchain interactions.
development
This skill should be used when the user asks about "Tailwind CSS", "tailwind-variants", "tv() function", "CSS-first configuration", "Tailwind breaking changes", mentions styling with Tailwind utilities, gradient syntax, or component variants with TypeScript.
development
This skill should be used when the user asks to "analyze a screenshot", "generate implementation spec", "create SPEC.md from screenshot", "extract design specs", "spec from image", or provides website screenshots and wants detailed implementation guidance.