Build and manage Magic: The Gathering Commander/EDH deck lists in Moxfield-compatible text format. Use this skill when the user wants to create a new MTG deck, add or remove cards from a deck, tag cards, look up card info, analyze deck composition (mana curve, creature count, color breakdown, etc.), or verify a deck against Commander rules. Triggers on any mention of MTG, Magic the Gathering, Commander, EDH, deck building, or Moxfield deck lists.
Build Commander/EDH deck lists as Moxfield-compatible text files. Decks are managed under ~/.mtg/decks/<uuid>/ as directory-based projects with YAML metadata.
Each deck is a directory containing:
~/.mtg/decks/<uuid>/
meta.yml Deck metadata (name, format)
commanders.txt Commander card(s), 1-2 lines
main.txt Main deck cards
sideboard.txt Sideboard cards
considering.txt Cards under consideration
primer.md Deck primer (strategy guide & card rationale)
batches/ Workspace for batch lookup files
All scripts are in this skill's scripts/ directory. Use full paths when invoking:
SKILL_DIR="<this skill's base directory>"
# Card lookup (functional data only)
python3 "$SKILL_DIR/scripts/scryfall.py" search "counter spell" # fuzzy name search
python3 "$SKILL_DIR/scripts/scryfall.py" exact "Counterspell" # exact name lookup
python3 "$SKILL_DIR/scripts/scryfall.py" batch cards.txt # bulk lookup from file
python3 "$SKILL_DIR/scripts/scryfall.py" query "t:creature o:draw cmc<=3" # advanced search
# Deck management
python3 "$SKILL_DIR/scripts/deck.py" create "Deck Name" "Commander Name"
python3 "$SKILL_DIR/scripts/deck.py" list
python3 "$SKILL_DIR/scripts/deck.py" show "<uuid>"
python3 "$SKILL_DIR/scripts/deck.py" path "<uuid>" # deck directory
python3 "$SKILL_DIR/scripts/deck.py" path "<uuid>" main # specific file
python3 "$SKILL_DIR/scripts/deck.py" path "<uuid>" commanders # commanders file
python3 "$SKILL_DIR/scripts/deck.py" path "<uuid>" batches # batches directory
# Templates
python3 "$SKILL_DIR/scripts/deck.py" template create "Balanced Commander"
python3 "$SKILL_DIR/scripts/deck.py" template list
python3 "$SKILL_DIR/scripts/deck.py" template show "balanced"
python3 "$SKILL_DIR/scripts/deck.py" template path "balanced"
python3 "$SKILL_DIR/scripts/deck.py" template delete "balanced"
# Deck verification
python3 "$SKILL_DIR/scripts/verify.py" check "<uuid>"
python3 "$SKILL_DIR/scripts/verify.py" check "<uuid>" --template "balanced"
The query subcommand uses Scryfall's full search syntax:
python3 "$SKILL_DIR/scripts/scryfall.py" query "t:creature o:draw cmc<=3"
python3 "$SKILL_DIR/scripts/scryfall.py" query "t:instant id:dimir o:counter"
python3 "$SKILL_DIR/scripts/scryfall.py" query "t:land id:gruul"
python3 "$SKILL_DIR/scripts/scryfall.py" query "is:commander id:simic"
Common syntax:
o:text — oracle text contains "text"t:type — type line contains "type"c:color / id:color — color / color identity (w/u/b/r/g)cmc:N, cmc>=N, cmc<=N — mana value comparisonsis:commander — legal as commanderResults are returned as a compact table (up to 225 cards across 3 pages).
Building a deck is a collaborative, conversational process. NEVER auto-fill an entire deck list in one shot. The user's preferences, playstyle, and vision drive every card choice. Work through these phases in order:
scryfall.py exact — confirm it's a legendary creature legal in CommanderBefore looking up any cards, understand the user's goals. Ask about these areas across 1-3 rounds of questions (do not dump all questions at once — prioritize and follow up naturally):
Adapt questions to context — if the user already expressed strong opinions (e.g., "I want a landfall sacrifice deck"), skip questions they've already answered. If they mention a template, use it as a structural guide but still ask about the Plan category.
The "Plan" slots (strategy cards) are the heart of the deck and the most personal part. Before filling them:
After the Plan cards are settled, fill in the supporting categories (Ramp, Card Advantage, Targeted Disruption, Mass Disruption, Lands). For each category:
verify.py check to confirm legality (100 cards, singleton, color identity, Commander-legal)verify.py check --template and share the resultsAfter the deck is finalized and verified, write a primer.md file in the deck directory. This is a comprehensive strategy guide that documents the deck's design rationale, how it plays, and why each card was included. See Primer Format below for the full structure.
The primer should be written after Phase 5 completes, using information gathered throughout the entire build process (the interview answers from Phase 2, strategic axes from Phase 3, card choices from Phase 4, and verification results from Phase 5).
Once the user has confirmed a commander and a deck name (can be decided at any point during the interview):
deck.py create "<name>" "<commander>"deck.py path "<uuid>" main for adding cardsscryfall.py exact "<name>" (or search for fuzzy match, query for advanced search)main.txt): 1 <Exact Card Name> with any tagsreferences/moxfield-format.md for the full line formatprimer.md — add the card to the appropriate role table and note its role. If the card changes strategic interactions or win conditions, update those sections too.deck.py path "<uuid>" mainprimer.md — remove the card from its role table. If it was mentioned in synergies, win conditions, or gameplay sections, update or remove those references. If the card is being cut in favor of another, add it to the "Alternatives Considered" section with the reason it was cut.#TagName#!TagNameExample: 1 Sol Ring #Ramp #!ArtifactSynergy
deck.py path "<uuid>" batchesscryfall.py batch <path-to-file>To answer questions about deck composition (mana curve, creature count, color distribution, etc.):
scryfall.py batch <tempfile>Run the verifier to check Commander rules compliance:
python3 "$SKILL_DIR/scripts/verify.py" check "<uuid>"
This checks:
To also compare against a template:
python3 "$SKILL_DIR/scripts/verify.py" check "<uuid>" --template "balanced"
Templates define target card counts per category for deck composition. Templates are resolved from two locations (user-space takes priority):
~/.mtg/templates/) — personal templates created via deck.py template createassets/ in this skill's directory) — pre-packaged templates shipped with the skilldeck.py template create "Balanced Commander"deck.py template path "balanced"// Template: Balanced Commander
// Description: Standard balanced 100-card Commander deck
Lands: 38
Ramp: 10-15
Card Draw: 10
Board Wipes: 3-5
Targeted Removal: 8-10
Creatures: 25-30
Ramp matches #Ramp or #!Ramp)verify.py check "<uuid>" --template "balanced" to compareA user-space template with the same name as a bundled template will take priority. Bundled templates cannot be deleted via deck.py template delete.
The primer.md file is a strategy guide written for someone picking up the deck for the first time. It should be detailed, opinionated, and explain why cards are in the deck — not just list them. Write it in a confident, analytical tone.
A header block with:
Then a paragraph explaining the commander's key ability and how the deck exploits it. Highlight any non-obvious mechanical interactions (e.g., "each turn" meaning each player's turn in multiplayer).
Summarize the user's requirements from the Phase 2 interview:
The 2-3 strategic axes identified in Phase 3. For each axis:
Numbered list of how the deck actually closes games. Each entry should name specific cards and describe the board state needed to win through that line.
Named combo/synergy packages with explanations. For each:
Group cards by functional role (matching the deck's tag categories where applicable). Use tables with columns: Card | Role. Write the Role column as a concise explanation of what the card does in this deck, not generic card evaluation. Include a count in each category heading.
Categories typically include: Token Doublers, Card Advantage, Ramp, Targeted Removal, Protection, Board Wipes, Lands — but adapt to the deck's actual structure and tags.
For lands, explain the mana base philosophy (e.g., Plains-heavy for specific synergies) and call out notable utility lands.
Describe the typical game arc in 3 phases:
Include Priority plays for each phase as ordered lists.
Three subsections:
considering.txt with why they're interesting and what they might replaceSummary counts: nonland cards, land sources (broken down), creatures, enchantments, artifacts, instants/sorceries, planeswalkers. Note any cards that serve dual roles (e.g., MDFCs counted as both land and spell).
The primer must stay in sync with the actual deck list. When cards are added, removed, or swapped:
Do NOT regenerate the entire primer for small changes — edit the affected sections in place.
scryfall.py before making any claims about a card.//).Color Identity from Scryfall output against the commander's.commanders.txt, not main.txt. Supports partner commanders (up to 2 lines).See references/moxfield-format.md for the complete Moxfield decklist format specification, including line syntax, tag format, and examples.