pattern-schema

Use Skill("ct") for ct CLI documentation when running commands.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "pattern-schema" with this command: npx skills add commontoolsinc/labs/commontoolsinc-labs-pattern-schema

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.md

  • docs/common/concepts/types-and-schemas/writable.md

  • docs/common/concepts/pattern.md (Input/Output section)

Rules

  • ALWAYS use pattern<Input, Output>()

  • Never use single-type pattern<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]: string and [UI]: VNode in 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

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

pattern-dev

No summary provided by upstream source.

Repository SourceNeeds Review
Research

knowledge-base

No summary provided by upstream source.

Repository SourceNeeds Review
General

lit-component

No summary provided by upstream source.

Repository SourceNeeds Review