casting-stack-conditions

Implement MTG casting pipelines, stack resolution, and waiting-for state handling.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/gamajose/MagicTheGathering --skill casting-stack-conditions-gamajose
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: casting-stack-conditions
Source: https://github.com/gamajose/MagicTheGathering/tree/main/.claude/skills/casting-stack-conditions
Command: npx skills add https://github.com/gamajose/MagicTheGathering --skill casting-stack-conditions-gamajose

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Casting, stack, and ability-resolution systems in MTG rules engines are complex and error-prone. This Skill provides a structured reference for understanding and implementing the casting pipeline, stack behavior, and condition handling to ensure CR-correct gameplay.

Core Features & Use Cases

  • Reference for the end-to-end casting flow from hand to stack to resolution, including WaitingFor state handling and mode/delay interactions.
  • Guidance for extending with new costs, optional costs, and sub-abilities, plus modal and resolution-time interactions.
  • Use Case: implement a new cast spell with a modal choice and intervening-if conditions or handle activated abilities with mana and tap costs.

Quick Start

Follow the Casting, Stack & Condition Systems guide to implement casting flow and resolution logic in your MTG rules engine.

Frequently Asked Questions about casting-stack-conditions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement the MTG casting flow from hand to stack resolution?

The MTG stack resolution process handles spells and activated or triggered abilities by coordinating WaitingFor state interactions, mode selections, and delay interactions through structured resolution pipelines like build_resolved_from_def.

How do I handle modal abilities and intervening-if conditions in an MTG rules engine?

Yes, you can handle activated abilities with mana and tap costs by using the handle_activate_ability function, which integrates cost payments and effect resolution within the same structured stack framework as spell casting.

What is the best way to manage WaitingFor states during stack resolution?

Targeting and mana costs in MTG rules engines are managed through dedicated functions like handle_select_targets and pay_mana_cost, which validate legal targets and process mana payments before pushing effects onto the stack.

How do I add new optional costs and sub-abilities to an existing MTG casting pipeline?

You should use a structured casting and stack resolution system when building an MTG rules engine to prevent common errors in complex scenarios involving modal choices, triggered effects, and multi-step interactions.