Verify Tetris architecture compliance with coding rules and design patterns. Use when reviewing code, implementing features, refactoring, or validating architectural decisions...
Automatically verify code compliance with Tetris project architecture rules.
// ā Prohibited
class GameState { }
enum Direction { UP, DOWN, LEFT, RIGHT }
// ā
Required
type GameState = { /* ... */ }
type Direction = 'UP' | 'DOWN' | 'LEFT' | 'RIGHT'
any Type// ā Prohibited
function process(data: any) { }
// ā
Required
function process(data: unknown) {
if (isValidData(data)) {
// Type-safe processing
}
}
!)// ā Prohibited
const value = optional!.property
// ā
Required
const value = optional?.property
if (optional) {
const value = optional.property
}
// ā Prohibited
<button>Start Game</button>
// ā
Required
<button>{t('game.start')}</button>
// ā Prohibited (in React components)
interface Props {
value: string
}
// ā
Required
type Props = {
value: string
}
/src)// ā Prohibited
import { util } from '../../../utils'
// ā
Required
import { util } from '@/utils' // Cross-directory
import { util } from './utils' // Same directory
// ā
Pure functions preferred
export const calculateScore = (params: ScoreParams): number => {
// Pure function logic
}
// ā Classes not allowed
class ScoreCalculator { }
// ā
Required for game logic
type Result<T, E> = { ok: true; value: T } | { ok: false; error: E }
export const placePiece = (
board: Board,
piece: Piece,
position: Position
): Result<Board, PlacementError> => {
if (!isValidPosition(board, piece, position)) {
return { ok: false, error: 'INVALID_POSITION' }
}
return { ok: true, value: updatedBoard }
}
// ā
Cross-directory imports
import { Board } from '@/game/board'
import { Piece } from '@/game/pieces'
// ā
Same-directory imports
import { helper } from './helper'
import { utils } from './utils'
src/game/
āāā board.ts
āāā board.test.ts # ā
Co-located
āāā pieces.ts
āāā pieces.test.ts # ā
Co-located
// ā
All UI strings use i18n
import { useTranslation } from 'react-i18next'
const { t } = useTranslation()
return <div>{t('game.title')}</div>
useId() for Dynamic IDs// ā Static IDs
<label htmlFor="game-input">
// ā
Dynamic IDs
const id = useId()
<label htmlFor={id}>
# Check for prohibited classes
rg "^class\s+\w+" src/
# Check for enums
rg "^enum\s+\w+" src/
# Check for any types
rg ":\s*any(\s|;|,|\))" src/
# Check for non-null assertions
rg "\!\." src/
# Check for hardcoded strings
rg '"[A-Z][a-zA-Z\s]{3,}"' src/ui/
any types!)@/ or ./ conventionsThis document contains all prohibited and required patterns inline above.
See .claude/rules/ for additional architectural guidelines.