Development guidelines for the Social Bingo game built with React 19, TypeScript, Vite, and Tailwind v4. Includes architecture patterns, testing workflows, and pre-commit checklist.
Development guidelines for **Soc Ops**, a Social Bingo game with a 5×5 grid and icebreaker questions. Win by marking 5 in a row.
Before committing code, ensure:
1. **Lint passes:** `npm run lint`
2. **Build succeeds:** `npm run build` (TypeScript + Vite)
3. **Tests pass:** `npm run test` (or no new utils added)
```
App → (useBingoGame hook)
├── StartScreen
├── GameScreen
│ └── BingoBoard → BingoSquare[]
└── BingoModal
```
**State Management:**
**Win Detection:**
```
src/
types/ # BingoSquareData, GameState, BingoLine
utils/ # generateBoard(), toggleSquare(), checkBingo()
data/ # questions array (24 items), FREE_SPACE constant
hooks/ # useBingoGame (state + persistence)
components/ # App, GameScreen, BingoBoard, BingoSquare, etc.
```
**Conventions:**
1. **Generate:** `generateBoard()` shuffles 24 questions via Fisher-Yates, injects FREE SPACE at center (index 12)
2. **Mutate:** `toggleSquare()` immutably flips `isMarked` (non-free squares only)
3. **Persist:** localStorage key `bingo-game-state` with `validateStoredData()` type guard
4. **Detect:** `checkBingo()` runs on each state change → shows modal on win
**localStorage Format:**
```typescript
{
version: number,
gameState: 'start' | 'playing' | 'bingo',
board: BingoSquareData[],
winningLine: BingoLine | null
}
```
**Test Runner:** Vitest with globals enabled
**Setup:** `src/test/setup.ts` (jest-dom matchers + cleanup)
**Coverage:**
**Patterns:**
**Example Test Structure:**
```typescript
describe('checkBingo', () => {
it('detects horizontal bingo', () => {
const board = generateTestBoard([0,1,2,3,4]);
expect(checkBingo(board)).toBeTruthy();
});
});
```
1. Edit `src/data/questions.ts` (must have 24+ items)
2. No code changes needed (auto-shuffled on board generation)
1. Understand expected behavior from existing tests
2. Add test case reproducing the bug
3. Fix implementation
4. Verify localStorage round-trip still works
```bash
npm run dev
npm run build
npm run test
npm run lint
```
**Auto-deploy:**
**Center Square Behavior:**
**Board Generation:**
**State Persistence:**
**Type Safety:**
**localStorage Failures:**
**Build Errors:**
1. **Keep components pure:** All state in `useBingoGame` hook
2. **Test business logic:** Focus tests on `utils/` functions
3. **Use TypeScript strictly:** No implicit `any`, validate all inputs
4. **Minimize dependencies:** Prefer vanilla solutions over libraries
5. **Document type guards:** Add JSDoc for runtime validators
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/soc-ops-copilot-instructions/raw