--- name: trace-annotation-tool description: > Generate a custom trace annotation web app for open coding during LLM error analysis. Use when the user wants to review LLM traces, annotate failures with freeform comments, and do first-pass qualitative labeling (open coding). Also use when the user mentions "annotate traces", "trace review tool", "open coding tool", "label traces", "build an annotation interface", "review LLM outputs", or wants to manually inspect pipeline traces before building a failure taxonomy. This skill produces a tailored Python web application using FastHTML, TailwindCSS, and HTMX. --- # Trace Annotation Tool Generator Generate a custom local web application for **open coding** of LLM traces — the first qualitative pass of error analysis in the Analyze phase of the evaluation lifecycle. ## Core Workflow ### Step 1: Understand the User's Trace Data 1. Ask the user to point to their trace data file (CSV, JSONL, JSON, or any structured format). 2. Read a sample of the data to understand its structure: field names, nesting depth, which fields represent the user query, intermediate steps, tool calls, and final output. 3. Identify a unique trace identifier field (or generate sequential IDs if none exists). 4. Confirm the structure with the user: "I see fields X, Y, Z — which represent the trace steps, and which is the user query?" ### Step 2: Ask About Additional Features The tool includes these features by default: - **Trace viewer**: One trace at a time, with tailored visual rendering of the trace structure - **Freeform notes**: Text field for open coding observations - **Pass / Fail / Defer**: Binary judgment with a defer option for uncertain traces - **Keyboard shortcuts**: Navigation and annotation hotkeys - **Progress indicator**: "17 / 100 reviewed" with pass/fail/defer counts - **Auto-save**: Annotations saved to a separate JSONL file on every action Ask the user: "These are the default features. Do you want anything else before I generate the tool?" Then incorporate any additional requests. ### Step 3: Generate the Application Generate a single-directory Python web application with this structure: ``` trace-annotator/ ├── app.py # FastHTML application (single file, all routes) ├── requirements.txt # Dependencies (fasthtml, python-fasthtml) └── README.md # Brief usage instructions ``` #### Technology Stack - **FastHTML** for the web framework (HTMX is built-in) - **TailwindCSS via CDN** (`