One-click install
npx skills add https://github.com/commontoolsinc/labs --skill pattern-dev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pattern-dev
Source: https://github.com/commontoolsinc/labs/tree/main/.claude/skills/pattern-dev
Command: npx skills add https://github.com/commontoolsinc/labs --skill pattern-dev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Developing reactive data transformation patterns can be complex, involving TypeScript, UI components, and debugging. This skill streamlines the entire development lifecycle, from creation to deployment and error resolution, ensuring patterns are built efficiently and correctly.

Core Features & Use Cases

  • Guided Pattern Creation: Step-by-step instructions for building new CommonTools patterns from scratch, including interactive UIs and handlers.
  • Efficient Debugging: Comprehensive guidance for diagnosing and fixing common type and runtime errors in patterns, with quick error references.
  • Multi-File Organization: Best practices for structuring complex patterns across multiple files, ensuring maintainability and reusability.
  • Use Case: A developer needs to create a new reactive pattern for a task management system. This skill guides them through defining schemas, adding interactive UI elements, implementing handlers for structural changes, and debugging any issues, saving significant development time.

Quick Start

Begin with a minimal viable pattern:

/// <cts-enable /> import { Default, NAME, recipe, UI } from "commontools";

interface Item { title: string; done: Default<boolean, false>; }

interface Input { items: Default<Item[], []>; }

export default recipe<Input, Input>("My Pattern", ({ items }) => { return { [NAME]: "My Pattern", [UI]: ( <div> {items.map((item) => ( <div>{item.title}</div> ))} </div> ), items, }; });

Frequently Asked Questions about pattern-dev

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a reactive pattern in CommonTools from scratch?

Creating a reactive pattern involves defining TypeScript interfaces for your data schema, wrapping them with Default types, and using the recipe function to build handlers and UI components. Start with a minimal pattern template, define your data structure, implement mutation handlers for state changes, and add interactive UI elements that respond to data updates.

What's the best way to debug TypeScript errors in CommonTools patterns?

Debug patterns by checking type definitions against your schema interfaces, validating handler logic for structural mutations, and using the ct CLI tooling for inspection and diagnostics. Common issues stem from mismatched Default types, incorrect handler signatures, or reactive derivation cycles—reference the error diagnostics guide for quick resolution.

How do I organize complex patterns across multiple files?

Structure patterns by separating schema definitions, mutation handlers, UI components, and reactive derivations into distinct modules, then compose them in your main recipe export. This layered approach ensures maintainability, enables reuse, and simplifies debugging of individual pattern layers.

Can I deploy pattern changes without rebuilding the entire application?

Yes, use the ct CLI tooling to deploy patches directly, linking charm references and updating handlers without full recompilation. This streamlines iteration during development and testing cycles.

What TypeScript knowledge do I need to build CommonTools patterns?

You need intermediate TypeScript proficiency—understanding interfaces, generic types, and functional composition. The pattern-dev skill guides you through template syntax and reactive patterns, so existing TypeScript experience translates directly to pattern development.

How do reactive derivations work in pattern data flows?

Reactive derivations automatically compute and update derived values when source data changes, enabling efficient UI re-renders and handler chains. Define derivations alongside mutation handlers to maintain consistency across your pattern's layered data model.