本文へ移動
cccskills
無料GitHub で公開

domain-mockup

Use to create, update or run the spec-animation mockup under lean/mockup — "run the mockup", "show the model on a screen", "try this scenario", "demo for the expert", "save a golden" — and to build the domain-language screens that let the expert review the model without reading JSON. The mockup executes the Lean model as-is; no logic in JS.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md7.1 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

仕様アニメーション(モックアップ)

lean/mockup/ は Lean モデルをそのまま実行エンジンにする使い捨ての検証 UI。本番 frontend ではない。 狙いは 2 つ: 開発前にモデルの帰結をエキスパートが画面で確かめる(Lean が読めない人への読める化)と、golden の採取。 このフェーズの成果物は エキスパートが JSON を読まずに主要な流れを一巡できる画面。骨格の汎用 UI で終わらせない。

鉄則: UI にロジックを 1 行も書かない

  • 合計・並び替え・フィルタ・可否判定を JS で書かない。表示に必要な加工は Lean の Runtime/Views.lean に足す。
  • state は Lean が返した JSON をそのまま持ち、そのまま送り返す。UI で変形しない。
  • シナリオはベタ書きせず {"cmd":"init"} で取る。増やすなら Runtime/Scenarios.lean。
  • サーバー(server.mjs)の役割は 4 つだけ: 静的配信・/api/lean の素通し・/api/golden(init と flow を Lean に流し、応答をそのまま保存。脇書きは version 1。トップに ok の無い応答は保存しない)・/api/meta(spec-query の結果と用語集)。判断を書かない。
  • ボタンを段階で隠さない。可否は validate が決め、拒否は domainError としてその場に出す。
  • 「誰として」の切り替えはセッションの切り替え。viewer と actor は必ず同時に動く。

土台(骨格の汎用 UI)

cradle-init スキルが敷く public/index.html は、views の口ごとの表、/api/meta の schemas(Lean の Command 構造体の型)から生成した入力欄、用語集(ubiquitous-language.md の英語候補 → 用語)による表示名を持つ。判断は持たない。 人が打つ表記が内部表現と違う値オブジェクトは、Runtime/Json.lean の手書き FromJson(文字列 1 本を受ける)と docstring の注記で欄になる(schemas の hint)。型名の特別扱いを index.html に書かない。 外部能力を持つモデル(/api/meta の external)では、環境(environments の名前か script そのもの)の選択、external の init / step、コマンドと内部入力(observationSchemas)のフォーム、障害契約の指名(def 名)、applied / refused / fault / harnessError の描き分け、手ごとの外部能力の往復(interactions)と環境の cursor の記録も骨格が持つ。harnessError は環境と入力列の不一致で、拒否(domainError)ともプロトコルエラーとも別の見た目。 これは「動く」が「読める」ではない。集約と操作の関係、誰が何をできるかは、ドメインの語彙で並べて初めて見える。

作り込み(必須)

  1. cradle status で画面の口(Views)を確かめる。口が無い・足りないなら先に lean-domain-model スキルで Views に足す(描画は Lean の結果を写すだけ。UI で補わない)。
  2. 画面の単位は Views の口ごとに 1 画面(タブ)。名前はユビキタス言語の用語。null(見られない)と [](見えたうえで空)を描き分ける。フロントエンドはこの規則を引き継がない(画面の単位は業務のまとまり — frontend スキル)。
  3. 操作の置き場は コマンドごとに 1 フォーム。対象の行の横に置く。行の ID はフォームが持ち、人に打たせない。対象を持たない操作(登録など)は口の上に置く。入力欄のラベルは用語、Option は任意入力、列挙は選択肢。
  4. 「誰として」は、シナリオに現れる名義(views に出る人・部署など)の一覧から選ぶ。viewer と actor を同時に切り替える。
  5. 置かないもの: Command に無い操作のボタン(反機能)、段階で隠すボタン、documents で却下されたもの。
  6. 拒否(domainError)はその場に Lean の語彙で出す。state は巻き戻さない。
  7. golden 保存と操作ログ(環境・外部能力の往復・障害の指名の記録を含む)は骨格のまま残す。内部入力(通知・契機)のフォームは利用者の操作と並べず、「外から届くもの」として置く。

作り込みは index.html の描画を口ごと・コマンドごとに足す形で行う(骨格の lean()・send()・renderAll() の骨は残す)。JS でこしらえるのは描画と入力欄だけ。 作り込んだら冒頭の注記「Cradle 標準の汎用モックアップ」を、この画面が何を映すかの一文に置き換える(cradle status はその注記で「汎用 UI のまま」かを見る)。 Cradle を更新したあと骨格を敷き直すのは server.mjs(cradle-init の --only lean/mockup/server.mjs --force)と CLI の Main.lean(--only lean/Main.lean --force)。index.html は作り込み後のものが正本。

起動

cd lean && lake build && node mockup/server.mjs   # → http://localhost:8787(cradle.json の ports.mockup)

すでに動いているポートを使い回す前に、それがこのプロジェクトのものか確かめる(curl -s http://localhost:8787/api/meta)。

golden の採取

操作ログを「golden として保存」→ golden/<name>-init.json / <name>-flow.json / <name>.request.json(脇書き {"version":1,"init","flow"})。中身を作るのは Lean。 外部能力を使う流れは環境を選んで external で採る。環境を尽くさなくてよい — 途中で止めた流れは最後の cursor が stopAt として脇書きに自動で入る(Cradle の回帰素材では payment-partial がその例)。直前の応答が ok でなければ保存できない。 採ったら cradle golden-check が通ることを確かめ、名前と流れの一言を PR / コミットに書く(README に表を手で保つのではなく、<name>.request.json が正)。

動作確認

  • init → 最初の口が用語の名前で映る。「誰として」を変えると見える範囲が変わる(null と [] の描き分け)。
  • documents/ddd/event-timeline.md の出来事を順に、JSON を読まずに一巡できる。断られる手も試し、拒否がその場に出る。外部能力を使う手は環境を選んでから打ち、外部の答え・通知・中断(障害契約の指名)の帰結が画面に出る。
  • resolved の HS ごとに 1 項目、その結論が画面で見えることを確かめる。
  • 画面とモデルの食い違いを感じたら、UI にロジックが漏れているか views が仕様とずれているかのどちらか。index.html で辻褄合わせをしない。

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Use when adding or changing REST endpoints or the OpenAPI contract — deriving endpoints from the Lean commands and views, writing documents/codebase/openapi.yaml first, then regenerating the backend controller interfaces and the frontend client.

日本語の概要は準備中です。原文の説明を表示しています。

asuka1975/cradle42026年10月1日 更新

Use after a backend build succeeds or whenever authentication, authorization, actor/identity handling, external service calls (IdP, JWKS, DB, clock), logging, observability, configuration or error contracts are in play — delegates to the backend-design-reviewer agent for a design-quality review of the current branch.

日本語の概要は準備中です。原文の説明を表示しています。

asuka1975/cradle42026年10月1日 更新

Use when it is time to make the backend follow the Lean model — regenerate Kotlin from Lean, implement the generated interfaces (UseCase, QueryService, Repository, Entity), wire every generated contract test, make the build green, then run the design and SQL reviews. Backend comes after the human confirmed the screens.

日本語の概要は準備中です。原文の説明を表示しています。

asuka1975/cradle42026年10月1日 更新

cradle

無料

Use when you need the current position in the Lean spec-driven pipeline, or any deterministic check of a Cradle project — status, golden regression, Lean layer walls, regeneration impact, unslop lint, ddd cleanup. Runs the scripts under scripts/ and reports their output verbatim.

日本語の概要は準備中です。原文の説明を表示しています。

asuka1975/cradle42026年10月1日 更新

Use to start a new product on Cradle or to add the Cradle skeleton to an existing repository — writes cradle.json, the project-facts instruction (.apm/instructions/project.instructions.md), documents/{ddd,ai-notes,infra-design,codebase} templates, CI, and a compiling Lean executable-spec scaffold with a minimal example domain, mockup and CLI.

日本語の概要は準備中です。原文の説明を表示しています。

asuka1975/cradle42026年10月1日 更新

Use when the product owner asks where the project stands, what to do next, or which phase of the Lean spec-driven pipeline is current — runs cradle status and proposes exactly one next step.

日本語の概要は準備中です。原文の説明を表示しています。

asuka1975/cradle42026年10月1日 更新

asuka1975 のスキルをすべて見る

このスキルの問題を報告する