金色时刻 · 15:48
让好资源,触手可及
AGENT SKILL

typescript

typescript 是面向测试与安全的 Agent Skill,来自 FranciscoMoretti/sparka。查看技能说明、操作步骤与使用约定,并通过原项目了解详细用法。

SKILL.md

下载 MD ↓

name: typescript description: Typescript rules for the project Applies to files matching: .tsx,.ts.


Typing Guidelines

  • Avoid any at all cost. The types should work or they indicate a problem.
  • Never use as "any" or as unknown as to solve/avoid type errors. The types should work or they indicate a problem.
  • Avoid using as to cast to a specific type. The types should work or they indicate a problem.

Exports / Imports

  • Never create index barrel files (index.ts, index.js)
  • Always use direct imports with named exports
  • Always use inline interfaces with function parameters

Examples

Good - Inline interface with function:

export function processData({
  id,
  name,
  options,
}: {
  id: string;
  name: string;
  options: ProcessingOptions;
}): ProcessedResult {
  // implementation
}

Bad - Separated interface:

interface ProcessDataProps {
  id: string;
  name: string;
  options: ProcessingOptions;
}

export function processDAta({
  id,
  name,
  options,
}: ProcessDataProps): ProcessResult {
  // Implementation
}

来源:FranciscoMoretti/sparka · Apache-2.0 许可 · 许可原文 · MD 为来源页保存的历史版本