From auto-harness
This skill should be used when the user asks to "write a test", "create test cases", "add test coverage", "define test expectations", "use contains vs regex", "chain dependent tests", or needs guidance on test definition schema, expectation types, variable capture, or test organization best practices.
How this skill is triggered — by the user, by Claude, or both
Slash command
/auto-harness:test-authoringThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!-- BEGIN MNEMONIC PROTOCOL -->
Search first: /mnemonic:search {relevant_keywords}
Capture after: /mnemonic:capture {namespace} "{title}"
Run /mnemonic:list --namespaces to see available namespaces from loaded ontologies.
Write effective test definitions for the hook-driven automated test framework.
Before authoring tests, check mnemonic for test patterns:
# Search for test authoring memories
rg -i "test|expectation|contains|regex|depends_on" ~/.claude/mnemonic/ ./.claude/mnemonic/ --glob "*.memory.md" -l | head -5
# Check patterns namespace
rg -l "." ~/.claude/mnemonic/*/patterns/ --glob "*.memory.md" 2>/dev/null | xargs grep -l -i "test" 2>/dev/null | head -5
Apply recalled patterns:
Every test requires these fields:
| Field | Required | Type | Purpose |
|---|---|---|---|
id | Yes | string | Unique identifier (snake_case) |
description | Yes | string | Human-readable explanation |
action | Yes | string | Instruction for Claude to execute |
expect | Yes | array | Validation expectations |
category | No | string | Grouping for filtering |
save_as | No | string | Variable name to capture output |
depends_on | No | string | ID of prerequisite test |
tags | No | array | Labels for filtering |
contains - Substring MatchUse for flexible text matching when exact format may vary.
expect:
- contains: "successfully"
- contains: "Memory created"
When to use:
not_contains - Negative MatchEnsure unwanted content is absent.
expect:
- not_contains: "error"
- not_contains: "failed"
- not_contains: "undefined"
When to use:
regex - Pattern MatchUse for structured data with predictable patterns.
expect:
- regex: "ID:\\s+([a-f0-9]{12})"
- regex: "Count:\\s+\\d+"
- regex: "(success|complete)"
When to use:
Capture groups: Use () to capture values for save_as.
Use save_as with a regex capture group:
- id: create_item
action: "Create a new item named 'test'"
expect:
- regex: "ID:\\s+([a-f0-9]+)"
save_as: item_id
The first capture group () value is stored in the variable.
Reference with ${variable_name}:
- id: retrieve_item
action: "Retrieve item ${item_id}"
depends_on: create_item
expect:
- contains: "test"
Build test sequences:
# Test 1: Create
- id: crud_create
action: "Create memory with content 'test data'"
expect:
- regex: "ID:\\s+(\\w+)"
save_as: memory_id
# Test 2: Read (depends on create)
- id: crud_read
action: "Retrieve memory ${memory_id}"
depends_on: crud_create
expect:
- contains: "test data"
# Test 3: Update (depends on read)
- id: crud_update
action: "Update memory ${memory_id} with content 'updated'"
depends_on: crud_read
expect:
- contains: "updated"
# Test 4: Delete (depends on update)
- id: crud_delete
action: "Delete memory ${memory_id}"
depends_on: crud_update
expect:
- contains: "deleted"
- not_contains: "error"
Good:
action: "Call subcog_capture with content: 'Test pattern', namespace: 'patterns'"
Avoid:
action: "Create a memory" # Too vague
For MCP tools, use the full tool name:
action: "Call mcp__plugin_subcog_subcog__subcog_capture with content: 'test'"
action: "Call subcog_recall with query: 'authentication', limit: 5, mode: 'hybrid'"
Group tests by component or functionality:
| Category | Use For |
|---|---|
initialization | Setup and init tests |
crud | Create, read, update, delete |
search | Query and filter operations |
validation | Input validation tests |
error-handling | Error condition tests |
integration | Cross-component tests |
commands | Slash command tests |
skills | Skill trigger tests |
hooks | Hook behavior tests |
Use tags for filtering test runs:
| Tag | Meaning |
|---|---|
smoke | Quick sanity checks |
critical | Must-pass tests |
regression | Bug fix verification |
slow | Long-running tests |
flaky | Known intermittent failures |
Pattern: category_component_action_variant
Examples:
init_basic - Basic initializationcrud_memory_create - Create memorysearch_semantic_empty - Semantic search with no resultscmd_review_with_args - Review command with argumentsQuick validation that component works:
- id: component_smoke
description: "Basic smoke test for component"
category: smoke
action: "Minimal invocation of component"
expect:
- not_contains: "error"
tags: [smoke, critical]
Full lifecycle test:
- id: entity_create
action: "Create entity"
save_as: entity_id
tags: [crud]
- id: entity_read
action: "Read entity ${entity_id}"
depends_on: entity_create
- id: entity_update
action: "Update entity ${entity_id}"
depends_on: entity_read
- id: entity_delete
action: "Delete entity ${entity_id}"
depends_on: entity_update
Validate error responses:
- id: invalid_input_error
description: "Verify error on invalid input"
action: "Call tool with invalid_param: 'not-valid'"
expect:
- contains: "error"
- regex: "(invalid|not found|failed)"
tags: [error-handling]
Validate search functionality:
- id: search_with_results
action: "Search for 'known term'"
expect:
- contains: "results"
- regex: "found\\s+\\d+"
- not_contains: "no results"
For detailed patterns and advanced techniques:
references/expectation-patterns.md - Regex patterns for common outputsnpx claudepluginhub zircote-plugins/auto-harnessCreates, edits, and verifies skills using a test-driven development approach with pressure scenarios and subagents.