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

use-is-kit

Create, compose, migrate, and review TypeScript runtime type guards with is-kit. Use when adding reusable guards; replacing typeof, null checks, or handwritten type predicates; narrowing unknown values; validating JSON or API responses; building collection or object schemas with struct or typedStruct; or reviewing existing is-kit usage. Do not use for one-off environment checks or validation that requires data transformation or rich error reporting.

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

설치 방법 보기

포함된 파일(5)

  • SKILL.md4.2 KB
  • agents/openai.yaml204 B
  • references/guard-selection.md4.9 KB
  • references/migration-checklist.md3.5 KB
  • references/object-validation.md4.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Use is-kit

Build runtime checks that preserve TypeScript control-flow narrowing without inventing project architecture or duplicating guards that already exist.

1. Inspect before editing

  1. Read the repository instructions and relevant package scripts.
  2. Confirm the installed is-kit version from the package manifest and lockfile.
  3. Inspect the installed declarations, package exports, or monorepo source before relying on an API name. Prefer the installed version over online examples.
  4. Search for an equivalent local guard, wrapper, barrel export, schema, or established import boundary.
  5. Reuse an existing guard when it already expresses the required semantics.

Do not add a wrapper layer merely because this skill mentions one. If the project already has an is-kit boundary, respect it; otherwise import from is-kit directly.

2. Choose the smallest correct guard

Read guard-selection.md when choosing between built-ins, logical combinators, custom predicates, equality guards, and collection combinators.

For object or API response validation, always read object-validation.md before choosing struct, typedStruct, optionalKey, or safeParse.

For replacement or cleanup work, read migration-checklist.md before changing manual checks.

Prefer composition over a handwritten type-predicate signature. Keep guards total, deterministic, and side-effect free.

3. Place the guard by responsibility

  • Put broadly reusable, domain-free guards in the project's existing shared guard location, if one exists.
  • Keep a schema beside the boundary that consumes the validated value when the schema exists for one API, file, parser, or integration.
  • Keep business decisions and domain state predicates in their owning feature or domain module.
  • Add or update barrel exports only when the project already uses them.
  • Follow the repository's naming, documentation, and test-collocation rules.

Avoid creating a global guard from a one-off payload projection. Avoid moving domain knowledge into a generic guard module.

4. Implement without weakening the boundary

  • Accept untrusted input as unknown.
  • Narrow before reading or returning typed data.
  • Remove an as assertion when the new guard makes it unnecessary.
  • Store an indexed property in a local constant before narrowing when TypeScript does not retain the property refinement.
  • Use safeParse when the success branch consumes the validated value; call a guard directly when only a boolean decision is needed.
  • Default to forward-compatible object validation. Reject extra keys only when the contract explicitly requires an exact object.

5. Verify behavior and types

Add focused tests using the project's existing test tools:

  • at least one accepted value;
  • at least one rejected value;
  • at least one value of the wrong runtime type;
  • object cases for missing, optional, and extra keys when relevant;
  • type-level assertions when the repository already tests inference or narrowing.

Run the narrowest relevant test, typecheck, lint, and formatting commands. Inspect the final diff for unrelated formatting or generated-file changes.

Boundaries

  • Do not replace runtime or platform detection such as typeof window === 'undefined' merely for stylistic consistency.
  • Do not replace a clear one-off primitive check unless reuse, composition, or narrowing materially improves.
  • Do not upgrade is-kit unless the task requires an API unavailable in the installed version or the user requests the upgrade.
  • Recommend a schema validator instead when the requirement depends on data transformation, coercion, detailed issue paths, or rich validation errors.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

learn

무료

Extract reusable patterns from non-trivial work in the is-kit repository and store them as project knowledge. Use after meaningful API design, type-system work, debugging, or compatibility discoveries.

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

nyaomaru/is-kit1142026년 10월 19일 업데이트

Run Prettier for the is-kit repository. Use when asked to format or check formatting in this project. Always consult AGENTS.md in the repo root before executing commands.

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

nyaomaru/is-kit1142026년 10월 19일 업데이트

nyaomaru의 스킬 모두 보기

이 스킬의 문제 신고