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

api-contract

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.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md2.6 KB
  • scripts/contract-check.mjs7.4 KB

SKILL.md(原文)

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

API 契約(Lean → openapi.yaml → 生成)

正本は documents/codebase/openapi.yaml。実装より先に契約を直し、両側を生成し直す。

手順

  1. cradle spec-query meta でコマンドの構成子・内部入力(observations。提供元の通知・契機)・外部能力の Port・画面の口を取る。spec-query print でペイロードと View の形を取る。
  2. 契約を書く: コマンド 1 構成子 = 1 エンドポイント(POST /api/…、成功は 204、x-cradle-kind: command)。観測(内部入力)は提供元から受ける口が要るときだけエンドポイントを持つ(x-cradle-kind: observation。worker だけが受けるものは作らない)。GET 以外の操作はすべて x-cradle-kind と x-cradle-model(<Root>.Runtime.Command.<構成子> か <Root>.Runtime.Observation.<構成子>)を宣言する。画面 1 つ = 1 GET。名義(actor)はリクエストに現れず、観測の受信口にも名義は無い。「今日」も受け取らない。観測は利用者の入力欄に出さない。
  3. 各操作の 422 に、その UseCase の validate / execute が返しうる DomainError を列挙する(Domain/Error.lean と UseCase の契約定理から)。403(立場)と 404(宛先なし)は分ける。
  4. 文字列には長さ上限、識別子には形式。入力検証は契約から生成させる。
  5. View の値は View 自身の語彙(日付は ISO 文字列)。契約の語彙 = 画面の語彙。
  6. 生成: backend は ./gradlew generateApi(Controller interface + Request/Response)、frontend は pnpm gen:api。写し漏れはコンパイルエラーで出る。
  7. このスキルの scripts/contract-check.mjs で確かめる: GET 以外の操作がすべて x-cradle-kind と x-cradle-model を宣言している(宣言の無い操作は除外せず NG)、x-cradle-model がモデルにある構成子を指す、コマンドと command の操作が 1 対 1、観測の操作は高々 1 つ、画面の口に GET がある(cradle.json の api.outletsWithoutEndpoint に挙げた口を除く)。

書かないもの

HS / MQ / UX の ID・経緯・存在しない操作の一覧・申し送り。契約書は「いまどうであるか」だけ。

レビュー

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

同じリポジトリのスキル

概要と使いどころ

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日 更新

ddd

無料

Use to run or continue domain exploration with the product owner as domain expert — event storming interviews, hotspots (HS), ubiquitous language, UX review of the domain, checking or resolving open MQ/UX items, or a status summary of documents/ddd. Also use when the user starts explaining their business, purpose or workflow. Never edit documents/ddd directly; go through this skill.

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

asuka1975/cradle42026年10月1日 更新

asuka1975 のスキルをすべて見る

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