card-test

A fixed recipe for writing tests that cast a game card and check the result. It uses the project's game scenario and casting test helpers.

In plain words
What is it for?
Use it when adding or updating engine tests for card effects, including cards with variable costs, multiple targets, modes, or changes to players' life totals and zones.
Why use it?
It prevents recurring test mistakes, such as building targets incorrectly, submitting incomplete choices, or checking the wrong starting state.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/phase-rs/phase/card-test
Any agent
npx skills add phase-rs/phase --skill card-test
Clone the repo
git clone --depth 1 https://github.com/phase-rs/phase

Made for: Claude Code, Codex.

Per session 101 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,385 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00101 $0.02385
Opus 5 $0.00051 $0.01192
Sonnet 5 $0.00020 $0.00477
Haiku 4.5 $0.00010 $0.00238

Measured 2d ago against content hash 83f3bab672e4, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

card-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/card-test/SKILL.md · 169 lines

How it starts

The opening of the file, as written. The whole thing — 169 lines — stays where its author put it; the contents beside it link to each section on GitHub.

card-test — the canonical cast-pipeline test recipe

This skill gives ONE rigid recipe for runtime engine tests that cast a spell and assert its effect. It exists because six test-harness foot-guns recur; the [SpellCast] driver and [CastOutcome] (in crates/engine/src/game/scenario.rs) make them structurally impossible when you follow this recipe.

Reference ports that demonstrate the pattern:

  • crates/engine/tests/chord_of_calling.rs — X-spell, convoke, final_waiting_for() boundary.
  • crates/engine/src/game/casting.rsexsanguinate_* (life deltas, 2- and 3-player), vicious_rivalry_* (X-cost filter + zones), kozileks_command_modes_* (modal + X + multi-target).

The recipe

use engine::game::scenario::{GameScenario, GameRunner};
// ... typed imports for the effect under test ...

#[test]
fn my_card_does_the_thing() {
    // 1. BUILD STATE via GameScenario (or wrap a raw GameState with
    //    GameRunner::from_state(state) when the test builds state imperatively).
    let mut scenario = GameScenario::new();
    scenario.at_phase(Phase::PreCombatMain);
    let spell = scenario
        .add_spell_to_hand_from_oracle(P0, "My Card", /* is_instant */ true, ORACLE)
        .id();
    // ... stage targets / mana / library as needed ...
    let mut runner = scenario.build();

    // 2. CAST through the pipeline. Declare INTENT, never targets-by-hand.
    let outcome = runner
        .cast(spell)
        .modes(&[0, 2])              // modal "choose N" — omit if non-modal
        .x(3)                        // announce X — omit if non-X
        .target_player(P1)           // declare a player intent (reusable across slots)
        .target_objects(&[victim])   // declare object intents (one per slot, in order)
        .convoke_with(&[creature])   // tap creatures to pay via Convoke — omit otherwise
        .resolve();

    // 3. ASSERT via CastOutcome deltas — behavior/semantics, never AST internals.
    outcome.assert_life_delta(P1, -3);
    outcome.assert_zone(&[victim], Zone::Exile);
    outcome.assert_hand_drawn(P0, 1);
    // For "no further prompt" boundaries (e.g. fail-to-find), inspect the halt state:
    assert!(matches!(outcome.final_waiting_for(), WaitingFor::Priority { .. }));
}

Read the full file on GitHub · 169 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 169 lines · 101 tokens per session scan A 83f3bab672e4

Subscribe to this mod's changes

card-test is a skill published in the GitHub repository phase-rs/phase (259 stars, last pushed 2d ago), licensed Apache-2.0. It adds 101 tokens to every session and 2,385 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

qa-cli-mcp-api

Select and run explicitly requested, risk-based QA for Anarlog's CLI, webhooks, stdio MCP, hosted Cloud API, and remote MCP. Test only affected lanes unless comprehensive coverage is requested.

fastrepl/anarlog · 47 tokens

product-update-newsletter

Draft, update, or audit a crisp, changelog-grounded Anarlog product-update newsletter in Loops (app.loops.so) for a desktop release. Use after the changelog is merged, when asked to draft, revise, or pre-send check the release announcement email.

fastrepl/anarlog · 62 tokens

release-new-version

Release a new desktop stable version for Anarlog. Use when asked to cut, publish, or prepare a new stable desktop release after checking and merging the changelog.

fastrepl/anarlog · 38 tokens

sqlite-schema-design

Design or review schemas for crates/cloudsync using SQLite Sync constraints, not generic SQLite advice. Use when adding synced tables, changing synced columns, or planning CloudSync-safe migrations.

fastrepl/anarlog · 42 tokens

fix-ready-prs

Inspect every open non-draft PR for CI failures and unresolved Cursor Bugbot findings, then fix them on the existing PR branches. Use when asked to check active PRs, triage ready PRs, fix CI, or address Bugbot comments.

fastrepl/anarlog · 55 tokens

reactive-sqlite-ui

Build SQLite-backed reactive UI in apps/desktop using stable patterns for reads, selection, forms, writes, and loading states. Use when implementing or reviewing screens built on useDrizzleLiveQuery and SQLite mutations.

fastrepl/anarlog · 53 tokens