claude-configs/skills/major-domo/SKILL.md
Cal Corum 6201b4c9af Major Domo CLI: modular refactor + 6 new command modules
Refactored monolithic cli.py into modular architecture:
- cli_common.py: shared state, console, output helpers
- cli_transactions.py: list + simulate (compliance checker)
- cli_injuries.py: injury listing with team/active filters
- cli_stats.py: batting/pitching leaderboards
- cli_results.py: game results
- cli_schedule.py: game schedules

Also: team get now shows salary_cap, SKILL.md fully updated
with CLI docs, flag ordering warning, and compliance workflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:24:18 -06:00

30 KiB

name description
major-domo Comprehensive Major Domo (SBA fantasy baseball league) management - Discord bot operations, API operations, database management, league operations, analytics, and development workflows. USE WHEN user mentions Major Domo, SBA, league operations, player stats, team rosters, Discord bot management, database migrations, or needs to work with the Strat-o-Matic Baseball Association system. Supports both production and development environments.

Major Domo - SBA Fantasy Baseball League Management

When to Activate This Skill

Discord Bot Operations:

  • "Test Discord bot command"
  • "Update bot on dev server"
  • "Check bot status"

For Docker deployment and releases, use the deploy skill instead:

  • "Deploy discord bot" / "Deploy database"
  • "Bump version and deploy"

League Operations:

  • "Update weekly stats for SBA"
  • "Process injuries for week X"
  • "Show trade deadline information"
  • "Get current season/week status"

Data Queries:

  • "Show player stats for [name]"
  • "List teams in season X"
  • "Get team roster for [abbrev]"
  • "Show league standings"
  • "Find transactions for team [abbrev]"

Database Operations:

  • "Run database migration"
  • "Sync production data to dev"
  • "Check database health"
  • "Validate data integrity"

Analytics & Reporting:

  • "Generate season batting leaders"
  • "Show pitching stats for season X"
  • "Analyze team performance"
  • "Create weekly report"

What is Major Domo?

Major Domo is a comprehensive system for managing the Strat-o-Matic Baseball Association (SBA), a fantasy baseball league with:

  • Discord bot for league management and gameplay
  • FastAPI backend serving league data (PostgreSQL)
  • Vue.js website displaying league information
  • 18-week seasons with 4 games per week
  • Draft system with keepers and pick trading
  • Real-time game simulation using Strat-o-Matic rules

Key Components:

  • Database API: FastAPI backend (production: 10.10.0.42, dev: 10.10.0.42 Docker)
  • Discord Bot: Python bot using discord.py 2.5.2
  • Discord Bot v2: Next-generation bot with enhanced logging
  • Website: Vue 3 + TypeScript frontend
  • Current Season: 12 (from helpers.py)

🚨 CRITICAL: Environment & Safety Rules

API-Based Data Access

ALWAYS use the API endpoints (production or development)

  • Default to production unless specified otherwise
  • Use MajorDomoAPI client from api_client.py
  • Production: https://api.sba.manticorum.com/v3/
  • Development: http://10.10.0.42:8000/api/v3/ (Docker)

NEVER access databases directly

  • NEVER query local SQLite databases (always out of date)
  • Do NOT use sqlite3 commands on .db files
  • Do NOT use psql commands without explicit request
  • Do NOT bypass the API for queries
  • API provides proper authentication and access control

Exception: Only access database directly when user explicitly requests it

Why This Matters:

  • Local SQLite databases are development artifacts and NOT current
  • Production API is the single source of truth
  • Direct database access bypasses security and may show stale data

Repository Safety

BEFORE EVERY COMMIT:

  • Run git remote -v to verify repository
  • Check you're in the correct directory
  • Major Domo is at /mnt/NV2/Development/major-domo/
  • Discord bot v2 at /mnt/NV2/Development/major-domo/discord-app-v2/

Docker & Production Safety

ALWAYS prompt user before:

  • Modifying production infrastructure
  • Running docker-compose down on production
  • Deploying bot updates to main Discord server
  • Running database migrations on production

System Architecture

Project Structure

major-domo/
├── database/                 # FastAPI backend (PostgreSQL)
│   ├── app/
│   │   ├── main.py          # FastAPI application
│   │   ├── db_engine.py     # Peewee ORM models
│   │   ├── dependencies.py  # Auth & error handling
│   │   └── routers_v3/      # API endpoints (v3)
│   ├── docker-compose.yml   # PostgreSQL + API + Adminer
│   └── migrations/          # SQL migration files
├── discord-app/             # Original Discord bot (Python)
│   ├── majordomo.py         # Bot entry point
│   ├── cogs/                # Command modules
│   └── db_calls.py          # API integration
├── discord-app-v2/          # Next-gen Discord bot
│   ├── bot.py               # Enhanced bot with logging
│   └── commands/            # Command packages
└── sba-website/             # Vue.js frontend
    ├── src/
    └── package.json

API Endpoints (routers_v3/)

Core Data Endpoints:

  • /api/v3/current - Season/week status, trade deadlines, playoff schedule
  • /api/v3/players - Player information, rosters, search
  • /api/v3/teams - Team data, rosters (current/next week)
  • /api/v3/standings - League standings by division/league
  • /api/v3/transactions - Player transactions (trades, waivers)

Statistics Endpoints:

  • /api/v3/battingstats - Batting statistics (seasonal + career)
  • /api/v3/pitchingstats - Pitching statistics (seasonal + career)
  • /api/v3/fieldingstats - Fielding statistics (seasonal + career)
  • /api/v3/views/season-stats/batting - Advanced batting views
  • /api/v3/views/season-stats/pitching - Advanced pitching views

League Management:

  • /api/v3/schedules - Game scheduling
  • /api/v3/results - Game results
  • /api/v3/injuries - Player injury tracking
  • /api/v3/awards - League awards
  • /api/v3/managers - Manager profiles
  • /api/v3/divisions - Division information

Draft System:

  • /api/v3/draftdata - Current draft status
  • /api/v3/draftpicks - Draft pick ownership
  • /api/v3/draftlist - Team draft priority lists
  • /api/v3/keepers - Keeper selections

Game Data:

  • /api/v3/stratgame - Strat-o-Matic game data
  • /api/v3/stratplay - Play-by-play data
  • /api/v3/sbaplayers - SBA player pool

Custom Features:

  • /api/v3/custom_commands - User-created Discord commands
  • /api/v3/help_commands - Static help text
  • /api/v3/decisions - Game decisions/choices

Database Models (Key Entities)

Core Entities:

  • Current - Season/week status, configuration
  • Player - Player data with positions, WARA, injuries
  • Team - Teams with managers, divisions, metadata
  • Manager - Manager profiles and contact info
  • Division - League/division structure

Statistics:

  • BattingStat - Game-by-game batting stats
  • PitchingStat - Game-by-game pitching stats
  • FieldingStat - Game-by-game fielding stats
  • SeasonBattingStats - Aggregated season batting (view)
  • SeasonPitchingStats - Aggregated season pitching (view)

League Management:

  • Standings - Team records and standings
  • Schedule - Game schedules
  • Result - Game results
  • Transaction - Player transactions
  • Injury - Player injury tracking
  • Award - League awards and recognition

Draft System:

  • DraftData - Current draft status
  • DraftPick - Draft pick ownership
  • DraftList - Team draft priority lists
  • Keeper - Keeper selections

Game Data:

  • StratGame - Strat-o-Matic game records
  • StratPlay - Play-by-play data
  • SBAPlayer - Available player pool

API Reference

Authentication

All write operations require Bearer token:

export API_TOKEN='your-token-here'

Headers:

{'Authorization': f'Bearer {API_TOKEN}'}

Environments

  • Production: https://api.sba.manticorum.com/v3/ (main API server)
  • Development: http://10.10.0.42:8000/api/v3/ (Docker container on dev server)

Set via environment variable:

export DATABASE='prod'  # or 'dev'

Common Endpoints

Current Season/Week:

  • GET /current - Get current season/week status
  • GET /current?season={N} - Get specific season status
  • PATCH /current/{id} - Update current status (private)

Players:

  • GET /players?season={N} - List all players in season
  • GET /players?team_id={id} - Players by team
  • GET /players?name={name} - Players by name (exact match)
  • GET /players/search?q={query} - Fuzzy search players
  • GET /players/{id} - Get single player
  • PATCH /players/{id} - Update player (private)

Teams:

  • GET /teams?season={N} - List teams in season
  • GET /teams?team_abbrev={abbrev} - Get team by abbreviation
  • GET /teams?active_only=true - Only active teams (excludes IL/MiL)
  • GET /teams/{id} - Get single team
  • GET /teams/{id}/roster/{which} - Get roster (current/next week)

Standings:

  • GET /standings?season={N} - All standings for season
  • GET /standings?season={N}&division_abbrev={div} - By division
  • GET /standings/team/{team_id} - Single team standings
  • POST /standings/s{season}/recalculate - Recalculate standings (private)

Transactions:

  • GET /transactions?season={N} - List transactions
  • GET /transactions?season={N}&team_abbrev={abbrev} - By team
  • GET /transactions?season={N}&week_start={W}&week_end={W} - By week range
  • GET /transactions?move_id={id} - By move ID
  • PATCH /transactions/{move_id} - Update transaction (private)

Statistics (Advanced Views):

  • GET /views/season-stats/batting?season={N} - Season batting stats
    • Params: team_id, player_id, min_pa, sort_by, sort_order, limit, offset
  • GET /views/season-stats/pitching?season={N} - Season pitching stats
    • Params: team_id, player_id, min_outs, sort_by, sort_order, limit, offset
  • POST /views/season-stats/batting/refresh - Refresh batting stats (private)
  • POST /views/season-stats/pitching/refresh - Refresh pitching stats (private)

Using the API Client

Basic Setup

from api_client import MajorDomoAPI

# Initialize (reads API_TOKEN from environment)
api = MajorDomoAPI(environment='prod', verbose=True)

# Or provide token directly
api = MajorDomoAPI(environment='dev', token='your-token')

Common Operations

# Get current season/week
current = api.get_current()
print(f"Season {current['season']}, Week {current['week']}")

# Get a team
team = api.get_team(abbrev='CAR')
team = api.get_team(team_id=42)

# List teams
all_teams = api.list_teams(season=12)
active_teams = api.list_teams(season=12, active_only=True)

# Get player
player = api.get_player(name='Mike Trout', season=12)
player = api.get_player(player_id=1234)

# Search players (fuzzy)
results = api.search_players(query='trout', season=12, limit=10)

# Get team roster
roster = api.get_team_roster(team_id=42, which='current')  # or 'next'

# Get standings
standings = api.get_standings(season=12, division_abbrev='ALE')

# Get transactions
transactions = api.get_transactions(season=12, team_abbrev='CAR', week_start=1, week_end=4)

# Get batting stats (advanced)
stats = api.get_season_batting_stats(
    season=12,
    min_pa=100,
    sort_by='woba',
    sort_order='desc',
    limit=50
)

# Get pitching stats (advanced)
stats = api.get_season_pitching_stats(
    season=12,
    min_outs=150,
    sort_by='era',
    sort_order='asc',
    limit=50
)

Workflows

This skill includes structured workflows for common tasks:

1. Discord Bot Deployment

Purpose: Deploy Discord bot updates to production or test servers

When: After bot code changes, new features, or bug fixes

Recommended: Use the deploy skill for Docker-based deployments:

~/.claude/skills/deploy/deploy.sh md-discord patch

This handles version bumping, Docker build/push, and production deployment automatically.

Manual Workflow: ~/.claude/skills/major-domo/workflows/bot-deployment.md

Quick Steps (manual):

  1. Test changes locally or on dev server
  2. Update version in bot code
  3. Stop production bot
  4. Pull latest changes
  5. Restart bot
  6. Verify bot is online and responsive

2. Weekly Stats Update

Purpose: Process weekly game results and update statistics

When: End of each game week (weekly)

Workflow: ~/.claude/skills/major-domo/workflows/weekly-stats-update.md

Quick Steps:

  1. Import game results from Strat-o-Matic
  2. Update standings
  3. Process injuries
  4. Refresh season statistics
  5. Generate weekly report
  6. Post updates to Discord

3. Database Migration

Purpose: Apply database schema changes

When: Schema updates, new features requiring DB changes

Workflow: ~/.claude/skills/major-domo/workflows/database-migration.md

Quick Steps:

  1. Create migration SQL file in migrations/
  2. Test migration on development database
  3. Backup production database
  4. Apply migration to production
  5. Verify schema changes
  6. Update API/bot code if needed

4. Season Rollover

Purpose: Prepare system for new season

When: Start of new season (annually)

Workflow: ~/.claude/skills/major-domo/workflows/season-rollover.md

Quick Steps:

  1. Archive previous season data
  2. Create new season teams
  3. Initialize standings
  4. Configure draft settings
  5. Update current season/week
  6. Test all systems

Common Request Patterns

Information Queries

Current Status:

"What season/week is it?"
→ api.get_current()

"When is the trade deadline?"
→ api.get_current(), show trade_deadline field

Player Information:

"Show stats for Mike Trout"
→ api.get_player(name='Mike Trout', season=12)

"Search for players named Smith"
→ api.search_players(query='smith', season=12)

"List all injured players"
→ api.list_players(season=12, is_injured=True)

Team Information:

"Show roster for CAR"
→ api.get_team_roster(team_id=X, which='current')

"List all teams in season 12"
→ api.list_teams(season=12)

"Show standings for AL East"
→ api.get_standings(season=12, division_abbrev='ALE')

Transactions:

"Show trades this week"
→ api.get_transactions(season=12, week_start=W, week_end=W)

"List all CAR transactions"
→ api.get_transactions(season=12, team_abbrev='CAR')

Analytics Queries

Batting Leaders:

"Show top 50 hitters by wOBA"
→ api.get_season_batting_stats(season=12, sort_by='woba', limit=50)

"Who has the most home runs?"
→ api.get_season_batting_stats(season=12, sort_by='hr', sort_order='desc', limit=10)

"Show qualified batting leaders (min 100 PA)"
→ api.get_season_batting_stats(season=12, min_pa=100, sort_by='woba', limit=50)

Pitching Leaders:

"Show top 50 pitchers by ERA"
→ api.get_season_pitching_stats(season=12, sort_by='era', sort_order='asc', limit=50)

"Who has the most strikeouts?"
→ api.get_season_pitching_stats(season=12, sort_by='k', sort_order='desc', limit=10)

"Show qualified pitching leaders (min 150 outs)"
→ api.get_season_pitching_stats(season=12, min_outs=150, sort_by='era', limit=50)

Team Analysis:

"Compare team rosters"
→ cli.py team roster ABBREV (for each team)

"Show team's best players by WARA"
→ cli.py team roster ABBREV (sorted by WARA in output)

"Check if transactions are compliant"
→ See "Transaction Compliance Check Workflow" in CLI section

"Analyze team transaction history"
→ api.get_transactions(season=12, team_abbrev=X)

Development Commands

Database API (database/)

Local Development (Docker):

cd /mnt/NV2/Development/major-domo/database
docker-compose up                    # Start all services
docker-compose up --build            # Rebuild and start
docker-compose logs -f app           # View API logs
docker-compose exec app bash         # Shell into API container

Database Management:

# Access Adminer (web UI)
# Visit http://10.10.0.42:8080

# Sync production data to dev
docker-compose --profile sync up sync-prod

# Database migrations
python migrations.py

# Or via psql directly
psql -h 10.10.0.42 -U sba_admin -d sba_master -f migrations/migration_001.sql

Discord Bot (discord-app/)

Local Development:

cd /mnt/NV2/Development/major-domo/discord-app
python majordomo.py                  # Start bot

# With environment variables
export BOT_TOKEN='...'
export API_TOKEN='...'
export DB_URL='http://10.10.0.42/api/v3'
export GUILD_ID='...'
python majordomo.py

Testing:

pytest                               # Run all tests
pytest tests/api_calls/              # Test API integration
pytest tests/api_calls/test_current.py  # Specific test

Discord Bot v2 (discord-app-v2/)

Local Development:

cd /mnt/NV2/Development/major-domo/discord-app-v2
python bot.py                        # Start bot

# Testing
python -m pytest --tb=short -q       # All tests
python -m pytest tests/test_models.py -v  # Specific test
python -m pytest tests/test_utils_decorators.py -v  # Decorator tests

Key Features:

  • Enhanced logging with @logged_command decorator
  • Structured command packages (league, players, teams, voice)
  • Improved type safety with required model IDs

Website (sba-website/)

Local Development:

cd /mnt/NV2/Development/major-domo/sba-website
npm run dev                          # Development server
npm run build                        # Build for production
npm run type-check                   # Type checking only

Safety Considerations

Data Modification

READ Operations (Safe):

  • All GET endpoints
  • Player/team/stats queries
  • Standings calculations
  • Search operations

WRITE Operations (Require Caution):

  • PATCH/PUT/DELETE endpoints (require API token)
  • Database migrations
  • Standings recalculation
  • Stats refresh operations
  • Transaction modifications

Always Prompt User Before:

  • Modifying production data
  • Running database migrations on production
  • Deleting records
  • Recalculating standings
  • Refreshing season statistics

Discord Bot Safety

Test Server First:

  • Use test Discord server for command testing
  • Verify command output before deploying to main server
  • Test with dev database when possible

Deployment Checklist:

  • Tested on dev server
  • Reviewed code changes
  • Updated version number
  • Checked environment variables
  • Verified API connectivity
  • Announced downtime if needed

File Locations

Skill Directory: ~/.claude/skills/major-domo/

Structure:

major-domo/
├── SKILL.md (this file)
├── api_client.py (shared API client)
├── cli.py (main CLI - mounts sub-apps, core commands)
├── cli_common.py (shared state, console, output helpers)
├── cli_transactions.py (transactions list + simulate)
├── cli_injuries.py (injury listing)
├── cli_stats.py (batting/pitching leaderboards)
├── cli_results.py (game results)
├── cli_schedule.py (game schedules)
├── workflows/
│   ├── bot-deployment.md
│   ├── weekly-stats-update.md
│   ├── database-migration.md
│   └── season-rollover.md
└── scripts/
    ├── README.md
    ├── sync_data.py
    ├── validate_database.py
    ├── generate_report.py
    └── deploy_bot.sh

Related Codebases:

  • Database API: /mnt/NV2/Development/major-domo/database/
  • Discord Bot (v1): /mnt/NV2/Development/major-domo/discord-app/
  • Discord Bot (v2): /mnt/NV2/Development/major-domo/discord-app-v2/
  • Website: /mnt/NV2/Development/major-domo/sba-website/

⚠️ WARNING: Local SQLite databases (*.db files) are development artifacts and always out of date. NEVER use them for queries.


Environment Variables

Required:

  • API_TOKEN - API authentication token
  • DATABASE - Environment ('prod' or 'dev')

Discord Bot:

  • BOT_TOKEN - Discord bot authentication
  • GUILD_ID - Discord server ID
  • DB_URL - Database API endpoint

Database API (PostgreSQL):

  • POSTGRES_HOST - PostgreSQL hostname (default: 10.10.0.42)
  • POSTGRES_DB - Database name (default: sba_master)
  • POSTGRES_USER - Database user (default: sba_admin)
  • POSTGRES_PASSWORD - Database password
  • POSTGRES_PORT - Database port (default: 5432)

Optional:

  • LOG_LEVEL - Logging level (INFO/WARNING)

CLI Application

The cli.py provides a command-line interface for common operations, primarily for use with Claude Code.

Shell Alias: majordomo (defined in ~/.bashrc)

⚠️ Claude Code Note: The alias is not available in non-interactive shells. Use the full path instead:

python ~/.claude/skills/major-domo/cli.py <command>

Commands

# Status & Health (use full path in Claude Code)
python ~/.claude/skills/major-domo/cli.py status    # Current season/week
python ~/.claude/skills/major-domo/cli.py health    # API health check

# In interactive terminal, alias works:
majordomo status                              # Current season/week
majordomo health                              # API health check

# Player Operations
majordomo player get "Mike Trout"             # Get player info
majordomo player search "trout"               # Fuzzy search
majordomo player move "Name" TEAM             # Move single player
majordomo player move --batch "N1:T1,N2:T2"   # Batch moves

# Team Operations
majordomo team list [--active]                # List teams
majordomo team get CAR                        # Get team details
majordomo team roster CAR                     # Team roster breakdown

# Standings
majordomo standings [--division ALE]          # League standings

# Transactions
majordomo transactions --team CLS --week 9    # Team transactions for week
majordomo transactions list --week-start 1 --week-end 4  # Week range
majordomo transactions --player "Mike Trout"  # Player-specific transactions
majordomo transactions simulate CLS "Stott:CLSMiL,Walker:CLS,Castellanos:FA,Martin:CLS"  # Check compliance

# Injuries
majordomo injuries list --team CLS --active   # Active injuries for team
majordomo injuries list --sort return-asc     # Sort by return date

# Statistics (Season Leaders)
majordomo stats batting --sort woba --min-pa 100 --limit 25    # Batting leaders
majordomo stats pitching --sort era --min-outs 100 --limit 25  # Pitching leaders
majordomo stats batting --team CLS            # Team batting stats

# Game Results
majordomo results --team CLS --week 9         # Team results for week
majordomo results list --week-start 1 --week-end 4  # Results for week range

# Game Schedule
majordomo schedule --team CLS --week 10       # Team schedule for week
majordomo schedule list --week-start 10 --week-end 12  # Schedule for week range

Options

⚠️ IMPORTANT: --env, --json, --verbose are top-level flags that go BEFORE the subcommand. --season is a subcommand flag that goes AFTER the subcommand.

# Top-level flags (BEFORE subcommand)
--env prod|dev    # Environment (default: prod)
--json            # Output as JSON (shows all fields including salary_cap)
--verbose / -v    # Show API request details

# Subcommand flags (AFTER subcommand)
--season / -s N   # Specify season (defaults to current)

Correct:

python3 ~/.claude/skills/major-domo/cli.py --json team get CLS
python3 ~/.claude/skills/major-domo/cli.py --env dev team roster CAN

Wrong (will error):

python3 ~/.claude/skills/major-domo/cli.py team get CLS --json    # ❌
python3 ~/.claude/skills/major-domo/cli.py team roster CAN --env prod  # ❌

Key Notes

  • team get shows salary_cap in formatted output; use --json for all fields
  • team roster shows Active/Short IL/Long IL with WARA values for Active only
  • "Long IL" = MiL (minor leagues)
  • For individual player lookups, use player get "Name" — avoid bulk API queries (/players?team_id=X) which can timeout on large rosters
  • Prefer CLI over direct API client for all standard operations
  • transactions simulate validates compliance without making changes — check roster count, WARA limits, salary cap
  • stats commands support standard baseball stats sorting (woba, obp, slg, era, whip, fip, etc.)
  • injuries list shows return_date, weeks_out, and injury_type for all injured players

Examples

# Roster moves
python3 ~/.claude/skills/major-domo/cli.py player move --batch "Gerrit Cole:CAN,Robert Suarez:CANMiL"

# Check standings
python3 ~/.claude/skills/major-domo/cli.py standings --division ALE

# Get team roster
python3 ~/.claude/skills/major-domo/cli.py team roster CAN

# Get team salary cap (need --json)
python3 ~/.claude/skills/major-domo/cli.py --json team get CAN

# Check transaction compliance (dry run)
python3 ~/.claude/skills/major-domo/cli.py transactions simulate CLS "Stott:CLSMiL,Walker:CLS,Castellanos:FA,Martin:CLS"

# View recent transactions
python3 ~/.claude/skills/major-domo/cli.py transactions --team CLS --week 9
python3 ~/.claude/skills/major-domo/cli.py transactions list --week-start 1 --week-end 4

# Check injuries
python3 ~/.claude/skills/major-domo/cli.py injuries list --active
python3 ~/.claude/skills/major-domo/cli.py injuries list --team CLS

# Season batting leaders
python3 ~/.claude/skills/major-domo/cli.py stats batting --sort woba --min-pa 100 --limit 25
python3 ~/.claude/skills/major-domo/cli.py stats batting --team CLS

# Season pitching leaders
python3 ~/.claude/skills/major-domo/cli.py stats pitching --sort era --min-outs 100 --limit 25
python3 ~/.claude/skills/major-domo/cli.py stats pitching --team CAN --sort k

# Game results and schedules
python3 ~/.claude/skills/major-domo/cli.py results --team CLS --week 9
python3 ~/.claude/skills/major-domo/cli.py schedule --team CLS --week 10
python3 ~/.claude/skills/major-domo/cli.py schedule list --week-start 10 --week-end 12

# Practical workflows
# 1. Check if proposed trades are compliant before executing
python3 ~/.claude/skills/major-domo/cli.py transactions simulate CLS "Player1:CLS,Player2:CLSMiL"

# 2. Review team stats and identify weak positions
python3 ~/.claude/skills/major-domo/cli.py team roster CLS
python3 ~/.claude/skills/major-domo/cli.py stats batting --team CLS

# 3. Monitor weekly transactions across the league
python3 ~/.claude/skills/major-domo/cli.py transactions list --week-start 8 --week-end 9

# 4. Check injury status before setting lineups
python3 ~/.claude/skills/major-domo/cli.py injuries list --team CLS --active

Transaction Compliance Check Workflow

Recommended approach - Use the simulate command for automatic compliance validation:

# Simulate proposed transactions (dry run - no changes made)
python3 ~/.claude/skills/major-domo/cli.py transactions simulate CLS "Stott:CLSMiL,Walker:CLS,Castellanos:FA,Martin:CLS"

The simulate command automatically validates:

  • Active roster count = 26
  • Total sWAR ≤ salary cap
  • All players exist and can be moved to target destinations
  • Returns detailed compliance report with before/after state

Manual verification workflow (if needed):

  1. Get current ML roster: cli.py team roster ABBREV → note player count and WARA values
  2. Get salary cap: cli.py --json team get ABBREV → read salary_cap field
  3. Look up incoming players: cli.py player get "Name" for each player being added to ML
  4. Calculate: Current ML sWAR ± transaction changes ≤ salary_cap, and roster count = 26
  5. Process moves: cli.py player move --batch "Name1:Team1,Name2:Team2"

Quick Reference Commands

API Client Usage

# Test API connection
cd ~/.claude/skills/major-domo
python api_client.py --env prod --verbose

# Get current season/week
python -c "from api_client import MajorDomoAPI; api = MajorDomoAPI('prod'); print(api.get_current())"

Docker Management

# Start all services
cd /mnt/NV2/Development/major-domo/database
docker-compose up -d

# View logs
docker-compose logs -f app

# Restart API
docker-compose restart app

# Stop all services
docker-compose down

Database Access

# Via Adminer web UI
# Visit http://10.10.0.42:8080

# Via psql
psql -h 10.10.0.42 -U sba_admin -d sba_master

# Sync production to dev
docker-compose --profile sync up sync-prod

Workflow Selection

When user request matches a specific workflow: → Follow the workflow document

When user request is ad-hoc query: → Use API client directly to answer

Examples:

Request Approach
"Deploy bot to production" bot-deployment workflow
"Update weekly stats" weekly-stats-update workflow
"Run database migration" database-migration workflow
"Show player stats" Ad-hoc: api.get_player()
"List teams" Ad-hoc: api.list_teams()
"Start new season" season-rollover workflow

Deployment (deploy skill)

For Docker-based deployment workflows, use the dedicated deploy skill.

Quick Commands:

# Dry run (see what would happen)
~/.claude/skills/deploy/deploy.sh md-discord patch --dry-run
~/.claude/skills/deploy/deploy.sh md-database minor --dry-run

# Actual deployment
~/.claude/skills/deploy/deploy.sh md-discord patch
~/.claude/skills/deploy/deploy.sh md-database minor

Services:

Service Docker Image Production Path
md-discord manticorum67/major-domo-discordapp /root/container-data/major-domo
md-database manticorum67/major-domo-database /root/container-data/sba-database

Version Bump Types: major, minor, patch

Workflow:

  1. Increment VERSION file
  2. Build Docker image (version + latest tags)
  3. Push to Docker Hub
  4. SSH to akamai, pull and restart container
  5. Git commit and tag

Additional Resources

API Documentation:

  • OpenAPI/Swagger: http://10.10.0.42/api/docs
  • Router files: /mnt/NV2/Development/major-domo/database/app/routers_v3/

Database Schema:

  • /mnt/NV2/Development/major-domo/database/app/db_engine.py

Discord Bot Examples:

  • Original: /mnt/NV2/Development/major-domo/discord-app/cogs/
  • v2: /mnt/NV2/Development/major-domo/discord-app-v2/commands/

Project Documentation:

  • Database: /mnt/NV2/Development/major-domo/database/CLAUDE.md
  • Root: /mnt/NV2/Development/major-domo/CLAUDE.md

Last Updated: 2025-11-10 Maintainer: Cal Corum Version: 1.0