lang-typescript

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Principles

原则

  • Enable strict mode — no implicit any, strict null checks
  • Prefer discriminated unions over type assertions
  • Use
    unknown
    over
    any
    — narrow with type guards
  • 启用严格模式——无隐式 any、严格空值检查
  • 优先使用可辨识联合而非类型断言
  • 使用
    unknown
    而非
    any
    ——通过类型守卫收窄类型

Rules

规则

See rules index for detailed patterns.
查看 规则索引 获取详细模式。

Examples

示例

Positive Trigger

触发场景

User: "Replace unsafe any usage with discriminated unions in this module."
Expected behavior: Use
lang-typescript
guidance, follow its workflow, and return actionable output.
用户:"将该模块中不安全的 any 用法替换为可辨识联合。"
预期行为:使用
lang-typescript
指引,遵循其工作流,返回可落地的输出。

Non-Trigger

非触发场景

User: "Design REST route naming conventions for a new backend."
Expected behavior: Do not prioritize
lang-typescript
; choose a more relevant skill or proceed without it.
用户:"为新后端设计 REST 路由命名规范。"
预期行为:不优先使用
lang-typescript
;选择更相关的技能或不使用该技能继续处理。

Troubleshooting

故障排查

Skill Does Not Trigger

技能未触发

  • Error: The skill is not selected when expected.
  • Cause: Request wording does not clearly match the description trigger conditions.
  • Solution: Rephrase with explicit domain/task keywords from the description and retry.
  • 错误:预期选中该技能但未选中。
  • 原因:请求表述未明确匹配描述中的触发条件。
  • 解决方案:使用描述中明确的领域/任务关键词重新表述后重试。

Guidance Conflicts With Another Skill

指引与其他技能冲突

  • Error: Instructions from multiple skills conflict in one task.
  • Cause: Overlapping scope across loaded skills.
  • Solution: State which skill is authoritative for the current step and apply that workflow first.
  • 错误:同一任务中多个技能的指令存在冲突。
  • 原因:已加载的技能之间存在范围重叠。
  • 解决方案:明确当前步骤哪个技能具有权威性,优先应用其工作流。

Output Is Too Generic

输出过于笼统

  • Error: Result lacks concrete, actionable detail.
  • Cause: Task input omitted context, constraints, or target format.
  • Solution: Add specific constraints (environment, scope, format, success criteria) and rerun.
  • 错误:结果缺乏具体可落地的细节。
  • 原因:任务输入缺少上下文、约束或目标格式。
  • 解决方案:添加具体约束(环境、范围、格式、成功标准)后重新运行。

Workflow

工作流

  1. Identify whether the request clearly matches
    lang-typescript
    scope and triggers.
  2. Apply the skill rules and referenced guidance to produce a concrete result.
  3. Validate output quality against constraints; if gaps remain, refine once with explicit assumptions.
  1. 识别请求是否明确匹配
    lang-typescript
    的范围和触发条件。
  2. 应用该技能规则和引用的指引生成具体结果。
  3. 对照约束验证输出质量;如果仍有不足,基于明确假设优化一次。