lang-typescript
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<skill_doc>
<trigger_keywords>
<skill_doc>
<trigger_keywords>
Trigger Keywords
触发关键词
Activate this skill when the user mentions any of:
File Extensions: , , ,
.ts.tsx.mts.ctsTypeScript Core: TypeScript, tsc, tsconfig, type inference, generics, satisfies, decorators, type guard, discriminated union, conditional types, mapped types, template literal types, infer keyword
SolidJS: SolidJS, Solid.js, createSignal, createStore, createMemo, createEffect, createResource, , , , , , onMount, onCleanup, fine-grained reactivity
<For><Show><Switch><Match><Index>TanStack: TanStack Start, TanStack Router, createFileRoute, createServerFn, useLoaderData, file-based routing, server functions, Vinxi
Validation: Valibot, v.object, v.string, v.pipe, v.safeParse, schema validation, type-safe validation
Testing: Vitest, Solid Testing Library, Playwright, @testing-library/solid, renderToString
</trigger_keywords>
当用户提及以下任意内容时,激活本Skill:
文件扩展名: , , ,
.ts.tsx.mts.ctsTypeScript核心内容: TypeScript, tsc, tsconfig, 类型推断, 泛型, satisfies, 装饰器, 类型守卫, 可辨识联合, 条件类型, 映射类型, 模板字面量类型, infer关键字
SolidJS: SolidJS, Solid.js, createSignal, createStore, createMemo, createEffect, createResource, , , , , , onMount, onCleanup, 细粒度响应式
<For><Show><Switch><Match><Index>TanStack: TanStack Start, TanStack Router, createFileRoute, createServerFn, useLoaderData, 基于文件的路由, 服务器函数, Vinxi
数据验证: Valibot, v.object, v.string, v.pipe, v.safeParse, Schema验证, 类型安全验证
测试: Vitest, Solid Testing Library, Playwright, @testing-library/solid, renderToString
</trigger_keywords>
⛔ Forbidden Patterns
⛔ 禁止的模式
- NO : Strictly forbidden. Use
anyif type is truly not known yet, or define a proper type/interface.unknown - NO : Do not suppress errors. Fix them. Use
@ts-ignoreONLY if testing error cases explicitly.@ts-expect-error - NO (Non-null Assertion): Avoid
!. Use optional chainingval!or nullish coalescing?..?? - NO : Prefer union types (
enum) or const objects. Enums add runtime overhead and behave unexpectedly.type Status = 'active' | 'inactive' - NO Default Exports: Prefer named exports to ensure consistent naming across the project and better tree-shaking.
- 禁止使用类型: 严格禁止。如果类型确实未知,请使用
any,或者定义合适的类型/接口。unknown - 禁止使用: 不要抑制错误,应修复错误。仅在明确测试错误场景时使用
@ts-ignore。@ts-expect-error - 禁止使用(非空断言): 避免使用
!。使用可选链val!或空值合并运算符?.替代。?? - 禁止使用: 优先使用联合类型(
enum)或常量对象。枚举会增加运行时开销,且行为不符合预期。type Status = 'active' | 'inactive' - 禁止默认导出: 优先使用命名导出,以确保项目内命名一致,并优化摇树优化效果。
🤖 Agent Tool Strategy
🤖 Agent工具策略
- Discovery: Check for first. If it exists, use
justfileto list recipes and preferjust -lcommands over language-specific CLIs (npm, cargo, poetry, etc.). Then, readjustto understand compiler options (strictness, paths, target).tsconfig.json - Linting: Check or
eslint.config.jsto align with project style..eslintrc - Type Checking: Use to verify type safety after changes if a build script isn't available.
tsc --noEmit - Testing: Run tests via or
bun testto ensure no regressions.vitest - File Operations: When creating files, ensure the extension matches the content (for JSX,
.tsxfor logic)..ts
- 发现阶段: 首先检查是否存在。如果存在,使用
justfile列出可用命令,并优先使用just -l命令而非特定语言的CLI(如npm、cargo、poetry等)。然后读取just以了解编译器选项(严格性、路径、目标版本)。tsconfig.json - 代码检查: 检查或
eslint.config.js以对齐项目代码风格。.eslintrc - 类型检查: 如果没有构建脚本,在修改代码后使用验证类型安全性。
tsc --noEmit - 测试: 通过或
bun test运行测试,确保没有回归问题。vitest - 文件操作: 创建文件时,确保扩展名与内容匹配(用于JSX代码,
.tsx用于逻辑代码)。.ts
Quick Reference (30 seconds)
快速参考(30秒)
TypeScript 5.9+ Development Specialist - Modern TypeScript with SolidJS, TanStack Start, and type-safe API patterns.
Auto-Triggers: , , , files, TypeScript configurations, SolidJS/TanStack Start projects
.ts.tsx.mts.ctsCore Stack:
- TypeScript 5.9: Deferred module evaluation, decorators, satisfies operator
- SolidJS: Fine-grained reactivity, signals, stores
- TanStack Start: Full-stack framework with file-based routing, server functions
- Valibot: Tree-shakable schema validation
- Testing: Vitest, Solid Testing Library, Playwright
TypeScript 5.9+开发专家 - 结合SolidJS、TanStack Start和类型安全API模式的现代TypeScript开发。
自动触发条件: , , , 文件, TypeScript配置, SolidJS/TanStack Start项目
.ts.tsx.mts.cts核心技术栈:
- TypeScript 5.9: 延迟模块评估、装饰器、satisfies操作符
- SolidJS: 细粒度响应式、信号、状态存储
- TanStack Start: 基于文件路由的全栈框架、服务器函数
- Valibot: 可摇树的Schema验证
- 测试: Vitest, Solid Testing Library, Playwright
Implementation Guide (5 minutes)
实现指南(5分钟)
See patterns.md for detailed implementation patterns covering:
- TypeScript 5.9 Key Features (Satisfies, Deferred Modules, Decorators)
- SolidJS Patterns (Signals, Stores, Memos, Resources)
- TanStack Start Patterns (Routes, Server Functions)
- Valibot Schema Patterns
- Advanced State Management
查看patterns.md获取详细的实现模式,涵盖:
- TypeScript 5.9关键特性(Satisfies、延迟模块、装饰器)
- SolidJS模式(信号、状态存储、Memo、资源)
- TanStack Start模式(路由、服务器函数)
- Valibot Schema模式
- 高级状态管理
Quick Troubleshooting
快速故障排查
TypeScript Errors:
bash
bun run typecheck # Type check only
bunx tsc --generateTrace ./trace # Performance traceSolidJS/TanStack Start Issues:
bash
bun run dev # Development mode
bun run build # Check for build errors
rm -rf .vinxi .output && bun run dev # Clear cacheType Safety:
typescript
// Exhaustive check
function assertNever(x: never): never { throw new Error(`Unexpected: ${x}`); }
// Type guard
function isUser(v: unknown): v is User {
return typeof v === "object" && v !== null && "id" in v;
}- patterns.md - Implementation patterns (SolidJS, TanStack, Valibot)
- reference.md - Complete API reference, Context7 library mappings, advanced type patterns
- examples.md - Production-ready code examples, full-stack patterns, testing templates
TypeScript错误:
bash
bun run typecheck # 仅类型检查
bunx tsc --generateTrace ./trace # 性能追踪SolidJS/TanStack Start问题:
bash
bun run dev # 开发模式
bun run build # 检查构建错误
rm -rf .vinxi .output && bun run dev # 清除缓存类型安全:
typescript
// 穷举检查
function assertNever(x: never): never { throw new Error(`Unexpected: ${x}`); }
// 类型守卫
function isUser(v: unknown): v is User {
return typeof v === "object" && v !== null && "id" in v;
}- patterns.md - 实现模式(SolidJS、TanStack、Valibot)
- reference.md - 完整API参考、Context7库映射、高级类型模式
- examples.md - 生产级代码示例、全栈模式、测试模板
Context7 Integration
Context7集成
typescript
// TypeScript - mcp__context7__get_library_docs("/microsoft/TypeScript", "decorators satisfies", 1)
// SolidJS - mcp__context7__get_library_docs("/solidjs/solid", "createSignal createStore", 1)
// TanStack Start - mcp__context7__get_library_docs("/tanstack/start", "server-functions routing", 1)
// TanStack Router - mcp__context7__get_library_docs("/tanstack/router", "file-based-routing loaders", 1)
// Valibot - mcp__context7__get_library_docs("/fabian-hiller/valibot", "schema validation pipe", 1)typescript
// TypeScript - mcp__context7__get_library_docs("/microsoft/TypeScript", "decorators satisfies", 1)
// SolidJS - mcp__context7__get_library_docs("/solidjs/solid", "createSignal createStore", 1)
// TanStack Start - mcp__context7__get_library_docs("/tanstack/start", "server-functions routing", 1)
// TanStack Router - mcp__context7__get_library_docs("/tanstack/router", "file-based-routing loaders", 1)
// Valibot - mcp__context7__get_library_docs("/fabian-hiller/valibot", "schema validation pipe", 1)Works Well With
适配的Skill
- - UI components, styling patterns
moai-domain-frontend - - API design, database integration
moai-domain-backend - - Testing strategies and patterns
moai-workflow-testing - - Code quality standards
moai-foundation-quality - - Debugging TypeScript applications
moai-essentials-debug
- - UI组件、样式模式
moai-domain-frontend - - API设计、数据库集成
moai-domain-backend - - 测试策略与模式
moai-workflow-testing - - 代码质量标准
moai-foundation-quality - - TypeScript应用调试
moai-essentials-debug
Quick Troubleshooting
快速故障排查
TypeScript Errors:
bash
bun run typecheck # Type check only
bunx tsc --generateTrace ./trace # Performance traceSolidJS/TanStack Start Issues:
bash
bun run dev # Development mode
bun run build # Check for build errors
rm -rf .vinxi .output && bun run dev # Clear cacheType Safety:
typescript
// Exhaustive check
function assertNever(x: never): never { throw new Error(`Unexpected: ${x}`); }
// Type guard
function isUser(v: unknown): v is User {
return typeof v === "object" && v !== null && "id" in v;
}</skill_doc>
TypeScript错误:
bash
bun run typecheck # 仅类型检查
bunx tsc --generateTrace ./trace # 性能追踪SolidJS/TanStack Start问题:
bash
bun run dev # 开发模式
bun run build # 检查构建错误
rm -rf .vinxi .output && bun run dev # 清除缓存类型安全:
typescript
// 穷举检查
function assertNever(x: never): never { throw new Error(`Unexpected: ${x}`); }
// 类型守卫
function isUser(v: unknown): v is User {
return typeof v === "object" && v !== null && "id" in v;
}</skill_doc>