Agent skill

Stage Trace Test

by pragma-org in pragma-org/amaru

Fix failing pure-stage simulation tests that use asserttracematch() by running the test, reading the trace diff in the failure output, and updating the expected trace using tm helpers from…

Apache-2.0Auto-check passedTesting & QA

Install Stage Trace Test

skills CLI
$ npx skills add pragma-org/amaru --skill stage-trace-test -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install pragma-org/amaru stage-trace-test --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/pragma-org/amaru.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/stage-trace-test .claude/skills/stage-trace-test && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
stage-trace-test
GitHub stars
116
Token cost
~1.4k tokens
SKILL.md length
521 words
Files
1
Skills in repo
1
Repo updated
First seen
Licence
Apache-2.0

At a glance

Fix failing pure-stage simulation tests that use asserttracematch() by running the test, reading the trace diff in the failure output, and updating the expected trace using tm helpers from…

  • Works in 6 steps: Identify the failing test → Run the test and capture the diff → Diagnose the failure type → …
  • A trace assertion test fails
  • SKILL.md covers Workflow, Key files and Common pitfalls
  • Calls cargo

What it does

Stage Trace Test is an agent skill from pragma-org/amaru. Fix failing pure-stage simulation tests that use asserttracematch() by running the test, reading the trace diff in the failure output, and updating the expected trace using tm helpers from amarupurestage (prefer tmstatematch for targeted state checks, tmsendmatch for message properties). Handles missing/broken assertions, deserializer registration (registereffectdeserializer / registerdatadeserializer), and crate-specific trace helpers in testutils.rs. Use when a trace assertion test fails, when updating…

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Failing and flaky tests. The repository describes itself as: A fully open source node client for Cardano, written in Rust. The licence is Apache-2.0.

When your agent uses it

  • A trace assertion test fails
  • Updating asserttracematch expectations
  • Fixing simulation trace mismatches
  • The user runs /stage-trace-test

Example prompts

  • “/stage-trace-test”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Identify the failing test
  2. Run the test and capture the diff
  3. Diagnose the failure type
  4. Translate actual trace entries to TraceMatch values
  5. Create new helpers when needed
  6. Verify

What it can do on your machine

Read from SKILL.md and the folder at commit 34a4530. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • cargo

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Stage Trace Test loads about 1.4k tokens when it runs. Until then it costs about 169 tokens; SKILL.md has 521 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~169
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from pragma-org/amaru at commit 34a4530, republished under its Apache-2.0 licence (© pragma-org). 521 words, ~1,426 tokens.

Download SKILL.mdSave it as .claude/skills/stage-trace-test/SKILL.md (or your agent's skills folder).
name
stage-trace-test
description
Fix failing pure-stage simulation tests that use `assert_trace_match()` by running the test, reading the trace diff in the failure output, and updating the expected trace using `tm_*` helpers from `amaru_pure_stage` (prefer `tm_state_match` for targeted state checks, `tm_send_match` for message properties). Handles missing/broken assertions, deserializer registration (`register_effect_deserializer` / `register_data_deserializer`), and crate-specific trace helpers in `test_utils.rs`. Use when a trace assertion test fails, when updating `assert_trace_match` expectations, when fixing simulation trace mismatches, or when the user runs /stage-trace-test.

Fix assert_trace_match Test Failures

Update failing pure-stage simulation tests so assert_trace_match() passes again.

Workflow

1. Identify the failing test

The user will name a test function, file, or stage. Locate it under crates/amaru-consensus/src/stages/<stage>/tests.rs (or amaru-pure-stage tests). Read the stage's test_setup.rs for register_guards(), setup(), and any existing te_* / tm_* helpers.

2. Run the test and capture the diff
bash
cargo test <test_name> -p amaru-consensus -- --nocapture

Or for pure-stage tests:

bash
cargo test <test_name> -p amaru-pure-stage -- --nocapture

On trace mismatch, pretty_assertions::assert_eq! prints a diff between left (actual trace) and right (expected TraceMatch list). Read both sides carefully before editing.

3. Diagnose the failure type

A. Trace content mismatch — actual entries differ from expected. Update the assert_trace_match call.

B. Generic/untyped representation — actual shows typetag with Map/array structure instead of a typed Rust value. A deserializer is missing from register_guards() in the stage's test_setup.rs:

  • External effects → amaru_pure_stage::register_effect_deserializer::<T>().boxed()
  • Messages, state, tuples, and other SendData → amaru_pure_stage::register_data_deserializer::<T>().boxed()

Re-run the test after adding guards; the trace should show properly typed values.

C. No assertion or broken assertion — test has no assert_trace_match, or the expected list is too wrong to patch incrementally. Replace the expected slice with &[] temporarily, run the test, and use the full actual trace printed on the left side as the starting point.

4. Translate actual trace entries to TraceMatch values

Use tm_* constructors from amaru_pure_stage::trace_match (re-exported via test_utils.rs):

Trace entry kindExact matchProperty match (preferred when possible)
Statetm_state(stage, &state)tm_state_match(stage, |s| ...)
Inputtm_input(stage, &msg)—
Sendtm_send(from, to, msg)tm_send_match(from, to, |m| ...), tm_send_type::<T>(from, to)
Terminatetm_terminate(stage)—
Terminatedtm_terminated(stage, reason)—
AddStagetm_add_stage(at, name)—
WireStagetm_wire_stage(parent, child)tm_wire_stage_state, tm_wire_stage_state_supervised

Matching strategy:

  • Prefer property matchers (tm_state_match, tm_send_match) when only part of a value matters (e.g. a single field changed, dynamic stage suffixes, random peer IDs).
  • Use exact matchers (tm_state, tm_send, tm_input) when the full value is stable and intentional.
  • For external effects with variable payloads, use or create a property matcher (see tm_record_metrics in validate_block/test_setup.rs as a pattern).

Existing te_* helpers in test_utils.rs or per-stage test_setup.rs build TraceEntry values. Any TraceEntry converts to TraceMatch via From, so te_load_header(...) etc. still work inside assert_trace_match lists.

Show full SKILL.md (188 more words)Show less
5. Create new helpers when needed

When a trace entry type has no suitable tm_* helper:

  • Generic, reusable → add to crates/amaru-pure-stage/src/trace_match.rs
  • Consensus-specific (particular effect types, stage naming conventions) → add to crates/amaru-consensus/src/stages/test_utils.rs or the stage's test_setup.rs

Follow existing patterns:

  • tm_record_metrics — property match on Effect::External with cast_ref
  • tm_state_match / tm_send_match in trace_match.rs — typed cast_ref + predicate + human-readable description string
6. Verify

Re-run the failing test until it passes. Then run the stage's full test module to catch regressions:

bash
cargo test -p amaru-consensus --test tests stages::<stage>::tests

Or the relevant test file filter. Ensure cargo clippy-amaru is clean if you added new helpers.

Key files

  • crates/amaru-pure-stage/src/trace_match.rs — assert_trace_match, all tm_* helpers
  • crates/amaru-consensus/src/stages/test_utils.rs — run_simulation, assert_trace, shared te_* / tm_*
  • crates/amaru-consensus/src/stages/<stage>/test_setup.rs — register_guards(), stage-specific te_* / tm_*
  • crates/amaru-consensus/src/stages/<stage>/tests.rs — test bodies with assertions

Common pitfalls

  • Resume entries are filtered out by assert_trace_match; do not include them in expected lists.
  • Stage names in traces may include random suffixes (e.g. tp-1/child-abc). Use contains matchers (tm_send, tm_wire_stage) or property predicates rather than exact names when appropriate.
  • register_guards() return value must be held for the test lifetime (typically _guards or guards in setup()).
  • When migrating from assert_trace to assert_trace_match, replace te_* literals with tm_* equivalents only where exact matching is too brittle.

© pragma-org, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/stage-trace-test of pragma-org/amaru.

Open the folder on GitHubat commit 34a4530

Compare with similar skills

Stage Trace Test next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Stage Trace Test compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Stage Trace Test this skillpragma-org/amaru116—~1.4kAutomated safety check: PassApache-2.0
Swig Testswig/swig6.3k—~2.3kAutomated safety check: PassCustom licence
Triage CI FailureDataDog/datadog-agent3.8k—~2.3kAutomated safety check: PassApache-2.0
Dynamo Jira TicketDynamoDS/Dynamo2k—~1.1kAutomated safety check: PassApache-2.0
Fix Ready PRsfastrepl/anarlog9.5k—~1.4kAutomated safety check: PassMIT
Trx Analysismicrosoft/vstest969—~1.8kAutomated safety check: PassMIT

Similar skills

  • Swig Test

    swig/swig

    Run SWIG test suite for specific languages. An agent skill from swig/swig.

    6.3k GitHub stars~2.3k tokensUpdated 2 days ago
    Testing & QAAuto-check passed
  • Triage CI Failure

    DataDog/datadog-agent

    Official

    Classify a failed CI as either caused by an active incident, flakiness, or a true code regression.

    3.8k GitHub stars~2.3k tokensUpdated today
    Testing & QAAuto-check passed
  • Dynamo Jira Ticket

    DynamoDS/Dynamo

    Create structured Jira tickets for Dynamo from bug reports, failing tests, or feature requests.

    2k GitHub stars~1.1k tokensUpdated today
    Testing & QAAuto-check passed
  • Fix Ready PRs

    fastrepl/anarlog

    Inspect every open non-draft PR for CI failures and unresolved Cursor Bugbot findings, then fix them on the existing PR branches.

    9.5k GitHub stars~1.4k tokensUpdated today
    Testing & QAAuto-check passed
  • Trx Analysis

    microsoft/vstest

    Official

    Parse and analyze Visual Studio TRX test result files. An agent skill from microsoft/vstest.

    969 GitHub stars~1.8k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Wio

    workersio/skills

    Testing workflow skill for finding high-value test candidates, writing focused tests, generating realistic workloads, reviewing test value, and diagnosing test-suite health.

    190 GitHub stars~5.8k tokensUpdated 2 mo ago
    Testing & QAAuto-check passed

Categories

Questions about Stage Trace Test

What does Stage Trace Test do?

Fix failing pure-stage simulation tests that use asserttracematch() by running the test, reading the trace diff in the failure output, and updating the expected trace using tm helpers from…. Stage Trace Test is an agent skill from pragma-org/amaru. Fix failing pure-stage simulation tests that use asserttracematch() by running the test, reading the trace diff in the failure output, and updating the expected trace using tm helpers from amarupurestage (prefer tmstatematch for targeted state checks, tmsendmatch for message properties).

When should I use Stage Trace Test?

Stage Trace Test fits situations like: A trace assertion test fails; updating asserttracematch expectations; fixing simulation trace mismatches; the user runs /stage-trace-test.

How do I install Stage Trace Test in Claude Code?

Run `npx skills add pragma-org/amaru --skill stage-trace-test -a claude-code`. Or copy the skill folder (.agents/skills/stage-trace-test in pragma-org/amaru) into .claude/skills/stage-trace-test in your project. Claude Code loads it when a task matches its description.

How do I install Stage Trace Test in Codex?

Run `npx skills add pragma-org/amaru --skill stage-trace-test -a codex`. Or copy the skill folder (.agents/skills/stage-trace-test in pragma-org/amaru) into .agents/skills/stage-trace-test in your project. Codex loads it when a task matches its description.

Can I use Stage Trace Test in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add pragma-org/amaru --skill stage-trace-test -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/stage-trace-test, .gemini/skills/stage-trace-test, .github/skills/stage-trace-test and .opencode/skills/stage-trace-test in your project.

What does Stage Trace Test need to run?

Going by SKILL.md and its folder, Stage Trace Test needs the command-line tools its instructions call (cargo).

Does Stage Trace Test access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Stage Trace Test safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Stage Trace Test use?

Stage Trace Test is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Stage Trace Test use?

About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Stage Trace Test?

Skills that share tags, products or a category with Stage Trace Test: Swig Test (swig/swig, 6.3k stars), Triage CI Failure (DataDog/datadog-agent, 3.8k stars), Dynamo Jira Ticket (DynamoDS/Dynamo, 2k stars) and Fix Ready PRs (fastrepl/anarlog, 9.5k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Stage Trace Test?

pragma-org (a GitHub organization) maintains it in pragma-org/amaru, which has 116 GitHub stars. The repository was last updated on October 7, 2026.

Source: pragma-org/amaru on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.