← 返回 Skills 市场
Stop Using
88
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install kirk-typescript
功能描述
Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices.
使用说明 (SKILL.md)
When to Use
User needs TypeScript expertise — from basic typing to advanced generics. Agent handles type narrowing, inference, discriminated unions, and strict mode patterns.
Quick Reference
| Topic | File |
|---|---|
| Generic patterns | generics.md |
| Utility types | utility-types.md |
| Declaration files | declarations.md |
| Migration from JS | migration.md |
Stop Using any
unknownforces you to narrow before use —anysilently breaks type safety- API responses: type them or use
unknown, neverany - When you don't know the type, that's
unknown, notany
Narrowing Failures
filter(Boolean)doesn't narrow — use.filter((x): x is T => Boolean(x))Object.keys(obj)returnsstring[], notkeyof typeof obj— intentional, objects can have extra keysArray.isArray()narrows toany[]— may need assertion for element typeinoperator narrows but only if property is in exactly one branch of union
Literal Type Traps
let x = "hello"isstring— useconstoras constfor literal type- Object properties widen:
{ status: "ok" }hasstatus: string— useas constor type annotation - Function return types widen — annotate explicitly for literal returns
Inference Limits
- Callbacks lose inference in some array methods — annotate parameter when TS guesses wrong
- Generic functions need usage to infer —
fn\x3CT>()can't infer, pass a value or annotate - Nested generics often fail — break into steps with explicit types
Discriminated Unions
- Add a literal
typeorkindfield to each variant — enables exhaustive switch - Exhaustive check:
default: const _never: never = x— compile error if case missed - Don't mix discriminated with optional properties — breaks narrowing
satisfies vs Type Annotation
const x: Type = valwidens to Type — loses literal infoconst x = val satisfies Typekeeps literal, checks compatibility — prefer for config objects
Strict Null Handling
- Optional chaining
?.returnsundefined, notnull— matters for APIs expectingnull ??only catchesnull/undefined—||catches all falsy including0and""- Non-null
!should be last resort — prefer narrowing or early return
Module Boundaries
import typefor type-only imports — stripped at runtime, avoids bundler issues- Re-exporting types:
export type { X }— prevents accidental runtime dependency .d.tsaugmentation: usedeclare modulewith exact module path
安全使用建议
This skill is a bundle of TypeScript guidance docs and appears internally consistent and low risk: it does not request credentials or install code. Before installing, note that the skill's source/homepage is not provided — if provenance matters to you, confirm the author or review the text for correctness and style you trust. Also remember an autonomous agent may call the skill when relevant (this is normal); if you want to restrict that, disable or control the skill in your agent settings.
功能分析
Type: OpenClaw Skill
Name: kirk-typescript
Version: 1.0.0
The skill bundle is a collection of educational documentation and best practices for TypeScript development. It covers topics such as type narrowing, generics, declaration files, and migration strategies across files like SKILL.md, generics.md, and migration.md. There are no executable code snippets, network requests, or instructions that attempt to subvert the agent's behavior or exfiltrate data.
能力评估
Purpose & Capability
Name and description describe TypeScript guidance and the skill only includes markdown docs about typing, generics, utility types, and migration; there are no unrelated requirements (no binaries, env vars, or config paths).
Instruction Scope
SKILL.md and the included documents provide coding guidance and reference local files only; there are no directives to read system files, environment variables, or to transmit data to external endpoints.
Install Mechanism
No install specification and no code files — it is instruction-only, which is the lowest-risk install model (nothing is downloaded or written to disk by an installer).
Credentials
The skill declares no required environment variables, credentials, or config paths; nothing in the docs asks for secrets or external API keys.
Persistence & Privilege
always is false (default) and model invocation is allowed (normal). The skill does not request persistent or elevated privileges or indicate it will modify other skills or system settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install kirk-typescript - 安装完成后,直接呼叫该 Skill 的名称或使用
/kirk-typescript触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of the TypeScript skill.
- Provides concise explanations of type-safe TypeScript patterns and common pitfalls.
- Includes quick reference table for generics, utility types, declarations, and JS migration.
- Emphasizes proper use of unknown vs. any, and cautions about narrowing failures.
- Documents best practices for discriminated unions, type inference, and literal types.
- Adds strict guidance for null handling, module boundaries, and type-only imports.
元数据
常见问题
typescript 是什么?
Write type-safe TypeScript with proper narrowing, inference patterns, and strict mode best practices. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 88 次。
如何安装 typescript?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install kirk-typescript」即可一键安装,无需额外配置。
typescript 是免费的吗?
是的,typescript 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
typescript 支持哪些平台?
typescript 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 typescript?
由 KirkRaman(@kirkraman)开发并维护,当前版本 v1.0.0。
推荐 Skills