claude-configs/skills/major-domo/scripts
Cal Corum 8a1d15911f Initial commit: Claude Code configuration backup
Version control Claude Code configuration including:
- Global instructions (CLAUDE.md)
- User settings (settings.json)
- Custom agents (architect, designer, engineer, etc.)
- Custom skills (create-skill templates and workflows)

Excludes session data, secrets, cache, and temporary files per .gitignore.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 16:34:21 -06:00
..
README.md Initial commit: Claude Code configuration backup 2026-02-03 16:34:21 -06:00
validate_database.py Initial commit: Claude Code configuration backup 2026-02-03 16:34:21 -06:00

Major Domo Scripts

Utility scripts for Major Domo (SBA) league management and automation.

Available Scripts

validate_database.py

Validate database integrity and check for common issues.

Usage:

python validate_database.py --env prod
python validate_database.py --env dev --verbose

Checks:

  • Orphaned records (players without teams, etc.)
  • Data consistency (standings vs results)
  • Missing required fields
  • Duplicate entries
  • Foreign key integrity

generate_report.py

Generate weekly league reports and statistics.

Usage:

python generate_report.py --season 12 --week 5
python generate_report.py --season 12 --week 5 --format markdown

Output:

  • Standings update
  • Weekly results summary
  • Injury report
  • Transaction summary
  • Statistical leaders

sync_data.py

Sync production data to development database.

Usage:

python sync_data.py
python sync_data.py --tables teams players standings

Features:

  • Full database sync or selective tables
  • Preserves development-specific data
  • Creates backup before sync
  • Verifies sync integrity

deploy_bot.sh

Automated Discord bot deployment script.

Usage:

./deploy_bot.sh prod  # Deploy to production
./deploy_bot.sh dev   # Deploy to development

Steps:

  • Pulls latest code
  • Runs tests
  • Stops current bot
  • Starts new bot
  • Verifies deployment

Environment Variables

Required:

export API_TOKEN='your-api-token'
export DATABASE='prod'  # or 'dev'

Optional:

export POSTGRES_HOST='10.10.0.42'
export POSTGRES_USER='sba_admin'
export POSTGRES_PASSWORD='your-password'
export POSTGRES_DB='sba_master'

Common Workflows

Weekly Stats Update

# 1. Generate weekly report
python generate_report.py --season 12 --week 5

# 2. Validate database integrity
python validate_database.py --env prod

# 3. Post report to Discord (manual or via bot)

Development Environment Setup

# 1. Sync production data to dev
python sync_data.py

# 2. Validate dev database
python validate_database.py --env dev

# 3. Test with API client
cd ~/.claude/skills/major-domo
python api_client.py --env dev --verbose

Bot Deployment

# 1. Test locally
cd /mnt/NV2/Development/major-domo/discord-app-v2
python -m pytest

# 2. Deploy to production
cd ~/.claude/skills/major-domo/scripts
./deploy_bot.sh prod

Development

Adding New Scripts

  1. Create script in this directory
  2. Add shebang and imports:
#!/usr/bin/env python3
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from api_client import MajorDomoAPI
  1. Add usage documentation to this README
  2. Make executable: chmod +x script_name.py

Testing Scripts

# Test with dev environment first
python script_name.py --env dev --verbose

# Verify output
python script_name.py --env dev --dry-run

Script Templates

Basic Script Template

#!/usr/bin/env python3
"""
Script Name - Brief Description

Usage:
    python script_name.py --env prod
"""

import sys
import os
import argparse

# Add parent directory to path for imports
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
from api_client import MajorDomoAPI


def main():
    parser = argparse.ArgumentParser(description='Script description')
    parser.add_argument('--env', choices=['prod', 'dev'], default='prod')
    parser.add_argument('--verbose', action='store_true')
    args = parser.parse_args()

    api = MajorDomoAPI(environment=args.env, verbose=args.verbose)

    # Your script logic here
    current = api.get_current()
    print(f"Season {current['season']}, Week {current['week']}")


if __name__ == '__main__':
    main()

Troubleshooting

Import Errors

# Ensure you're in the scripts directory
cd ~/.claude/skills/major-domo/scripts

# Or use absolute path
export PYTHONPATH="/home/cal/.claude/skills/major-domo:$PYTHONPATH"

API Connection Issues

# Test API connectivity
curl -H "Authorization: Bearer $API_TOKEN" \
  http://10.10.0.42/api/v3/current

# Verify environment variables
echo $API_TOKEN
echo $DATABASE

Permission Errors

# Make script executable
chmod +x script_name.py

# Run with python explicitly
python script_name.py

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