# Getting Started with Major Domo Skill ## Quick Start The Major Domo skill is now ready to use! This skill provides comprehensive support for managing your Strat-o-Matic Baseball Association (SBA) fantasy baseball league. ## What's Been Created ``` ~/.claude/skills/major-domo/ ├── SKILL.md # Main skill documentation (quick reference) ├── GETTING_STARTED.md # This file ├── api_client.py # Python API client for SBA database ├── workflows/ # Detailed workflow documentation │ ├── bot-deployment.md # Discord bot deployment guide │ └── database-migration.md # Database migration procedures └── scripts/ # Utility scripts ├── README.md # Scripts documentation └── validate_database.py # Database validation tool ``` ## Activation The skill will automatically activate when you mention: - "Major Domo" - "SBA" (Strat-o-Matic Baseball Association) - "Discord bot deployment" - "Database migration" - Player/team queries for your league - League operations ## Environment Setup ### Required Environment Variables ```bash # Add to ~/.bashrc or ~/.profile export API_TOKEN='your-api-token' export DATABASE='prod' # or 'dev' ``` ### Optional Variables ```bash # For Discord bot export BOT_TOKEN='your-discord-bot-token' export GUILD_ID='your-discord-server-id' export DB_URL='http://10.10.0.42/api/v3' # For database access export POSTGRES_HOST='10.10.0.42' export POSTGRES_USER='sba_admin' export POSTGRES_PASSWORD='your-password' export POSTGRES_DB='sba_master' ``` ## Testing the API Client ### Quick Test ```bash cd ~/.claude/skills/major-domo python api_client.py --env prod --verbose ``` **Expected Output**: ``` Connected to prod environment Base URL: http://10.10.0.42/api/v3 Current Status: Season: 12 Week: X Freeze: False Trade Deadline: Week Y Active Teams in Season 12: Z CAR: Carolina ... ... ✅ API client working correctly! ``` ### Python Usage ```python from api_client import MajorDomoAPI # Initialize api = MajorDomoAPI(environment='prod', verbose=True) # 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') print(f"{team['lname']} - Manager: {team['manager1']['name']}") # List players players = api.list_players(season=12, team_id=team['id']) print(f"Roster size: {len(players)}") # Search players results = api.search_players(query='trout', season=12) for player in results: print(f"{player['name']} - {player['team']['abbrev']}") # Get standings standings = api.get_standings(season=12, division_abbrev='ALE') for team in standings[:3]: print(f"{team['team']['abbrev']}: {team['wins']}-{team['losses']}") ``` ## Running Database Validation ```bash cd ~/.claude/skills/major-domo/scripts # Validate production database python validate_database.py --env prod # Validate development database python validate_database.py --env dev --verbose # Validate specific season python validate_database.py --env prod --season 11 ``` ## Common Use Cases ### 1. Query Player Stats **Ask me**: - "Show me stats for Mike Trout in Major Domo" - "List all players on team CAR" - "Search for players named Smith in SBA" ### 2. Check League Status **Ask me**: - "What's the current season and week in SBA?" - "When is the trade deadline?" - "Show me standings for AL East" ### 3. Discord Bot Operations **Ask me**: - "Deploy Major Domo bot to production" - "Test the Discord bot on dev server" - "Check bot status" ### 4. Database Operations **Ask me**: - "Run database validation for Major Domo" - "Help me create a database migration for SBA" - "Check database health" ### 5. Analytics & Reports **Ask me**: - "Show top 50 hitters by wOBA in season 12" - "List pitching leaders by ERA" - "Generate weekly report for SBA" ## Workflows ### Bot Deployment See `workflows/bot-deployment.md` for step-by-step guide: 1. Test on dev server 2. Commit changes 3. Deploy to production 4. Verify deployment 5. Rollback if needed ### Database Migration See `workflows/database-migration.md` for detailed procedures: 1. Create migration file 2. Test on development 3. Backup production 4. Apply migration 5. Verify changes ## Architecture Overview ### System Components - **Database API** (FastAPI + PostgreSQL) - Production: `https://api.sba.manticorum.com/v3/` - Development: `http://10.10.0.42:8000/api/v3/` **⚠️ IMPORTANT**: Always use the API for data access. Local SQLite databases (*.db files) are out of date and should NEVER be queried. - **Discord Bot** (discord.py) - v1: `/home/cal/major-domo/discord-app/` - v2: `/home/cal/major-domo/discord-app-v2/` (recommended) - **Website** (Vue.js + TypeScript) - `/mnt/NV2/Development/major-domo/sba-website/` ### API Endpoints (routers_v3/) **Core Data**: - `/current` - Season/week status - `/players` - Player data and search - `/teams` - Team data and rosters - `/standings` - League standings - `/transactions` - Player transactions **Statistics**: - `/views/season-stats/batting` - Batting leaders - `/views/season-stats/pitching` - Pitching leaders - `/battingstats` - Game-by-game batting - `/pitchingstats` - Game-by-game pitching **League Management**: - `/schedules` - Game schedules - `/results` - Game results - `/injuries` - Injury tracking - `/awards` - League awards **Draft System**: - `/draftdata` - Draft status - `/draftpicks` - Pick ownership - `/keepers` - Keeper selections ## Troubleshooting ### API Connection Issues ```bash # Test API directly curl -H "Authorization: Bearer $API_TOKEN" \ http://10.10.0.42/api/v3/current # Check environment variables echo $API_TOKEN echo $DATABASE ``` ### Import Errors ```bash # Ensure you're in the right directory cd ~/.claude/skills/major-domo # Or set PYTHONPATH export PYTHONPATH="/home/cal/.claude/skills/major-domo:$PYTHONPATH" ``` ### Permission Errors ```bash # Make scripts executable chmod +x ~/.claude/skills/major-domo/api_client.py chmod +x ~/.claude/skills/major-domo/scripts/*.py ``` ## Next Steps 1. **Set up environment variables** (API_TOKEN, DATABASE) 2. **Test the API client** (`python api_client.py --env prod`) 3. **Run database validation** (`python scripts/validate_database.py`) 4. **Try some queries** through me (just ask!) 5. **Explore workflows** for bot deployment and database migrations ## Additional Resources - **SKILL.md** - Complete skill documentation - **workflows/** - Step-by-step procedural guides - **scripts/** - Utility scripts and examples - **API Documentation** - http://10.10.0.42/api/docs (Swagger UI) ## Getting Help Just ask me! The skill is now active and I can help with: - API queries and data retrieval - Discord bot deployment - Database migrations - League operations - Analytics and reporting - Development workflows --- **Skill Version**: 1.0 **Created**: 2025-11-10 **Maintainer**: Cal Corum **Status**: ✅ Ready to use!