/contree:setup-test-treesfrom contree
Sets up TEST_TREES.md as a project's behavioral contract and installs durable steering for coding agents. Discovers observable behavior, reconciles evidence, and produces EARS trees without implementing tests.
Ships in contree. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Establish TEST_TREES.md as the project's behavioural contract and install durable steering that keeps coding agents working from it. This skill owns trees and project-local tree steering. It does not implement tests.
Read the project root, source, existing tests, public documentation, project configuration, MENTAL_MODEL.md, and TEST_TREES.md when present.
An existing project already exposes behaviour to a consumer. A new project has no consumer-visible behaviour, even when manifests, configuration, or empty source directories exist.
Explain the behavioural evidence that setup will gather:
Derive complete non-overlapping behavioural areas from direct project evidence. Present those areas and their boundaries. Agree complete non-overlapping scope with the operator before dispatching discovery. Every area in scope must have exactly one owner.
Dispatch discovery subagents over the agreed areas. Give each subagent one explicit ownership boundary. Discovery subagents inspect every agreed area exactly once for observable behaviour, existing tests, public seams, errors, side effects, and contradictions.
Discovery is read-only. Each subagent returns file-backed evidence in the consumer's vocabulary. Subagents do not edit source, tests, MENTAL_MODEL.md, or TEST_TREES.md.
Reconcile the evidence yourself before proposing trees. Resolve overlaps, vocabulary differences, and contradictions against direct evidence and operator intention.
Reconcile the evidence with the operator through change into consumer-driven EARS trees with honest coverage. Follow its test kinds, causal nesting, one-tree-one-test-file boundary, and coverage syntax.
Every discovered behaviour is expressed at its consumer-visible seam. Describe principles rather than examples and include observable errors, side effects, and prevented effects. Do not invent unsupported behaviour.
Name every applicable src, domain, use-case, adapter, component, system, and journey coverage path. Use none where a test is expected but absent and omit only inapplicable layers. Existing tests count as coverage only when their hierarchy and assertions actually reify the tree.
Present the complete reconciled trees to the operator and obtain agreement before installing steering. Do not implement tests, create placeholder tests, or change production behaviour. Test implementation belongs to tdd after setup.
Create an empty TEST_TREES.md containing only a heading and one sentence identifying it as the home for test trees.
Do not invent behaviour, write behaviour paths, or infer a first capability. Do not create test files. The first requested capability pulls its trees and tests into existence through change and tdd.
Install and prove the same project-local SessionStart and Stop hooks described below.
Create executable .contree/hooks/test-trees-session-start.sh with this body:
#!/usr/bin/env bash
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
printf '%s\n' '# Test Trees'
cat TEST_TREES.md
cat <<'EOF'
# Test-tree writing rules
- TEST_TREES.md is the behavioural contract.
- Write trees before tests or implementation.
- Use EARS paths at consumer-visible seams.
- One tree maps to exactly one test file, whose hierarchy mirrors the tree verbatim.
- Name honest src, domain, use-case, adapter, component, system, and journey coverage; use none for expected gaps and omit only inapplicable layers.
- Route contract changes through contree:change and test or implementation gaps through contree:tdd.
EOF
The script loads TEST_TREES.md and the tree-writing rules before coding agents work. It fails visibly with complete native output if the repository root or tree contract cannot be read.
Merge this synchronous project-local SessionStart entry into both .claude/settings.json and .codex/hooks.json without replacing existing settings or hooks:
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "bash \"$(git rev-parse --show-toplevel)/.contree/hooks/test-trees-session-start.sh\"",
"statusMessage": "Loading test trees"
}
]
}
]
}
}
Preserve every existing matcher group and command. Do not duplicate an equivalent test-tree SessionStart command.
Create executable .contree/hooks/test-trees-on-stop.sh with this body:
#!/usr/bin/env bash
set -euo pipefail
input=$(cat)
if printf '%s' "$input" | jq -e '.stop_hook_active == true' >/dev/null 2>&1; then
printf '{}\n'
exit 0
fi
cd "$(git rev-parse --show-toplevel)"
printf '%s\n' 'TEST TREES: Before finishing, reconcile drift between trees, tests, and implementation. Update the contract through contree:change and close test or implementation gaps through contree:tdd. If no drift exists, reply 0.' >&2
exit 2
The project Stop hook asks the coding agent to reconcile drift between trees, tests, and implementation before it finishes. The stop_hook_active guard prevents the hook's follow-up Stop turn from creating a loop. It fails visibly with complete native output when it cannot read its input or repository root.
Merge this synchronous project-local Stop entry into both .claude/settings.json and .codex/hooks.json without replacing existing settings or hooks:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "bash \"$(git rev-parse --show-toplevel)/.contree/hooks/test-trees-on-stop.sh\"",
"statusMessage": "Reconciling test-tree drift"
}
]
}
]
}
}
Preserve every existing matcher group and command. Do not duplicate an equivalent test-tree Stop command.
Require both coding harnesses to load and trust their project configuration. Presence on disk is not proof that a harness loaded a hook.
For Claude Code and Codex separately:
TEST_TREES.md content and the tree-writing rules before its prompt.Fix hook scripts, permissions, trust, and merged configuration at the source, then repeat the actual turns until all four event-and-harness paths work. Do not report completion while either harness has only file-presence or direct-script evidence.
Do not report completion until:
Report the agreed scope, created or reconciled trees, honest coverage gaps, installed hook paths, merged project configs, and actual-turn proof to the operator.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
test-trees, behavioral-contract, project-steering, ears-trees
15 skills in this plugin
/bootstrap-test-treesCompose mental-model and test-tree setup, then implement every existing-project tree through a second subagent wave. TRIGGER when: the operator asks to bootstrap, backfill, discover, or implement a project's existing behaviour as test trees and tests./changeSet expected behaviour by writing or modifying test trees before code changes. TRIGGER when: the user describes a feature, capability, behaviour change, removal, or modification they want — even loosely (e.g. 'I want X', 'let's add Y', 'can we make it do Z', 'change how X works', 'remove this behaviour')./change-without-meRun the complete Contree arc from idea to independently reviewed working software without routine operator phase transitions: change sets the contract, sync audits it, tdd closes every gap, mutation and completion sync prove the result, and second-opinion findings are repaired before completion. TRIGGER when: the user wants the full workflow, asks to take an idea through implementation, asks to make the project complete, or wants change/sync/tdd handled end to end.Other plugins' skills for the same job
npx claudepluginhub elimydlarz/claude-code-plugins --plugin contree