phase: Skill for Claude Code

.claude/skills/casting-stack-conditions/SKILL.md

casting-stack-conditions is a skill for Claude Code from phase-rs/phase. It costs 39 tokens per session (5,446 once invoked), scanned A, original, Apache-2.0.

Guidance for changing the rules-heavy parts of a digital Magic: The Gathering engine, including casting, the stack, priority, and conditions. The stack is the game area where spells and abilities wait to resolve.

In plain words
What is it for?
Use it when changing casting steps, optional costs, targeting, conditions, waiting states, stack resolution, or related tests.
Why use it?
It reduces the risk of implementing behavior that breaks the game's official rules or works for one card but fails for other cards using the same system.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is phase-rs/phase's own configuration. It tells Claude Code how to work on phase itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything phase configures →

Reuse

Borrowing it

Nothing to install: this file belongs to phase-rs/phase. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/phase-rs/phase/main/.claude/skills/casting-stack-conditions/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/phase-rs/phase

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for casting-stack-conditions

README.md
[![agentmods](https://agentmods.dev/badge/skills/phase-rs/phase/casting-stack-conditions/github.svg)](https://agentmods.dev/skills/phase-rs/phase/casting-stack-conditions)
Your own site
<a href="https://agentmods.dev/skills/phase-rs/phase/casting-stack-conditions"><img src="https://agentmods.dev/badge/skills/phase-rs/phase/casting-stack-conditions/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for casting-stack-conditions

Your own site · 80×15
<a href="https://agentmods.dev/skills/phase-rs/phase/casting-stack-conditions"><img src="https://agentmods.dev/badge/skills/phase-rs/phase/casting-stack-conditions.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 39 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,446 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Rogue Agent · line 438
    Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
    Fix: Prevent the skill from modifying its own code, SKILL.md, or configuration files. Treat skill files as read-only at runtime.
How audits are shown
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.1 $0.00039 $0.05446
Opus 5.5 $0.00016 $0.02178
Sonnet 5.5 $0.00008 $0.01089
Haiku 4.5 $0.00004 $0.00545

Measured 28d ago against content hash dec4a1bc7bb6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

casting-stack-conditions 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 28d 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/casting-stack-conditions/SKILL.md · 440 lines

How it starts

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

Casting, Stack & Condition Systems

Hard rules — casting, stack, and priority are the most rules-dense areas of MTG (see CLAUDE.md § Design Principles):

  1. CR-correctness is non-negotiable. Casting (CR 601), activated abilities (CR 602), triggered abilities (CR 603), static abilities (CR 604), mana abilities (CR 605), stack resolution (CR 608), and priority (CR 117) are precisely specified. Every implementation must be verified against the relevant CR section and annotated. If you cannot cite the CR that governs a behavior, you have not validated it.
  2. Build for the class, not the card. Payment helpers (pay_mana_cost, pay_ability_cost), targeting, and condition checks are shared building blocks used by every spell and ability. Changes here must work for the entire class — never special-case a single card's casting behavior.
  3. Test the exact rules behavior. Every new WaitingFor state, casting step, or condition check needs tests that verify the CR-specified behavior, including edge cases (e.g., fizzle on illegal targets, intervening-if re-check at resolution). Test the building block, not one card's interaction.

Reference for the spell casting pipeline, stack resolution, sub_ability chaining, and all condition systems. Use this to understand how spells go from hand → stack → resolution, and where to extend for new casting features.

Before you start: Trace Ward for a casting-time interaction, or TriggerCondition::LifeGainedThisTurn for a condition that's checked at both trigger and resolution time.


Casting Flow — crates/engine/src/game/casting.rs

Entry point: handle_cast_spell(state, player, card_id, events)

CastSpell action
  │
  ▼
1. Find card in hand (or command zone for Commander)
  │
  ▼
2. Get ability: obj.abilities[0].clone()
   (vanilla permanents get placeholder Unimplemented)
   NOTE: Modal spells (obj.modal.is_some()) skip to step 2b
  │
  ▼
2b. Modal detection → WaitingFor::ModeChoice
   Player selects modes → handle_select_modes() builds chained ResolvedAbility
   → proceeds to targeting (walks sub_ability chain for first target filter)
  │
  ▼
3. Casting prohibition checks (prepare_spell_cast)
   ├─ Zone castability (hand, command, exile w/ permission, graveyard w/ escape/permission)
   ├─ CantCastFrom statics (Grafdigger's Cage) — is_blocked_from_casting_from_zone()
   ├─ CantCastDuring statics (Teferi) — is_blocked_by_cant_cast_during()
   ├─ PerTurnCastLimit statics (Rule of Law) — is_blocked_by_per_turn_cast_limit()
   │  └─ Uses ProhibitionScope (Controller/Opponents/AllPlayers) + optional spell_filter
   └─ Temporary zone restrictions — is_blocked_by_cast_only_from_zones()
  │
  ▼
4. Validate timing
   ├─ Instant / Flash → anytime
   └─ Sorcery-speed → main phase + empty stack + active player
  │
  ▼
5. Commander color identity check (Commander only)
  │
  ▼
6. Calculate mana cost (base + commander tax if from command zone)
  │
  ▼
7. Build ResolvedAbility from AbilityDefinition
   └─ Recursively converts sub_ability chain via build_resolved_from_def()
  │
  ▼
8. Handle targeting
   ├─ Auras: extract Enchant keyword filter
   └─ Others: extract_target_filter_from_effect()
       ├─ 0 legal targets → error
       ├─ 1 legal target → auto-assign, proceed
       └─ >1 → WaitingFor::TargetSelection
  │
  ▼
9. pay_and_push_with_lock()
   ├─ X in cost → WaitingFor::ManaPayment
   ├─ pay_mana_cost() — shared mana payment building block (see below)
   ├─ Move card to Zone::Stack
   ├─ Record commander cast if applicable
   └─ stack::push_to_stack() creates StackEntry
  │
  ▼
10. Return WaitingFor::Priority

Read the full file on GitHub · 440 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. 28d ago Changed dec4a1bc7bb6
  2. 2mo ago First seen · 440 lines · 39 tokens per session scan A 6dfd8816a351

Subscribe to this mod's changes

casting-stack-conditions is a skill published in the GitHub repository phase-rs/phase (312 stars, last pushed today), licensed Apache-2.0. It adds 39 tokens to every session and 5,446 once invoked, about $0.0002 per session on Opus 5.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

anarlog

Query Anarlog meetings, notes, summaries, transcripts, participants, action items, and recurring history, or import a local recording. Use when a user asks about their Anarlog meeting data or needs meeting context for another task.

fastrepl/anarlog · 50 tokens

graphify-windows

Turn any folder of files into a navigable knowledge graph with community detection, an honest audit trail, and three outputs: interactive HTML, GraphRAG-ready JSON, and a plain-language GRAPHREPORT.md.

saeedkolivand/ai-job-hunter-app · 75 tokens

lessons

How to propose and query distilled lessons (the experiential memory). Only project-steward persists; every other agent proposes/queries. Use when you discover a durable lesson or need prior experience for the current task.

saeedkolivand/ai-job-hunter-app · 45 tokens

webgl-standards

DORMANT (ADR-0017, 2026-07-20) - the TERMINAL VELOCITY scroll-film was retired and apps/landing is a static site with no GL surface; this skill is preserved for any future WebGL rebuild (conventions, verified version pins, playhead/scroll-rig/VAT/Gerstner/post-chain patterns, budgets, gate + semantic-layer machinery).…

saeedkolivand/ai-job-hunter-app · 108 tokens

agent-cli-standards

Agent-facing CLI standards — the argv-sentinel binary mode, the thin-client-over-the-bridge rule, allowlist projections, prompt-fencing third-party text, the stable machine-readable output contract, exit codes, throttling, and destructive-command operability. Load for changes under extensionbridge/agentcli.rs…

saeedkolivand/ai-job-hunter-app · 83 tokens

webgl-gate-audit

Procedures for auditing apps/landing TERMINAL VELOCITY WebGL phase gates - driving the browser to exact playhead positions across the 9 scenes, screenshot discipline, scrub + VAT determinism (scrub down THEN rewind to the same playhead -> identical frame), FPS sampling at the risk scenes, draw-call + bundle-size…

saeedkolivand/ai-job-hunter-app · 123 tokens