Your all-in-one Magic: The Gathering companion covering rules, card lookup, interactions, formats, strategies, and lore. Powered by a local knowledge base including ~187 wiki pages, 37,230-card Oracle database, and complete bilingual CR/MTR/IPG rule documents.
DirectoryContentswiki/concepts/Rule concepts, mechanics, strategies (~174 pages)wiki/entities/Characters, organizations, productswiki/sources/Source document summarieswiki/synthesis/Comparative analysisraw/cr/Complete Comprehensive Rules (bilingual)raw/mtr/Magic Tournament Rulesraw/ipg/Infraction Procedure Guide
Triggered by: "how does first strike + deathtouch work", "stack resolution order", "layer system"
Workflow:
wiki/concepts/rule_search.py to search the local rules indexKey rules quick reference:
Triggered by: user mentions a card name (in either language, fuzzy, or slang)
Workflow:
card_search.py for unified searchCard name format:
Chinese Name (English Name)Chinese NameTriggered by: user describes a multi-card scenario ("what happens if...")
Analysis framework:
Triggered by: user discusses deck archetypes, format selection, banned/restricted lists
Format pages: standard.md / pioneer.md / modern.md / legacy.md / vintage.md
Commander: commander.md / cedh.md
When translating MTG deck guides or strategy articles:
name_translator.py for official Chinese translationsbash
# Card lookup (supports Chinese/English fuzzy search)
python3 ./raw/tools/mtg_wiki/card_search.py "Lightning Bolt"
python3 ./raw/tools/mtg_wiki/card_search.py "闪电击"
# Rules lookup (by rule number or keyword)
python3 ./raw/tools/mtg_wiki/rule_search.py "101.4"
python3 ./raw/tools/mtg_wiki/rule_search.py "stack"
# Name translation (EN↔CN)
python3 ./raw/tools/mtg_wiki/name_translator.py "Lightning Bolt"
API priority:
https://mtgch.com/api/v1/) — Chinese first, bilingualhttps://api.scryfall.com/) — English primaryLayerEffectExample1Copy effectsClone2Control-changingBetray3Text-changingAlter Reality4Type-changingBlood Moon vs. Urborg5Color-changingSleight of Mind6Add/Remove abilitiesTidebinder / Suppression Field7Power/ToughnessVarious +/- P/T
Key distinctions:
text
Untap → Upkeep → Draw → Precombat Main → Combat → Postcombat Main → End
APNAP (CR 101.4):
wiki/concepts/ first for relevant pagesChinese (English) format[[slug|display]] referencesFileContentsraw/cr/1.mdGame concepts, priority, costsraw/cr/6.mdSpells, abilities, layer system (613)raw/cr/7.mdKeyword abilities (702), keyword actions (701)raw/cr/glossarycn.mdChinese terminology glossary
Decision trees: wiki/branches/referee/decision-trees/
Analysis frameworks: wiki/branches/referee/frameworks/
Judge rules questions must:
This published skill contains only the core code. For the complete ~187 wiki pages + 37,230 card database + bilingual CR/MTR/IPG rules (~13MB), clone the full repository:
bash
git clone https://github.com/RaymondYHH/mtg-skill.git
cd mtg-skill/magic-skill
Full repository contents:
wiki/ — 187 pages of local knowledge (concepts, entities, sources, synthesis)raw/cr/ — Complete Comprehensive Rules (bilingual)raw/mtr/ — Magic Tournament Rules (bilingual)raw/ipg/ — Infraction Procedure Guide (bilingual)raw/data/ — 37,230-card Oracle database + analysis scriptsAfter installing, run python3 raw/tools/mtg_wiki/build_indices.py to build local indices.
card_search.py or API, never from memory