跳到正文
cccskills
免费在 GitHub 公开

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.

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

查看安装方法

包含的文件(14)

  • SKILL.md4.4 KB
  • LEARNED_INDEX.md2.8 KB
  • learned/balance-runtime-cost-with-compositional-design.md2.2 KB
  • learned/deprecate-public-api-before-major-removal.md2.7 KB
  • learned/keep-typed-schema-key-coverage-explicit.md3.7 KB
  • learned/model-transformations-as-decoders.md3.1 KB
  • learned/order-precise-overloads-before-generic-fallbacks.md2.7 KB
  • learned/prefer-non-throwing-intrinsic-brand-checks.md2.3 KB
  • learned/preserve-enumerable-key-membership-in-exact-structs.md3.8 KB
  • learned/preserve-explicit-generic-call-compatibility.md2.6 KB
  • learned/preserve-type-guard-semantics-across-host-values.md1.9 KB
  • learned/require-singleton-keys-for-single-property-refinements.md3.9 KB
  • learned/separate-property-refinement-absence-contracts.md3.9 KB
  • learned/test-packed-artifacts-from-a-consumer-project.md3.3 KB

SKILL.md(原文)

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

/learn - Capture Reusable is-kit Patterns

Analyze the current session and capture reusable knowledge for this TypeScript type-guard library.

Auto-Activation Criteria

Consider auto-activating this skill when:

  1. A non-trivial bug was fixed in runtime guard behavior or type inference.
  2. A public API design decision was made and validated with tests.
  3. A tricky TypeScript modeling pattern was discovered.
  4. A runtime/type parity issue was diagnosed and resolved.
  5. The session produced reusable guidance about tests, docs, or release safety for this library.

Do not activate for:

  • trivial typo fixes
  • one-line doc wording changes
  • obvious refactors with no reusable lesson
  • patterns already documented in .codex/skills/learn/learned/

Manual Trigger

Run /learn after finishing a meaningful implementation, refactor, or debugging session in is-kit.

What To Extract

1. Public API Design Patterns

  • What API was added or changed?
  • Why was that shape chosen over alternatives?
  • What backward-compatibility constraint mattered?
  • How should similar future APIs be designed?

Project-relevant examples:

  • Distinguishing key-level optionality from value-level undefined.
  • Choosing a specialized combinator vs. a more generic abstraction.
  • Preserving existing semantics in a minor release while introducing a new helper.

2. Type Modeling Patterns

  • How were inference, narrowing, or overloads preserved?
  • What TypeScript limitation mattered?
  • What exact type shape or helper solved it?

Project-relevant examples:

  • Modeling struct schemas with required vs. optional keys.
  • Normalizing intersection-heavy inferred types for tsd.
  • Preserving literal narrowing without assertion casts.

3. Runtime Validation Patterns

  • What runtime behavior needed to match the type-level contract?
  • What edge cases mattered?
  • What implementation detail should future changes preserve?

Project-relevant examples:

  • Own-key checks vs. inherited property checks in struct.
  • Exact-mode semantics when optional keys are present or absent.
  • Composing schema markers with existing value guards.

4. Verification Patterns

  • What test mix caught the issue?
  • What commands should be run after similar changes?
  • What docs needed updating to keep the repo consistent?

Project-relevant examples:

  • Adding both Jest and tsd coverage for public API changes.
  • Running pnpm build, pnpm lint, pnpm test, and pnpm test:types.
  • Updating README and docs site examples when semantics change.

Output Format

Create one file per pattern at:

.codex/skills/learn/learned/[pattern-name].md

Template:

# [Descriptive Pattern Name]

**Captured:** YYYY-MM-DD
**Context:** [When this pattern applies]
**Tags:** typescript, type-guards, combinators, struct, tsd, api-design, runtime-validation, etc.

## Problem

[Specific recurring problem this pattern solves]

## Solution

[Reusable approach, key decisions, constraints, and tradeoffs]

## Example

```ts
// Minimal real example from this codebase
```

## When To Use

[Trigger conditions for applying this pattern]

## Related Files

- `src/core/combinators/struct.ts`
- `src/types/schema.ts`
- `tests/core/combinators/struct.test.ts`
- `tests-d/core/combinators/struct.test-d.ts`

Process

  1. Review the session for candidate learnings.
  2. Select the highest-value reusable pattern(s).
  3. Draft the pattern file.
  4. Ask for user confirmation before saving.
  5. Save to .codex/skills/learn/learned/.
  6. Update .codex/skills/learn/LEARNED_INDEX.md with a one-line entry.

Index format:

- **[pattern-name](learned/pattern-name.md)** - One-line summary.

Common Pattern Categories For This Repository

  • Guard/combinator API design
  • Runtime/type parity in public APIs
  • struct schema semantics and exact-mode behavior
  • TypeScript inference and overload design
  • tsd-driven regression prevention
  • Object-shape validation edge cases
  • Documentation alignment after API changes

Notes

  • Capture only reusable, non-trivial lessons.
  • Prefer patterns that explain both runtime behavior and type inference.
  • Include the commands and tests that validated the pattern when relevant.
  • Keep entries concrete, searchable, and library-focused.

评价

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

评论

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

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

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

0 / 1000 字

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

同一仓库的技能

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-kit1212026年10月21日 更新

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.

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

nyaomaru/is-kit1212026年10月21日 更新

查看 nyaomaru 的全部技能

报告此技能的问题