AGENT SKILL
pstack-principle-type-system-discipline
Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, exhaust variants, derive from authoritative schemas.
适用职业开发工程师
使用场景Skill与智能体开发
- License 许可
- MIT
- 所属仓库
- dmae97/omk
- 最近更新
- 2026-11-12
- Stars
- ★ 152
- Forks
- 29
01 前言 Front Matter
- name
- pstack-principle-type-system-discipline
- description
- Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, exhaust variants, derive from authoritative schemas.
- disable-model-invocation
- true
03 SKILL.md 正文
Type System Discipline
Make the compiler reject impossible states, mismatched primitives, and unhandled variants. Prefer defining errors and special cases out of existence over proliferating handlers. For TypeScript syntax, see the typescript-best-practices skill.
- Brand semantic primitives.
UserIdandOrderIdare strings underneath but should not be interchangeable. Give each its own type, such as a branded intersection in TypeScript or a newtype elsewhere. Validate once at creation, trust the type downstream. If two arguments share a primitive type but mean different things, brand them. - External data is untyped until parsed. RPC payloads, JSON, IPC messages, CLI args, config files, environment variables, database rows. Have a parse function at every boundary that turns unstructured input into the typed model. The boundary-discipline principle skill says where to put validation.
- Derive types from authoritative schemas. When a protocol buffer, OpenAPI spec, GraphQL schema, database migration, design-token file, or another file owns a shape, derive from it instead of hand-rolling a parallel type. See the encode-lessons-in-structure principle skill.
04 同仓库更多 Skills
valid-skill
A valid skill for testing purposes.
★ 152
unknown-field
A skill with an unknown frontmatter field.
★ 152
nested-child
Nested skill should be ignored.
★ 152
root-skill-preferred
Root skill should win.
★ 152
no-frontmatter
暂无简介
★ 152
child-skill
A nested skill in a subdirectory.
★ 152