tabuleiro-e-jogada

Documents chess board rendering, coordinate systems, and move interaction logic in the KrockSide React frontend.

Updated Jan 28, 2024
One-click install
npx skills add https://github.com/Thiago-Cruz-eng/KrockSide --skill tabuleiro-e-jogada-thiago-cruz-eng
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tabuleiro-e-jogada
Source: https://github.com/Thiago-Cruz-eng/KrockSide/tree/main/.agents/skills/tabuleiro-e-jogada
Command: npx skills add https://github.com/Thiago-Cruz-eng/KrockSide --skill tabuleiro-e-jogada-thiago-cruz-eng

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working on the KrockSide chess board UI is error-prone: three overlapping coordinate systems (algebraic, file/rank, row/column) with an inverted column axis, a known bug that disables all moves because player color is read from the wrong JWT claim, and strict rules against client-side chess logic. This Skill captures that domain knowledge so changes to ChessBoard, ChessSquare, and useChessGame don't reintroduce classic bugs. ## Core Features & Use Cases - Coordinate system reference: Explains the three coordinate representations, the inverted column axis, and the conversion helpers in src/types/chess.ts that must be used instead of inline math. - Move interaction model: Documents the two-click selection machine, drag-and-drop handling, server-driven state updates via BoardChanged events, and the rule to never update the board before the server responds. - Known bugs and constraints: Catalogs confirmed issues (DT-01 color claim bug blocking all moves, DT-09 missing black-side perspective flip, DT-13 synthetic squares masking incomplete snapshots) plus stable test selectors. - Use Case: You need to fix a square that doesn't respond to clicks. The Skill tells you the root cause is likely DT-01 (playerColor always 'None' disables all 64 squares) and directs you to propagate color from JoinRoomResponse instead of the JWT role claim. ## Quick Start Ask the AI to explain why chess squares are not responding to clicks in the KrockSide board and how to fix the player color bug.

Frequently Asked Questions about tabuleiro-e-jogada

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why are chess board squares not responding to clicks in React?

In KrockSide, all 64 squares receive disabled=true because playerColor is derived from the JWT role claim, which contains permission roles like 'jogador' instead of 'white' or 'black'. The fix is propagating color from JoinRoomResponse or PlayerJoinedEvent (issue DT-01).

How do I convert between chess board coordinate systems?

Use the helpers in src/types/chess.ts: file = 'a' + row, rank = 8 - column. The column axis is inverted (column 0 is rank 8), and row actually means the file a-h. Never reimplement these conversions inline.

Should the client update the chess board before the server responds?

No. The board state must only update from the server's result.snapshot or the BoardChanged event. This enforces the rule that no chess logic exists client-side; the server decides whether a move is valid.

What test selectors are stable for chess board components?

Use data-testid="square-{algebraic}", data-algebraic, data-testid="current-turn", data-testid="player-color", role="alert", and the piece image alt text. CSS classes like highlighted, light, or dark are styling only and must not be used as test selectors.

Does the KrockSide board support checkmate, castling, or move history?

No. The backend never sets snapshot.finished to true, and there is no checkmate, draw, promotion, castling, en passant, move history, or clock. The isInCheckState flag arrives in PieceDto but is unused in rendering.