pattern-schema
π―Skillfrom commontoolsinc/labs
Generates TypeScript schemas with Input/Output types for patterns, ensuring type safety and testability through structured type definitions.
Installation
npx skills add https://github.com/commontoolsinc/labs --skill pattern-schemaSkill Details
Design schemas.tsx with Input/Output types for patterns
Overview
Use Skill("ct") for ct 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()- Never use single-typepattern. 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 - Actions in Output type:
Stream(enables testing and linking) - Sub-patterns need
[NAME]: stringand[UI]: VNodein Output type
Template
```tsx
import { Default, NAME, Stream, UI, VNode, Writable } from "commontools";
// ============ DATA TYPES ============
export interface Item {
name: Default
done: Default
}
// ============ PATTERN INPUT/OUTPUT ============
export interface ItemInput {
item: Writable
}
export interface ItemOutput {
[NAME]: string; // Required for sub-patterns
[UI]: VNode; // Required for sub-patterns
item: Item; // No Writable in Output
toggle: Stream
}
```
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 this repository8
Guides developers in creating and integrating Lit web components within the Common UI v2 system, focusing on reactive, theme-aware, and runtime-integrated UI components.
Guides developers in creating reactive TypeScript patterns for CommonTools, focusing on efficient, iterative development from sketch to deployment.
Guides developers in deploying, managing, and interacting with charms and recipes using the CommonTools CLI through precise command-line operations.
Establishes a hierarchical source resolution system for Oracle & Corrector agents, prioritizing specs, code, and documentation.
Deploys and manages Claude patterns via CLI, enabling syntax checking, deployment, inspection, and testing of pattern handlers.
Validates pattern implementation by writing and executing structured test sequences for pattern-based components.
Applies standardized UI components and layout patterns to polish and structure user interfaces with consistent design.
Breaks down complex tasks into manageable subtasks using bd (beads), tracking progress and dependencies across sessions.