AgentSkillsCN

scaffold-screen

为叙事卡创建新的阶段屏幕组件。在构建设置屏幕、草稿屏幕、游戏画面、计分屏幕、结局屏幕,或任何新的阶段UI时使用。涵盖精确的Props签名、组件结构、设计系统类,以及在Index.tsx中的注册流程。

SKILL.md
--- frontmatter
name: scaffold-screen
description: "Create a new phase screen component for Narrative Cards. Use when building SetupScreen, DraftScreen, GameplayScreen, ScoringScreen, EndScreen, or any new phase UI. Covers exact prop signatures, component structure, design system classes, and registration in Index.tsx."
argument-hint: "Which screen to create (e.g. SetupScreen, GameplayScreen)"

Scaffold a Phase Screen Component

When to Use

  • Creating any of the 5 missing phase screens
  • Adding a new game phase that needs a UI
  • Replacing a screen component with a full implementation

All 5 Screens Are Missing

The app does not compile until src/components/screens/ exists with these files:

PhaseFileStatus
setupSetupScreen.tsx❌ missing
draftDraftScreen.tsx❌ missing
play / scene-endGameplayScreen.tsx❌ missing
scoringScoringScreen.tsx❌ missing
endEndScreen.tsx❌ missing

Procedure

1. Identify the target screen

Check which phase this screen belongs to. Refer to screen-props.md for the exact props already expected by Index.tsx.

2. Create the file

Path: src/components/screens/<Name>Screen.tsx

Use ScreenTemplate.tsx as your starting scaffold. Replace:

  • ExampleScreenProps<Name>ScreenProps
  • ExampleScreen<Name>Screen
  • Props with the correct signatures from screen-props.md
  • Placeholder content with the actual phase UI

3. Apply the design system

ElementClass / Token
Outer containernoir-card
Card panelsgame-card game-card-move (or element / event)
Headersfont-cinzel text-gold
Body textfont-crimson text-cream
Tension barmeter-tension
Coherence barmeter-coherence
Open factfact-open
Resolved factfact-resolved

shadcn/ui primitives available: Button, Card, Badge, Dialog, Progress, ScrollArea, Separator, etc. Import from @/components/ui/.

4. Import guards

Never import game logic directly — all actions come in as props from Index.tsx.

typescript
// ✅ Correct
interface GameplayScreenProps {
  gameState: GameState;
  onPlayCard: (playerId: string, cardId: string, targetFactId?: string, narrationText?: string) => void;
}

// ❌ Wrong — don't call useGameState inside a screen component
const { gameState } = useGameState();

5. Register the export

The file should use a named export, not a default export:

typescript
export function SetupScreen({ onStart }: SetupScreenProps) { ... }

Index.tsx already has the correct import paths — no changes needed there once the files exist.

6. Verify

  • TypeScript compiles without errors: npm run build
  • The screen renders at the correct phase
  • All action callbacks are wired to UI elements
  • No direct state mutations inside the component