From threadline-ai
Use this skill when the user wants to translate a component inventory into framework-specific component specifications. Triggers include 'generate component specs', 'turn components into code', 'derive props from the inventory', 'spec the frontend components'. Also use when constraining AI-assisted frontend generation. This skill is optional in the pipeline — use after component-inventory and screen-inventory. Do NOT use before a component inventory exists.
How this skill is triggered — by the user, by Claude, or both
Slash command
/threadline-ai:component-to-codeThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Translates a component inventory into framework-specific component specifications — props, state mappings, and screen ID traceability — for implementation or AI-assisted code generation.
Translates a component inventory into framework-specific component specifications — props, state mappings, and screen ID traceability — for implementation or AI-assisted code generation.
The component inventory defines what exists and what states it supports. This skill bridges to how those components are expressed in code. Without it, traceability from use case to UI breaks at the code boundary.
Key principle: every variant maps to a concrete prop combination, and every prop combination traces back to a screen ID and use case step.
Extract the dimensions that change between variants. Each dimension becomes a prop.
| Variant pair | What changes | Prop | Type |
|---|---|---|---|
empty vs filled | presence of value | value | string | null |
required-error vs type-error | error kind | error | { code: string, message: string } | null |
disabled vs active | interactivity | disabled | boolean |
Static props needed for rendering (e.g. fieldId, label, type) come from the component description and screen context.
Each variant becomes a named state expressed as a specific prop combination — the contract between design and code.
Every state must reference the screen ID it was derived from, linking back to the use case step or extension via the screen inventory.
One spec block per component:
Component: FormFieldBlock
Framework: React + TypeScript
Props:
fieldId: string
label: string
type: "text" | "number" | "date" | "select"
required: boolean
value: string | null
error: { code: string, message: string } | null
disabled: boolean
States (derived from component inventory variants):
FormFieldBlock/empty -> value=null, error=null
FormFieldBlock/filled -> value=string, error=null
FormFieldBlock/required-error -> value=null, error={ code: "required", ... }
FormFieldBlock/type-error -> value=string, error={ code: "type_mismatch", ... }
FormFieldBlock/disabled -> disabled=true
Derived from:
S-02-01 (empty), S-02-02 (filled), S-02-04 (ext 4a), S-02-05 (ext 4b)
interface or type. Use discriminated unions for mutually exclusive states.null over undefined for absent values — explicit and serialisable.defineProps<T>() with the same interface. Named states map to Histoire/Storybook entries.let declarations with TypeScript. Variant states map to reactive $: statements.The spec is framework-agnostic — only prop declaration syntax differs.
This spec serves the same role for frontend that the TDD test suite serves for backend: it defines the target before generation begins.
Provide the spec as context to the AI tool. Generated code must:
A component that adds undeclared props or ignores a variant has drifted from the spec. Reject it like code that fails a test.
Per component: (1) the spec block, (2) a state table mapping variants to props, (3) screen ID cross-references.
null for absent values, not undefinederror={ code: "required" } is testable; borderColor="red" is not. Keep it behavioural.Provides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
npx claudepluginhub bflandev/threadline-ai