add-session-cardlisted
Install: claude install-skill ConfabulousDev/confab-web
# Add Session Analytics Card
Add a new analytics card to the session summary panel following the card-per-table architecture.
## Overview
The analytics system uses a **card-per-table** architecture where each card type has:
- Its own database table (`session_card_<name>`)
- Independent version constant for cache invalidation
- An **analyzer** that extracts metrics from a `FileCollection`
- Frontend component registered in the card registry
## Instructions for Claude
Use **TodoWrite** to track all phases. This is a multi-step task requiring both backend and frontend changes.
### Phase 1: Plan the Card
Before writing any code:
- [ ] Understand what metrics the card will display
- [ ] Identify which transcript line types contain the data
- [ ] Plan the database schema (what columns are needed)
- [ ] Plan the API response format
### Phase 2: Backend - Database Migration
Create migration files in `backend/internal/db/migrations/`:
**Up migration** (`000XXX_session_card_<name>.up.sql`):
```sql
CREATE TABLE session_card_<name> (
session_id UUID PRIMARY KEY REFERENCES sessions(id) ON DELETE CASCADE,
version INT NOT NULL DEFAULT 1,
computed_at TIMESTAMPTZ NOT NULL,
up_to_line BIGINT NOT NULL,
-- card-specific columns (use snake_case)
my_metric BIGINT NOT NULL DEFAULT 0
);
CREATE INDEX idx_session_card_<name>_version ON session_card_<name>(version);
```
**Down migration** (`000XXX_session_card_<name>.down.sql`):
```sql
DROP TABLE IF EXISTS session_c