一键导入
pattern-implement
Build Common Fabric patterns and sub-patterns
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build Common Fabric patterns and sub-patterns
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Review a changeset for the Common Fabric repo — the local branch diff vs main, or a GitHub PR. Flags correctness and regression bugs loudly, checks that runtime-semantics changes stay coherent across docs/comments/examples, catches duplicated core machinery (hashing, serialization, cloning, identity) and code fighting the transformer/reactive model, and scrutinizes whether the tests guard the right principles. Report-first; offers to post a self-signed PR review. Use when asked to review code, review a PR, review the current branch or diff, or self-review before pushing. Invoke as /cf-review or /cf-review <PR#>.
Agent-specific interaction patterns for working with FUSE-mounted spaces. Use when deploying patterns via FUSE, working with Activity Logs, Annotations, or coordinating agent workflows that read/write pieces through the filesystem. Triggers include "deploy a pattern", "log an event", "create annotation", "agent workflow", or managing piece lifecycle via FUSE.
Critic agent that reviews pattern code for violations of documented rules, gotchas, and anti-patterns. Produces categorized checklist output with [PASS]/[FAIL]/[WARN] for each rule.
Guide for developing Common Fabric patterns (TypeScript modules that define reactive data transformations with UI). Use this skill when creating patterns, modifying existing patterns, or working with the pattern framework. Triggers include requests like "build a pattern", "fix this pattern error", "deploy this piece", or questions about handlers and reactive patterns.
Guide for using the cf (Common Fabric) CLI to interact with pieces, patterns, and the Common Fabric. Use this skill when deploying patterns, managing pieces, linking data between pieces, or debugging pattern execution. Triggers include requests to "deploy this pattern", "call a handler", "link these pieces", "get data from piece", or "test this pattern locally".
Convert Common Fabric pattern unit tests (`*.test.tsx` driven by actions and computed assertions) into browser integration tests (`packages/patterns/integration/*.test.ts`) that exercise the rendered UI and can be recorded with `deno task demo`. Use when asked to promote, mirror, spot-check, browser-test, or make a video demo from an existing pattern test, including multi-user pattern tests.
| name | pattern-implement |
| description | Build Common Fabric patterns and sub-patterns |
| user-invocable | false |
Use the cf skill, or read skills/cf/SKILL.md, for CLI documentation when
running commands.
Match the implementation mode to the task.
For Pattern Factory Build, implement the top-level pattern deliverable described by the brief, spec, UX design, and UI design. Use sub-patterns only when they make the implementation clearer.
For an isolated sub-pattern task, write one sub-pattern with minimal UI first so data flow can be verified before polish.
Always use pattern<Input, Output>() - expose actions as Stream<T> for
testability.
docs/common/ai/pattern-development-guide.md (especially the SES authoring
limits and escape-hatch guidance), docs/common/concepts/reactivity.md,
docs/common/patterns/new-cells.md, and — in a Pattern Factory Build
workspace — docs/common/ai/pattern-factory-build-guide.mddocs/common/patterns/ - generalizable pattern idiomsdocs/common/concepts/action.md - action() for local statedocs/common/concepts/handler.md - handler() for reusable logicdocs/common/concepts/identity.md - equals() for object comparisondocs/common/patterns/multi-user-patterns.md - Presenting Identity (viewer
via #profile, every participant rendered with cf-profile-badge bound to
their stored profile cell — cf-avatar + snapshot only as an offline
fallback, roster built by join storing the live profile cell) when the pattern
has multiple people or a current-user conceptFor Pattern Factory Build, do not start implementation until you have read the Build guide plus the two foundational reactivity/local-cell references above.
action() - Closes over local state in pattern body:
const inputValue = new Writable("");
const submit = action(() => {
items.push({ text: inputValue.get() });
inputValue.set("");
});
Use new Writable() only for pattern-owned local cells initialized from static
values. Do not pass an input prop, mapped field, computed value, or other
reactive value into new Writable(). If the pattern receives writable state,
use that input cell directly; if a draft needs to copy from input state, copy in
an action or another valid reactive/event context.
For Pattern Factory Build, this rule applies to the top-level pattern input
object too. Do not initialize local state with new Writable(input.name || ""),
new Writable(input.items || []), new Cell(input.field), or helper calls
around input.field. First decide whether each field is primary pattern state,
static local UI state, or draft/editing state:
Input/Output contract with
Default<> and Writable<> as needed, then use the reactive input directly.new Writable(...) from static literals
only.action() or another valid event/reactive context.Transient UI state (active tab, selected item, filter text, open modal): apply the PerSession new-tab test from the pattern-dev skill.
When a pattern needs explicit time or randomness, call the JavaScript built-ins
directly: Date.now() (or new Date()) for the clock and Math.random() for
entropy. These are gated inside a pattern sandbox — allowed only inside a
handler, where the clock is coarsened to one-second resolution — and throw a
TimeCapabilityError in a computed()/lift() or at pattern-body level. To
read a live clock reactively in a computed(), use the #now wish instead. If
a control is already bound to a cell, usually via $value or $checked, let
that binding own the control value. Use oncf-change / oncf-input only for
dependent state or other side effects.
Do not invoke streams or writes while assigning JSX event props. For example,
onClick={selectItem.send(index)} runs during render; use
onClick={() => selectItem.send(index)} or a bound handler() instead. This is
especially important inside .map() bodies because render-time writes can make
raw:map non-idempotent.
handler() - Reused with different bindings:
const deleteItem = handler<void, { items: Writable<Item[]>; index: number }>(
(_, { items, index }) => items.set(items.get().toSpliced(index, 1)),
);
// In JSX: onClick={deleteItem({ items, index })}
Rendering sub-patterns - Function calls and JSX both work (verified: both
forms pass cf check with a typed Output interface):
// ✅ Function call form
return <>{items.map((item) => ItemPattern({ item, allItems: items }))}</>;
// ✅ JSX form
return <>{items.map((item) => <ItemPattern item={item} />)}</>;
The sub-pattern's Output type must include [UI]: VNode — see
docs/common/patterns/composition.md.
deno task cf check pattern.tsx --no-run