Skip to content
game-domain logo

ActionPhase Game Domain

game-domain

Complete game lifecycle and domain patterns for ActionPhase turn-based gaming platform. Covers game states, phase transitions (common room, action, results), character workflows (creation, approval, death), messaging systems (common room posts, private messages, GM results), action submissions, a...

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

ActionPhase Game Domain

Purpose

Comprehensive guide to the game lifecycle, state management, phase transitions, and player workflows in ActionPhase's turn-based gaming system.

When to Use This Skill

  • Understanding game flow and state transitions
  • Implementing phase management (common room, action, results)
  • Working with character workflows and approvals
  • Building messaging systems (posts, comments, private messages)
  • Managing action submissions and GM results
  • Debugging game state issues
  • Designing features that interact with game mechanics

Game Lifecycle Overview

Complete Game Flow

1. SETUP → 2. RECRUITMENT → 3. CHARACTER_CREATION → 4. IN_PROGRESS → 5. COMPLETED/​CANCELLED

IN_PROGRESS contains the repeating phase cycle:

COMMON ROOM (discussion) → ACTION (submissions) → RESULTS (GM feedback) → [repeat]

See: game-states.md for complete state definitions and transition rules


Quick Reference

Game States

state CHECK (state IN (
    'setup',              -- Initial creation
    'recruitment',        -- Accepting players
    'character_creation', -- Players creating characters
    'in_progress',        -- Active gameplay
    'paused',            -- Temporarily suspended
    'completed',         -- Finished normally
    'cancelled'          -- Terminated early
))

See: game-states.md

Phase Types

phase_type CHECK (phase_type IN (
    'common_room',  -- Discussion/​planning phase
    'action',       -- Players submit actions
    'results'       -- GM publishes results
))

See: phase-system.md

Character Status

status CHECK (status IN (
    'pending',    -- Awaiting GM review
    'approved',   -- GM approved, waiting for game start
    'active',     -- In gameplay
    'rejected',   -- GM rejected
    'dead'        -- Died in-game
))

See: character-workflows.md


Core Concepts

1. Game State Machine

Games transition through defined states with specific rules for advancement.

  • SETUP: GM configures game
  • RECRUITMENT: Players apply to join
  • CHARACTER_CREATION: Players create characters, GM approves
  • IN_PROGRESS: Active gameplay with phase cycles
  • COMPLETED: Game ends normally, archive becomes public
  • CANCELLED: Game terminates early

Details: game-states.md

2. Phase Cycle (The Game Loop)

The repeating cycle during IN_PROGRESS state:

  1. COMMON ROOM: Public discussion forum, planning, coordination
  2. ACTION: Private action submissions, one per player
  3. RESULTS: GM sends private results to each player

Details: phase-system.md

3. Character Lifecycle

Players create characters that go through approval workflow:

PENDING → APPROVED → ACTIVE (when game starts)

Or: PENDING → REJECTED (player revises and resubmits)

Or: ACTIVE → DEAD (character dies, may create new one)

Details: character-workflows.md

4. Messaging System

Four distinct message types with different visibility rules:

  • Common Room Posts: Public to all participants
  • Private Messages: Between specific characters
  • Action Submissions: Private to player (GM sees after ACTION phase)
  • GM Results: Private GM → player messages

Details: messaging-system.md


Data Models

Core Tables

games

  • Game metadata, state, GM
  • Recruitment settings
  • Date tracking

game_participants

  • Players, co-GMs, audience
  • Role and status tracking

characters

  • Player characters and NPCs
  • Type and status workflow

game_phases

  • Phase history and current phase
  • Type, number, timing

posts + comments

  • Common room discussions

private_messages

  • Character-to-character messages

action_submissions

  • Player actions during ACTION phase

action_results

  • GM results during RESULTS phase

See: data-models.md for complete schema


API Endpoints

Game Management

GET/​POST/​PUT/​DELETE  /​api/​v1/​games
PUT                  /​api/​v1/​games/​{id}/​state

Characters

GET/​POST  /​api/​v1/​games/​{game_id}/​characters
POST      /​api/​v1/​characters/​{id}/​approve
POST      /​api/​v1/​characters/​{id}/​reject

Phases

GET   /​api/​v1/​games/​{game_id}/​phases
POST  /​api/​v1/​phases/​advance
GET   /​api/​v1/​games/​{game_id}/​phases/​current

Messaging

GET/​POST  /​api/​v1/​games/​{game_id}/​posts
GET/​POST  /​api/​v1/​games/​{game_id}/​posts/​{id}/​comments
GET/​POST  /​api/​v1/​games/​{game_id}/​messages/​private

Actions & Results

GET/​POST/​PUT  /​api/​v1/​phases/​{phase_id}/​actions
GET           /​api/​v1/​phases/​{phase_id}/​actions/​all  (GM only)
POST          /​api/​v1/​phases/​{phase_id}/​results      (GM only)
GET           /​api/​v1/​phases/​{phase_id}/​results      (Player)

See: api-reference.md for complete API documentation


Business Rules

Key Constraints

  • ✅ Only ONE active phase per game
  • ✅ One action submission per player per phase
  • ✅ Actions locked after deadline
  • ✅ Only GM can advance phases
  • ✅ Must have ACTIVE character to post/​act
  • ✅ Action submissions hidden from GM until ACTION phase ends
  • ✅ Private messages never visible to GM (unless included)
  • ✅ Results remain private forever (unless player shares)

See: business-rules.md for complete rules


Common Workflows

Workflow 1: Complete Game Setup to First Phase

# 1. Create game → 2. Open recruitment → 3. Move to character creation
# 4. Approve characters → 5. Start game → 6. Create first phase

# Full example in resources

Workflow 2: Phase Advancement Cycle

# Common Room → ACTION → RESULTS → (new Common Room)

# Full example in resources

Workflow 3: Character Death and Replacement

# Mark dead → Player creates new → GM approves → Becomes active

# Full example in resources

See: workflows.md for complete workflow examples with curl commands


Testing Patterns

Test Complete Phase Cycle

# Load test fixtures
./​backend/​pkg/​db/​test_fixtures/​apply_e2e.sh

# Login as GM and advance phase
./​backend/​scripts/​api-test.sh login-gm
curl -X POST -H "Authorization: Bearer $(cat /​tmp/​api-token.txt)" \
  http://localhost:3000/​api/​v1/​phases/​advance \
  -d '{"game_id": 164}'

# Login as player and submit action
./​backend/​scripts/​api-test.sh login-player
curl -X POST -H "Authorization: Bearer $(cat /​tmp/​api-token.txt)" \
  http://localhost:3000/​api/​v1/​phases/​456/​actions \
  -d '{"content": "I investigate the library"}'

See: testing-guide.md for complete testing patterns


Database Queries

Understanding Game State

-- Get game with current phase
SELECT g.id, g.title, g.state, gp.phase_type, gp.is_active
FROM games g
LEFT JOIN game_phases gp ON gp.game_id = g.id AND gp.is_active = true
WHERE g.id = 164;

-- Get phase history
SELECT phase_number, phase_type, start_time, end_time
FROM game_phases
WHERE game_id = 164
ORDER BY phase_number;

-- Get action submissions for phase
SELECT u.username, c.name, a.submitted_at
FROM action_submissions a
JOIN users u ON a.user_id = u.id
LEFT JOIN characters c ON a.character_id = c.id
WHERE a.phase_id = 456;

See: database-queries.md for complete query reference


Navigation Guide

Need to...Read this
Understand game states and transitionsgame-states.md
Learn phase cycle (common room → action → results)phase-system.md
Understand character approval workflowcharacter-workflows.md
Learn messaging types and visibilitymessaging-system.md
See complete data modeldata-models.md
Find API endpointsapi-reference.md
Understand business rules and constraintsbusiness-rules.md
See workflow examples with codeworkflows.md
Learn testing patternstesting-guide.md
Find useful database queriesdatabase-queries.md

Design Principles

Privacy by Design

  • Action submissions hidden from GM during ACTION phase
  • Private messages never visible to GM (unless included)
  • Results remain private between GM and player
  • Dead characters cannot see new content

Asynchronous by Default

  • No real-time requirements
  • Players work at their own pace
  • Deadlines provide structure but no hard enforcement
  • Email notifications for phase changes

GM Control

  • GM controls all phase advancement
  • GM decides character approval
  • GM manages game state
  • GM sets deadlines and pacing

Public Archive

  • Completed games become public
  • Action submissions revealed on completion
  • Private messages remain private
  • Results remain private
  • Creates valuable reference material

Related Skills & Context

Skills

  • backend-dev-guidelines - Implementing game domain services
  • route-tester - Testing game API endpoints
  • frontend-dev-guidelines - Building game UI components
  • game-phase-management - Phase service implementation details
  • character-management - Character-specific patterns
  • messaging-system - Messaging implementation

Context Files

  • .claude/​context/​ARCHITECTURE.md - Service patterns
  • .claude/​context/​TEST_DATA.md - Test fixtures with game data
  • .claude/​context/​TESTING.md - Testing game workflows
  • .claude/​reference/​API_DOCUMENTATION.md - Complete API reference

Key Backend Files

  • backend/​pkg/​db/​services/​phases/ - Phase management service
  • backend/​pkg/​db/​services/​games.go - Game state management
  • backend/​pkg/​db/​services/​characters.go - Character workflow
  • backend/​pkg/​db/​services/​messages/ - Messaging services
  • backend/​pkg/​db/​services/​actions/ - Action submission service

Quick Start

New to ActionPhase game domain? Read in this order:

  1. game-states.md - Understand the lifecycle
  2. phase-system.md - Learn the phase cycle
  3. character-workflows.md - Character approval flow
  4. messaging-system.md - Message types and visibility
  5. workflows.md - See complete examples

Implementing a feature? Check:

Debugging? Use:


Skill Status: COMPLETE ✅ Line Count: < 500 ✅ Progressive Disclosure: 10 resource files ✅ Coverage: Full game lifecycle, state management, phase system, character workflow, messaging ✅

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View