Agent SkillsTangleML/tangle-ui › typescript-standards

typescript-standards

GitHub

提供TypeScript编码规范,涵盖严格类型、避免不安全断言、API数据定义及命名约定。用于指导编写符合项目标准的TypeScript代码和类型定义。

.claude/skills/typescript-standards/SKILL.md TangleML/tangle-ui

Trigger Scenarios

编写TypeScript代码 定义类型 处理类型安全

Install

npx skills add TangleML/tangle-ui --skill typescript-standards -g -y
More Options

Non-standard path

npx skills add https://github.com/TangleML/tangle-ui/tree/master/.claude/skills/typescript-standards -g -y

Use without installing

npx skills use TangleML/tangle-ui@typescript-standards

指定 Agent (Claude Code)

npx skills add TangleML/tangle-ui --skill typescript-standards -a claude-code -g -y

安装 repo 全部 skill

npx skills add TangleML/tangle-ui --all -g -y

预览 repo 内 skill

npx skills add TangleML/tangle-ui --list

SKILL.md

Frontmatter
{
    "name": "typescript-standards",
    "description": "TypeScript coding standards for this project. Use when writing TypeScript code, defining types, or working with type safety."
}

TypeScript Standards

Core Rules

  • Use strict TypeScript with proper typing
  • Prefer explicit types over any (only use any when absolutely necessary)
  • Use interface for object shapes, type for unions/primitives
  • Follow existing patterns for type definitions in src/types/

Avoid Unsafe Type Casting

Don't use type assertions (as) unless absolutely necessary. Instead prefer:

  • Type guards and runtime validation
  • Proper typing from the source
  • Union types and type narrowing
  • Schema validation libraries (e.g., zod) for external data
// Bad
const something: string = myjson as string;

// Good - use type guards or validate the data
function isString(value: unknown): value is string {
  return typeof value === "string";
}

API & Data Types

  • Use the generated API client in src/api/
  • Prefer domain types: Use types from src/utils/componentSpec.ts, src/types/, etc. for core business logic
  • Use generated API types: Only use src/api/types.gen.ts when directly interfacing with APIs or when domain types don't exist
  • Follow existing service patterns in src/services/
  • Use proper error handling with try/catch

Naming Conventions

  • Components: PascalCase
  • Files: PascalCase for components, camelCase for utilities
  • Variables/functions: camelCase
  • Constants: SCREAMING_SNAKE_CASE
  • Types/Interfaces: PascalCase
  • Directories: Follow the existing convention in the surrounding directory. The codebase uses both camelCase and PascalCase for folders — match what's already there

Version History

  • d7768e8 Current 2026-09-02 20:59

Same Skill Collection

.claude/skills/accessibility/SKILL.md
.claude/skills/address-pr-comments/SKILL.md
.claude/skills/analytics-tracking/SKILL.md
.claude/skills/audit-tickets/SKILL.md
.claude/skills/docs-update/SKILL.md
.claude/skills/e2e-testing/SKILL.md
.claude/skills/list-skills/SKILL.md
.claude/skills/open-source/SKILL.md
.claude/skills/project-conventions/SKILL.md
.claude/skills/react-patterns/SKILL.md
.claude/skills/review/SKILL.md
.claude/skills/tangle-domain/SKILL.md
.claude/skills/tanstack-query/SKILL.md
.claude/skills/tanstack-router/SKILL.md
.claude/skills/ui-primitives/SKILL.md
.claude/skills/validate/SKILL.md
.claude/skills/vitest-testing/SKILL.md
.cursor/skills/playwright-testing/SKILL.md
public/agent-skills/componentYamlFormat/SKILL.md
public/agent-skills/tangleBestPractices/SKILL.md
.claude/skills/gardening/SKILL.md

Metadata

Files
0
Version
d7768e8
Hash
01b23581
Indexed
2026-09-02 20:59

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-03 02:35
浙ICP备14020137号-1 $bản đồ khách truy cập$