Skip to content
Skillpedia
General coding6.6k Β· #13807

card-game

What it does

This skill guides building card games where cards move between a deck, a hand, a play area, and a discard pile. It is for developers making deckbuilders, collectible card games, or roguelike card games.

When to use it

  • βœ“When you are building a deckbuilder or collectible card game.
  • βœ“When you need draw, shuffle, and reshuffle rules that work correctly.
  • βœ“When you want card effects to resolve in a clear and predictable order.

Skill link

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/genres/card-game/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/genres/card-game/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œI am making a deckbuilder. Can you set up the deck, hand and discard piles, and make the turn structure work?”

5 new skills a week. 1 minute to read.

How it works

The agent models cards as data with costs and effects, sets up zones for the deck, hand, play area, and discard, and writes the turn order. It resolves each card effect in a fixed sequence so results are predictable.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Card Game

A playbook for card games β€” card data, the deck/hand/discard zones, the turn structure, and how card effects resolve. This is a compositional skill: it models cards as data and wires them to UI. It does not re-teach data assets or UI nodes; it defines the zone model, the draw machinery, and the effect-resolution rules that keep a card game correct and bug-free.

When to use

  • Use when building any game where the core objects are cards moving between zones (deck β†’ hand β†’ play β†’ discard): deckbuilder, TCG/CCG, solitaire, roguelike deckbuilder.
  • Use when designing draw/shuffle/reshuffle, turn structure, card costs, or how effects resolve.

When not to use: board/tile state with matching rules β†’ puzzle. RPG with an incidental card battler β†’ start from rpg. For defining cards as assets, use godot-resources / unity-scriptableobjects; for the hand/drag UI, use godot-ui-control.

Core loop

Draw to your hand β†’ spend resources to play cards β†’ effects resolve and change the board β†’ end the turn (cleanup/discard) β†’ opponent/next phase β†’ repeat until a win condition. Depth comes from the combinations a hand allows; the engine's job is to resolve them unambiguously.

Must-have systems

  1. Card data β€” id, name, cost, type, text, and an effect spec (data, not code).
  2. Zones β€” deck (draw pile), hand, play/board, discard, exile/removed; cards live in exactly one.
  3. Draw + shuffle + reshuffle β€” draw from deck to hand; reshuffle discard into deck when empty.
  4. Turn structure β€” phases (untap/draw/main/combat/end) as a state machine.
  5. Resource system β€” mana/energy/actions that gate how much you do per turn.
  6. Effect resolution β€” apply a card's effects in a defined order; handle targets and triggers.
  7. Win/loss condition β€” life total, deck-out, objective.
  8. UI β€” hand layout, drag/drop or tap-to-play, zone counts, targeting affordances.

Design knobs

Knob Effect Notes
Starting hand / draw-per-turn tempo, consistency More draw = less variance.
Hand size limit hoarding vs. use Discard down at end of turn.
Deck size (min) consistency Smaller = more reliable combos.
Resource curve what's playable when "Mana curve" paces power.
Card rarity / power budget balance Stronger cards cost more / are rarer.
Determinism vs. randomness skill vs. swing Shuffle + random effects add variance.
Reshuffle rules deck-out, fatigue Reshuffle discard, or punish empty deck.
Removal / answers counterplay Every threat needs an answer in the pool.

Patterns

1. Zones + draw with automatic reshuffle

# Pseudocode. A card is in exactly one zone at a time; moving = remove here, add there.
def draw(n):
    for _ in range(n):
        if not deck:
            if not discard:          # truly empty: deck-out (lose, or take fatigue)
                on_deck_out(); return
            deck.extend(discard)     # reshuffle discard into deck
            discard.clear()
            shuffle(deck, rng)       # use a seeded RNG (see save-systems for replays)
        hand.append(deck.pop())

2. Card as data + effect resolution

# Pseudocode. Effects are a data list interpreted by the engine β€” not bespoke code per card.
card = {
    "id": "fireball", "cost": 3, "type": "spell",
    "effects": [ {"op": "damage", "amount": 6, "target": "chosen_enemy"} ],
}
def play(card, caster, chosen_targets):
    # Validate everything first; a failed check must leave zones and resources untouched.
    if resources[caster] < card.cost: return False      # can't afford
    if not targets_legal(card, chosen_targets): return False
    resources[caster] -= card.cost                      # commit: pay, then move, then resolve
    move(card, from_zone=hand, to_zone=play_or_discard(card))
    for fx in card.effects:
        resolve_effect(fx, caster, chosen_targets)      # one interpreter handles every card
    return True

3. Turn structure as a phase machine

# Pseudocode. Fixed phases keep timing windows (triggers, priority) unambiguous.
PHASES = ["untap", "draw", "main", "combat", "end"]
def take_turn(player):
    for phase in PHASES:
        enter_phase(player, phase)        # fire "on_phase" triggers here
        if phase == "draw":   draw(1)
        if phase == "main":   await player_plays_cards()
        if phase == "combat": resolve_combat()
        if pha
FAQ

Should card effects be code or data?

The skill says to define effects as data, which keeps cards easier to balance and change.

Does it cover the drag-and-drop card UI?

The hand and drag UI is covered by the engine UI skill, which this one points to.

What kinds of card games does it fit?

It fits deckbuilders, TCG and CCG style games, solitaire, and roguelike deckbuilders.

Details

Original description by the author

Build a card game: card data, deck/hand/discard zones, draw/shuffle/reshuffle, a turn structure, costs, and effect resolution. Use for a deckbuilder, TCG/CCG, or roguelike deckbuilder.

repo: gamedev-skills/awesome-gamedev-agent-skills

Popularity

GitHub stars
6.6k
Ranking position
#13807
License
Apache-2.0
Updated
10/28/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills