跳到正文
cccskills
免费在 GitHub 公开

type-driven

Use when modeling a domain, encoding a state machine, hardening APIs, making invalid states unrepresentable, or parsing instead of validating. Not for TypeScript: use typescript-best-practices.

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(5)

  • SKILL.md3.9 KB
  • agents/openai.yaml207 B
  • references/examples.md3.0 KB
  • references/formal-tools.md1.0 KB
  • references/patterns.md2.5 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Type-driven development

Contract

FieldBound contract
TriggerThe work is modeling a domain, encoding a state machine, hardening an API boundary, making invalid states unrepresentable, or parsing instead of validating.
AuthorityReversible local: writes only domain types, public signatures, and affected callers and tests; rollback is version control or undo. No remote mutation.
Side effectRewrites domain types, public signatures, and affected callers and tests to the new algebraic model.
DoneInvalid states are unconstructible, matches are exhaustive, boundaries parse, and no scattered post-hoc validation remains.

Inputs

Required: the domain problem, data model, or API surface to encode. Optional: existing types or callers to refactor.

Refusals

  • Will not add runtime guards to fix a type-design failure: fix the type design.
  • Will not add a wildcard arm to silence a non-exhaustive match: add the missing variant.
  • Will not proceed with type holes or incomplete bodies.
  • Will not use this approach when the language lacks ADTs, sealed hierarchies, or equivalent sum-type support: skip and report.

Procedure

  1. Plan. State the domain in one paragraph. List all valid states, all invalid states, and every operation with its preconditions and postconditions. If any operation is partial, mark it as such. Done when: the domain is stated with valid states, invalid states, and operations listed.
  2. Design types first. For each invalid state, write a type that the compiler prevents. Use ADTs, phantom types, branded types, newtype wrappers, sealed hierarchies, or opaque types, whichever the language supports. Do not write implementation bodies until all types compile. Done when: all types compile and every invalid state is unrepresentable.
  3. Parse at boundaries. For every untrusted input (external data, deserialization, FFI, user input), write a parse constructor that returns the new type. Do not return bool and defer validity to callers. Done when: every untrusted input boundary has a parse function returning the new type.
  4. Exhaustive matching. Encode state machine transitions as exhaustive match/switch/visit on the sum type. Compiler warnings on incomplete arms are failures. Done when: every state-machine transition is an exhaustive match with no wildcard arms.
  5. Verify. Run the language's strict type checker and exhaustiveness check. Fix the type design, not the implementation, when the checker reports an illegal state is representable. Done when: the type checker and exhaustiveness check pass.
  6. Build. Run the full target build. Implement the bodies guided by the types. Done when: the target build passes.

Failure and recovery

Failure classBehavior
Unsupported languageIf the language lacks ADTs, sealed hierarchies, or equivalent sum-type support, skip this approach and report.
Type checker failureBlock. Fix the type design until the invalid state is unrepresentable. Do not add runtime guards.
Non-exhaustive matchCompile-time failure. Add the missing variant to the type, not a wildcard arm.
Invalid state remains representableBlock. The type design is insufficient; iterate until the compiler enforces the invariant.
Type holes remainBlock. Complete all incomplete bodies or remove the holes before proceeding.
Build failsBlock. Resolve implementation errors until the target build passes.

Output

A domain type system where every algebraic constructor is present, every boundary has a parse function returning the new type, every state-machine variant is matched exhaustively, and no runtime validation scattered outside the parse layer remains.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Use when explaining System V AMD64, ARM AAPCS, RISC-V psABI, stack frames, variadic calls, or FFI register rules. Not for the Rust FFI binding layer: use rust-ffi.

中文简介正在准备中。当前显示原文说明。

OutlineDriven/odin-claude-plugin372026年9月29日 更新

Use when configuring ADC sampling time, DMA-driven ADC, calibration, or DAC channel setup on bare-metal MCUs. Not for the DMA stream itself: use dma-baremetal.

中文简介正在准备中。当前显示原文说明。

OutlineDriven/odin-claude-plugin372026年9月29日 更新

af-xdp

免费

Use when creating AF_XDP sockets, configuring UMEM and XSK rings, writing an XDP redirect program, or choosing copy versus zero-copy mode. Not for full kernel bypass: use dpdk.

中文简介正在准备中。当前显示原文说明。

OutlineDriven/odin-claude-plugin372026年9月29日 更新

Use when a completed session needs an agent-environment retrospective. Not for an engineering retrospective from telemetry: use engineering-retrospective.

中文简介正在准备中。当前显示原文说明。

OutlineDriven/odin-claude-plugin372026年9月29日 更新

Use when a redacted, trimmed agent transcript must be appended to a GitHub PR or issue body, with human approval and preview. Not for automated or model-initiated insertion.

中文简介正在准备中。当前显示原文说明。

OutlineDriven/odin-claude-plugin372026年9月29日 更新

agents-md

免费

Use when a repo needs agent setup, AGENTS.md added or made lean, CLAUDE.md audited, or agent instructions scored or pruned. Not for remote, credential, publish, deploy, or irreversible changes.

中文简介正在准备中。当前显示原文说明。

OutlineDriven/odin-claude-plugin372026年9月29日 更新

查看 OutlineDriven 的全部技能

报告此技能的问题