valettavamps

Baseball Game Skill

- DB: `src/services/db.ts` - Database functions

valettavamps 0 Updated 2mo ago
GitHub

Install

npx skillscat add valettavamps/baseball-game

Install via the SkillsCat registry.

SKILL.md

Baseball Game Skill

Use this skill when working on the SimForge Baseball baseball game project.

Project Location

/root/.openclaw/workspace/baseball-game

Key Commands

cd /root/.openclaw/workspace/baseball-game
npm run build  # Always run before pushing to catch TS errors
git add -A && git commit -m "message" && git push

Common TypeScript Issues (learned from build errors)

1. Duplicate Declarations

  • Check for same function name declared twice in same file
  • Look for duplicate imports from different lines

2. Wrong Import Source

  • calculateBreedingFees, calculateEpicChance, FORGE_CONFIG are in src/config/gameConfig.ts, NOT db.ts

3. Type Mismatches

  • Supabase uses snake_case (user_id, first_name)
  • localStorage StoredPlayer uses camelCase (userId, firstName)
  • When copying between, convert field names

4. Missing Interface Properties

  • When adding new features (like DNA), add to ALL relevant types:
    • src/types/index.ts (Player interface)
    • src/services/localStorage.ts (StoredPlayer interface)
    • Any component-specific player types (e.g., PlayerProfilePage)

5. Type Casting

// When string matches expected literal type
rarity: player.rarity as 'common' | 'rare' | 'epic'

6. Set Iteration

// Wrong - can't iterate Set directly in older TS targets
const allKeys = new Set([...keys1, ...keys2]);
for (const k of allKeys) { }

// Correct
const allKeys = Array.from(new Set([...keys1, ...keys2]));
for (const k of allKeys) { }

7. Always Import Types You Use

  • If using Player type in db.ts: import { Player } from '../types'
  • If using functions from gameConfig: import { calculateEpicChance } from '../config/gameConfig'

Before Pushing to GitHub

  1. Run npm run build locally
  2. Fix any TypeScript errors
  3. Check for duplicate imports/declarations
  4. Verify all imports point to correct modules

Supabase SQL

Run SQL in Supabase SQL Editor (not the file path):

  • docs/forge_schema.sql - copy contents, not filename
  • docs/game_config.sql - copy contents, not filename

Important Files

  • Config: src/config/gameConfig.ts - Game settings (Epic %, fees, commissioner emails)
  • Types: src/types/index.ts - Player, PlayerDNA interfaces
  • Storage: src/services/localStorage.ts - StoredPlayer type
  • DB: src/services/db.ts - Database functions

Categories