본문으로 건너뛰기
cccskills
무료GitHub에 공개

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, refuse to lie to the compiler, exhaust variants, derive from authoritative schemas.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.6 KB

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.

  • Make illegal states unrepresentable. Model variants as sum types (discriminated unions, enums with payloads, sealed classes), not as a bag of optional fields where contradictory combinations compile. { completed: boolean; completedAt?: Date } admits completed: true with no date. Derive the boolean from completedAt, or model { kind: 'open' } | { kind: 'done'; at: Date }. If you can write a comment explaining when a combination of fields is valid, split it into a sum type.
  • Types are constructions, not restrictions. Build the type up from the values you want instead of carving them out of a looser type with checks. A non-empty list is a head plus a rest. A valid time range is a start plus a duration. Choose the shape that cannot build the illegal value and expose the interface callers need on top.
  • Brand semantic primitives. UserId and OrderId are 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.
  • Don't lie to the type system. Casts, unsafe coercions, and assertion functions that bypass the compiler are latent runtime crashes. If the compiler can't prove a fact, prove it (validate, narrow, refine the model) or accept that the cast is a hazard. Trace each any, as, or assertNotNull to the boundary and validate there.
  • Exhaustive matching is the compiler's job. A match on a sum type must fail compilation when a new variant is added without handling, so the compiler tells the next agent where to add a case. Use your language's idiom: a never-typed binding in TypeScript, an unannotated match in Rust, -Wincomplete-patterns in Haskell, sealed-class match exhaustiveness in Kotlin.
  • 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.
  • Strengthen a type only where partiality appears. A runtime assertion, null check, or "this should never happen" throw marks the place a type is too weak. Push that check up into the type. Then stop. The type system's job is to track the cases each use site must handle, not to describe the data as precisely as possible. Prefer total functions. sum of an empty list is 0, so it takes the plain list. head of an empty list has no answer, so it demands the non-empty one. If nothing would otherwise panic, keep the plain type.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

architect

무료

Sketch types, signatures, and module structure before code, then stay in the loop while implementation fills in. Use for /architect, 'architect this', 'design this', or non-trivial work where jumping to code would lock in the wrong shape.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

backnotprop/pstack2.3천2026년 10월 15일 업데이트

arena

무료

Spawn N parallel candidates at the same task, pick a base, graft the strongest parts of the losers into it. Use for /arena, 'arena this', 'throw it in the arena', or when one attempt at a non-trivial artifact would lock in the wrong shape.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

backnotprop/pstack2.3천2026년 10월 15일 업데이트

Use for "automate me", "create/update/refresh my -mode skill", "turn/capture my preferences or working style into a skill", or wanting agents to follow how the user works. Drafts or revises a personal -mode skill via create-skill + unslop, optionally pulling fresh evidence from recent transcripts.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

backnotprop/pstack2.3천2026년 10월 15일 업데이트

Vet a perf measurement (limiter, tuning, limits, errors, repeatability, relevance, and whether the work happened) before you report or act on it. Use when you run a benchmark or report a speedup or regression you measured.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

backnotprop/pstack2.3천2026년 10월 15일 업데이트

Find what a change could break somewhere else before it ships, beyond the diff, and prove the one fact it's safe because of by running real code instead of writing it up. Use for 'blast radius of X', 'what could this break', or reviewing a small diff you don't trust.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

backnotprop/pstack2.3천2026년 10월 15일 업데이트

bro

무료

Restate the last message in plain human language, with no jargon.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

backnotprop/pstack2.3천2026년 10월 15일 업데이트

backnotprop의 스킬 모두 보기

이 스킬의 문제 신고