claude-configs/skills/major-domo/SKILL.md
Cal Corum 43d32e9b9d Update major-domo skill CLI refactor and plugin/config updates
- Refactor major-domo skill: api_client.py, cli.py, and CLI modules (admin, common, injuries, results, schedule, transactions) with significant simplification (-275 lines net)
- Update CLI_REFERENCE.md and SKILL.md docs for major-domo
- Update create-scheduled-task SKILL.md
- Update plugins blocklist.json and known_marketplaces.json
- Add patterns/ directory to repo
- Update CLAUDE.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 02:00:41 -05:00

174 lines
5.7 KiB
Markdown

---
name: major-domo
description: Major Domo SBA fantasy baseball management. USE WHEN user mentions Major Domo, SBA, league operations, player stats, team rosters, Discord bot, database migrations, or Strat-o-Matic Baseball Association.
---
# Major Domo - SBA Fantasy Baseball League Management
**SCOPE**: Only use in major-domo-v2, major-domo-bot, major-domo-database repos. Do not activate in unrelated projects.
## When to Activate
- Discord bot operations, deployment, status checks
- League operations: weekly stats, injuries, trade deadlines
- Data queries: player stats, team rosters, standings, transactions
- Database operations: migrations, sync, health checks
- Analytics: batting/pitching leaders, team analysis
## What is Major Domo?
Comprehensive system for managing the **Strat-o-Matic Baseball Association (SBA)**:
- **Database API**: FastAPI + PostgreSQL (prod: `https://api.sba.manticorum.com/v3/`, dev: `http://10.10.0.42:8000/api/v3/`)
- **Discord Bot**: Python bot (discord.py 2.5.2) + v2 with enhanced logging
- **Website**: Vue 3 + TypeScript
- **Seasons**: 18 weeks, 4 games/week, draft with keepers and pick trading
- **Current Season**: 12
---
## CRITICAL: Safety Rules
### API-First Data Access
- **ALWAYS** use the API or CLI — never query databases directly
- **NEVER** access local SQLite databases (always out of date)
- Production API is the single source of truth
- Exception: direct DB access only when user **explicitly requests** it
### CLI-First for Operations
```bash
python3 ~/.claude/skills/major-domo/cli.py <command>
```
**IMPORTANT**: Before running ANY CLI command, read `~/.claude/skills/major-domo/CLI_REFERENCE.md` for the full command list, flag ordering rules, and available options. Do not guess at CLI syntax — the reference is authoritative.
### Before Every Commit
- Run `git remote -v` to verify repository
- Major Domo: `/mnt/NV2/Development/major-domo/`
### 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
---
## Architecture
```
major-domo/
├── database/ # FastAPI backend (PostgreSQL)
│ ├── app/main.py # FastAPI application
│ ├── app/db_engine.py # Peewee ORM models
│ ├── app/routers_v3/ # API v3 endpoints
│ └── migrations/ # SQL migration files
├── discord-app/ # Original Discord bot
├── discord-app-v2/ # Next-gen bot with enhanced logging
└── sba-website/ # Vue.js frontend
```
### Database Models (Key Entities)
- **Core**: Current, Player, Team, Manager, Division
- **Stats**: BattingStat, PitchingStat, FieldingStat, SeasonBattingStats, SeasonPitchingStats
- **League**: Standings, Schedule, Result, Transaction, Injury, Award
- **Draft**: DraftData, DraftPick, DraftList, Keeper
- **Game**: StratGame, StratPlay, SBAPlayer
---
## Workflows
| Workflow | Trigger | Details |
|----------|---------|---------|
| Bot Deployment | "Deploy bot" | `workflows/bot-deployment.md` |
| Weekly Stats | "Update weekly stats" | `workflows/weekly-stats-update.md` |
| Database Migration | "Run migration" | `workflows/database-migration.md` |
| Season Rollover | "Start new season" | `workflows/season-rollover.md` |
## Common Queries
```bash
# Status
cli.py status # Current season/week
# Players
cli.py player get "Mike Trout" # Player info
cli.py player search "trout" # Fuzzy search
# Teams
cli.py team roster CAR # Full roster breakdown
cli.py --json team get CAR # All fields inc. salary_cap
# Standings & Stats
cli.py standings --division ALE # Division standings
cli.py stats batting --sort woba --min-pa 100 # Batting leaders
cli.py stats pitching --sort era --min-outs 100 # Pitching leaders
# Transactions
cli.py transactions --team CLS --week 9 # Team transactions
cli.py transactions simulate CLS "P1:CLSMiL,P2:CLS" # Compliance check
# Admin
cli.py admin recalculate-standings # Recalculate standings
cli.py admin refresh-stats # Refresh stat views
```
---
## Reference Files
| File | Purpose |
|------|---------|
| `API_REFERENCE.md` | Full API endpoints, authentication, Python client |
| `CLI_REFERENCE.md` | Complete CLI commands, flag ordering, workflows |
| `workflows/bot-deployment.md` | Bot deployment procedure |
| `workflows/database-migration.md` | Migration procedure |
| `GETTING_STARTED.md` | Onboarding guide |
## Environment Variables
| Variable | Purpose |
|----------|---------|
| `API_TOKEN` | API auth token (required) |
| `DATABASE` | Environment: `prod` or `dev` |
| `BOT_TOKEN` | Discord bot auth |
| `GUILD_ID` | Discord server ID |
| `DB_URL` | Database API endpoint |
## Development
```bash
# Database API (Docker)
cd /mnt/NV2/Development/major-domo/database
docker-compose up --build
# Discord Bot
cd /mnt/NV2/Development/major-domo/discord-app-v2
python bot.py
# Website
cd /mnt/NV2/Development/major-domo/sba-website
npm run dev
# Tests
cd /mnt/NV2/Development/major-domo/discord-app-v2
python -m pytest --tb=short -q
```
## Deployment
Use the `deploy` skill for Docker-based deployments:
```bash
~/.claude/skills/deploy/deploy.sh md-discord patch
~/.claude/skills/deploy/deploy.sh md-database minor
```
| Service | 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` |
---
**Updated**: 2026-03-05
**Version**: 2.0.0 (modularized)