add-edge-test
Skill8 starsChanged 7 months agoApache-2.0View on GitHub
File header: Edge tests document actual behavior (including bugs), not ideal behavior. The pattern from tests/edge/corrupt_state.bats: If you are documenting a known bug, add a comment explaining the bug and why it isn't fixed yet. Edge tests often need specific preconditions. Inject state directly: Because synthesize.sh sets shopt -s nullglob globally at source time (via _common_setup), edge tests can test nullglob interactions: Note: You cannot test non-nullglob behavior in isolation — _common_setup always sources synthesize.sh, which always sets nullglob. For…
In this repository22 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/workflows/CLAUDE.mdCLAUDE.md
- lib/CLAUDE.mdCLAUDE.md
- prompts/CLAUDE.mdCLAUDE.md
- schemas/CLAUDE.mdCLAUDE.md
- scripts/CLAUDE.mdCLAUDE.md
- tests/CLAUDE.mdCLAUDE.md
- add-bats-testSkill
- add-gather-agentSkill
- add-integration-testSkill
- add-synthesis-fixtureSkill
- audit-prompt-schema-syncSkill
- bundle-and-verifySkill
- check-ci-locallySkill
- debug-agent-failureSkill
- fixture-syncSkill
- pre-pr-checklistSkill
- rebuild-test-imageSkill
- release-ultrainitSkill
- run-testsSkill
- tune-synthesis-contextSkill
- validate-generated-artifactSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 69
If you are documenting a known bug, add a comment explaining the bug and why it isn't fixed yet.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Before You Start
tests/edge/corrupt_state.bats— bug-documenting test pattern (documents known silent failure)tests/edge/special_characters.bats— how to test shell expansion edge casestests/edge/numeric_edge_cases.bats— bc arithmetic boundary teststests/helpers/test_helper.bash—_common_setup(all 9 libs sourced, includingsynthesize.sh'snullglobside effect)
When to Use Edge Tests vs Unit Tests
| Scenario | Location |
| Testing a known bug (regression) | tests/edge/ |
| Testing CLI argument parsing | tests/edge/cli_args.bats |
| Testing budget boundary conditions | tests/edge/budget_exhaustion.bats |
| Testing a lib function's normal behavior | tests/unit/ |
| Testing a shell expansion quirk | tests/edge/ |
Steps
1. Create the test file
touch tests/edge/<domain>.batsFile header:
#!/usr/bin/env bats
# Edge cases for <domain>: <one-line description of what failure domain this covers>
setup() {
load '../helpers/test_helper'
_common_setup
# Only add mock_claude if testing agent execution paths:
# load '../helpers/mock_claude'
# setup_mock_claude
}
teardown() {
_common_teardown
}2. Write bug-documenting tests
Edge tests document actual behavior (including bugs), not ideal behavior. The pattern from tests/edge/corrupt_state.bats:
@test "cost files without pipe delimiters are silently treated as zero spend" {
# Inject malformed cost file (no pipe separators)
echo "50.00" > "$WORK_DIR/costs/agent.cost"
run check_budget
# Documents the bug: malformed files contribute $0, not $50
assert_success # budget check passes even though it should detect $50
}If you are documenting a known bug, add a comment explaining the bug and why it isn't fixed yet.
3. Manual state injection
Edge tests often need specific preconditions. Inject state directly:
@test "bc produces .20 not 0.20 for values under 1" {
# Set budget so AGENT_BUDGET will be fractional
TOTAL_BUDGET="1.00"
_common_setup # re-source with new budget
# bc with scale=2: result is '.20' not '0.20'
local result
result=$(echo 'scale=2; 1/5' | bc)
[[ "$result" == ".20" || "$result" == "0.20" ]]
}4. nullglob side effect tests
Because synthesize.sh sets shopt -s nullglob globally at source time (via _common_setup), edge tests can test nullglob interactions:
@test "empty costs directory does not block budget check" {
# With nullglob: *.cost matches nothing, expands to empty string
rm -f "$WORK_DIR/costs"/*.cost
run check_budget
assert_success
}Note: You cannot test non-nullglob behavior in isolation — _common_setup always sources synthesize.sh, which always sets nullglob.
5. Special character edge cases
For shell expansion bugs (see tests/edge/special_characters.bats):
@test "prompts with apostrophes use @file form to avoid expansion" {
local prompt_file="$TEST_TMPDIR/prompt.txt"
echo "This project's goal is testing" > "$prompt_file"
make_claude_envelope '{}' '0.10' > "$MOCK_CLAUDE_RESPONSE"
run run_agent "test-agent" "@${prompt_file}" \
"${SCRIPT_DIR}/schemas/identity.json" "Read" "haiku"
assert_success
}Verify
make test-edgeOr for a single file:
docker run --rm -v "$(pwd)":/workspace -w /workspace \
ghcr.io/joelbarmettleruzh/ultrainit-test:latest \
bats tests/edge/<domain>.batsCommon Mistakes
- Testing current (buggy) behavior as if it were correct — the project rule says "write tests to test the actually correct behaviour". For bug-documenting tests, clearly label them as documenting a known bug with a comment, not as asserting the correct behavior.
- Forgetting nullglob is always active —
synthesize.shsetsshopt -s nullglobat source time. All glob patterns in all tests expand differently than they would in isolation. Tests that rely on a glob pattern returning the literal string when no files match will silently pass for the wrong reason.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

