pattern-schema
Use the ct skill, or read skills/ct/SKILL.md, for CLI documentation when
running commands.
Schema Design Phase
Goal
Create schemas.tsx with all data types and Input/Output types BEFORE any
pattern code.
Read First
docs/common/concepts/types-and-schemas/default.mddocs/common/concepts/types-and-schemas/writable.mddocs/common/concepts/pattern.md(Input/Output section)
Rules
- ALWAYS use
pattern<Input, Output>()- Never use single-typepattern<State>(). Single-type patterns cannot be tested via.send(). - Every editable field needs
Writable<>in Input type (for write access) - Output types never use
Writable<>- they reflect returned data shape - Fields that could be undefined initially: use
Default<T, value> - Actions in Output type:
Stream<T>(enables testing and linking) - Sub-patterns need
[NAME]: stringand[UI]: VNodein Output type
Template
import { Default, NAME, Stream, UI, VNode, Writable } from "commontools";
// ============ DATA TYPES ============
export interface Item {
name: Default<string, "">;
done: Default<boolean, false>;
}
// ============ PATTERN INPUT/OUTPUT ============
export interface ItemInput {
item: Writable<Item>; // Writable in Input = pattern will modify
}
export interface ItemOutput {
[NAME]: string; // Required for sub-patterns
[UI]: VNode; // Required for sub-patterns
item: Item; // No Writable in Output
toggle: Stream<void>; // Actions as Stream<T>
}
Done When
- All data types defined with correct Writable/Default wrapping
- All Input/Output types defined for each sub-pattern
- No TypeScript errors:
deno task ct check schemas.tsx --no-run
More from commontoolsinc/labs
knowledge-base
Shared foundation for Oracle & Corrector agents. Establishes the source hierarchy for resolving conflicts between documentation, code, and specs. Load this skill first when investigating how the system works.
97lit-component
Guide for developing Lit web components in the Common UI v2 system (@commonfabric/ui/v2). Use when creating or modifying cf- prefixed components, implementing theme integration, working with Cell abstractions, or building reactive UI components that integrate with the Common Fabric runtime.
61pattern-critic
Critic agent that reviews pattern code for violations of documented rules, gotchas, and anti-patterns. Produces categorized checklist output with [PASS]/[FAIL] for each rule.
54task-management
Guide for managing tasks within a session using bd (beads) for subtasks and local todo lists. Use this skill when breaking down plans into issues, tracking progress, managing dependencies, or coordinating work across sessions and agents. Triggers include requests to "manage tasks", "track progress", "break down this work", or questions about bd workflow.
52pattern-debug
Debug pattern errors systematically
51pattern-ui
Add UI polish with layout and styling
51