К основному содержанию
скилл CX Codex

card-game — скилл для Claude Code: зоны, добор, эффекты

Скилл-плейбук для карточных игр: описывает карты как данные, разводит колоду и сброс по зонам, задаёт фазы хода и порядок разрешения эффектов.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill card-game -a claude-code
Открыть на GitHub

Что делает card-game

Скилл включается, когда основные объекты игры — карты, которые переходят между зонами: колода, рука, стол, сброс. Агент получает модель зон с правилом «карта лежит ровно в одной зоне», добор с перетасовкой сброса и список обязательных систем: стоимости, ресурсы, фазы, условия победы. Карты описываются как данные: у каждой есть id, cost, type и список effects, который разбирает один интерпретатор.

Ход разложен на фазы untap, draw, main, combat, end. Фиксированный порядок снимает споры о том, когда срабатывают триггеры. Розыгрыш карты атомарный: сначала проверка стоимости и целей, потом списание ресурсов, перемещение карты и разрешение эффектов. Провалилась проверка — зоны и ресурсы остаются как были. Типовые поломки: карта в двух зонах сразу, забытая перетасовка, нет лимита руки.

Если планируются реплеи или отмена хода, глобальный генератор движка не годится: состояние сидированного RNG сохраняют вместе с прогоном. Границы диапазона тоже кусаются — randi_range(a, b) в Godot включает b, а Random.Range(int, int) в Unity верхнюю границу отбрасывает. Из-за этого часть порядков перестаёт выпадать. Ассеты карт и раскладку руки скилл не трогает: за них отвечают godot-resources, unity-scriptableobjects и godot-ui-control.

Какие задачи решает

  • разложить карты по зонам без дублей и потерь
  • собрать добор с перетасовкой сброса на пустой колоде
  • описать эффекты карт данными и одним интерпретатором
  • выстроить фазы хода и порядок срабатывания триггеров
  • сделать розыгрыш карты атомарным при отмене выбора цели

Примеры запросов агенту

  • Сделай карточную игру на Godot: колода, рука, сброс, добор с перетасовкой и стоимости карт.
  • Опиши карты как данные с эффектами damage и heal и напиши один интерпретатор эффектов.
  • Разбей ход на фазы untap, draw, main, combat, end и добавь лимит руки.

Как установить card-game

1Через Skills CLI (Vercel)

npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill card-game -a claude-code

2Вручную: положить файлы

~/.claude/skills/card-game/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/card-game/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о card-game

Как установить card-game в Claude Code?

Выполните npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill card-game -a claude-code. Скилл появится в ~/.claude/skills/card-game/SKILL.md.

Что делает card-game?

Даёт агенту модель зон, добора с перетасовкой, фаз хода, стоимостей и разрешения эффектов для карточной игры. Карты при этом остаются данными, а не набором отдельных функций.

Когда card-game не подходит?

Скилл берут, когда карты переходят между зонами. Для поля с правилами сопоставления нужен puzzle, а карточный бой внутри RPG начинают с rpg.

Исходный текст

SKILL.md · Apache-2.0
---
name: card-game
description: >
  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.
---

# 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

```python
# 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

```python
# 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

```python
# 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 phase == "end":    discard_to_hand_limit(player); clear_temporary_effects()
```

## Pitfalls / failure modes

- **A card existing in two zones at once** → duplication/loss bugs. Enforce "exactly one zone";
  move = remove-then-add, and assert no card appears twice.
- **Forgetting to reshuffle** → draws silently fail or crash on empty deck. Reshuffle discard,
  or define deck-out/fatigue explicitly (Pattern 1).
- **One function per card** → unmaintainable and untestable. Make effects **data** interpreted
  by a small set of operations (Pattern 2).
- **Ambiguous effect order / simultaneous triggers** → nondeterministic outcomes. Resolve in a
  defined order (a queue or stack); document LIFO vs. FIFO (refs).
- **Unseeded shuffle in a game that needs replays/undo** → can't reproduce. Use a seeded RNG
  instance (not the engine's global one) and save its state with the run; see refs §6 for the
  per-engine calls.
- **Off-by-one in the shuffle's random index** → some orders never occur (a biased deck). Engine
  ranges differ: Godot `randi_range(a, b)` and Phaser `RND.between(a, b)` include `b`; Unity
  `Random.Range(int, int)` excludes it.
- **No hand limit / no answers** → degenerate hoarding or unbeatable threats. Add a hand cap and
  ensure removal exists for every threat archetype.
- **Targeting state leaks** → a cancelled play leaves the board mid-targeting. Make play
  atomic: validate cost + targets first, then commit.

## Composition (build it from these skills)

- **Card content:** `godot-resources` / `unity-scriptableobjects` — define each card as a data asset.
- **UI:** `game-ui-ux` for layout, scaling, and focus navigation; `godot-ui-control` for hand layout, drag/drop, zone counts, and targeting prompts.
- **Persistence/replays:** `save-systems` for collection, run state (roguelike deckbuilder), and seeded replays.
- **Opponent AI:** `game-ai` for an AI that evaluates playable cards and picks targets.
- **Animation/feedback:** the engine animation skill for card movement; `audio-design` for cues.
- **Scripting:** `godot-gdscript` / `unity-csharp-scripting` for the effect interpreter.

## References

- For the effect queue/stack, keywords/triggers, targeting, deckbuilder vs. constructed
  archetypes, and shuffle fairness, read `references/effect-resolution.md`.

© gamedev-skills · Apache-2.0 · gamedev-skills/awesome-gamedev-agent-skills

Похожие скиллы

Всё по теме «Геймдев и 3D: Unity, Unreal, Godot, Blender» →
make-game OpusGameLabs Скилл структурирует разработку видеоигр: от проработки геймплея и выбора движка до генерации проекта и исправления багов. CX Codex +1 1 100установок game-development miles990 Скилл с паттернами для игр: игровой цикл, ECS, коллизии, поведение врагов. Пригодится, когда агент пишет логику на Unity, Godot или Flutter. CX Codex +1 410установок godot-genre-card-game thedivergentai Скилл задаёт агенту правила сборки ККИ и декбилдеров на Godot: данные карт, колода, ход, драг-н-дроп и разрешение эффектов. CX Codex +1 371установок asset-audit Donchitos Проверяет ассеты игры на соответствие правилам именования и лимитам веса, находя забытые файлы и битые ссылки в коде. CX Codex +1 469установок reverse-document Donchitos Разбирает уже написанный код или прототип и собирает по нему дизайн-док или ADR. Пригодится, когда фича есть, а описания к ней нет. CX Codex +1 461установок iphone-duo-games mirzaaghazadeh Помогает агенту адаптировать игру под складной iPhone Duo: заполнение экрана в любой позе, блокировка ориентации, соотношение сторон вместо чёрных полос. CX Codex +1 427установок

Из того же набора77

godot-export Скилл настраивает экспорт проектов Godot 4.7 под десктоп и Web. Помогает подготовить сборку для CI в headless-режиме и избежать ошибок с путями. CX Codex +1 6 200установок godot-audio Настраивает воспроизведение, микширование и синхронизацию звука в Godot 4.7. Пригодится для музыки, SFX, аудиошин и ритмических событий. CX Codex +1 6 200установок platformer Помогает спроектировать механику 2D-платформера: настроить тайминги прыжка, буфер ввода, coyote time и поведение платформ. CX Codex +1 6 000установок puzzle Плейбук для грид-головоломок: модель доски, разрешение ходов, каскады, счёт и отмена. Пригодится, когда игра держится на планировании хода. CX Codex +1 6 000установок godot-tilemap Помогает собирать 2D-уровни в Godot 4.7 через TileMapLayer, настраивать коллизии и террейны, а также менять тайлы из GDScript. Пригодится при переходе со старого узла TileMap. CX Codex +1 6 100установок fps-shooter Помогает спроектировать шутер от первого лица: управление, стрельбу, оружие, здоровье и ИИ противников. Нужен при настройке ощущения прицеливания, отдачи и разброса. CX Codex +1 6 100установок roblox-luau Скилл помогает писать Luau-скрипты для Roblox: работать с сервисами, создавать Instances, подключать события и настраивать безопасное взаимодействие между клиентом и сервером через RemoteEvents. CX Codex +1 6 100установок visual-novel Плейбук для визуальных новелл: ветвящийся сценарий, показ персонажей и фонов, выборы, сохранения, журнал, пропуск и авто-режим. CX Codex +1 5 900установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой