Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问clear审计提醒

typescriptTypeScript 开发

Agent Skill

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

总安装

220

周安装

9

GitHub Stars

2

下载量

71
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:typescript(TypeScript 开发)
来源仓库:https://github.com/slanycukr/riot-api-project
仓库路径:skills/typescript
安装命令:
npx skills add https://github.com/slanycukr/riot-api-project --skill TypeScript
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/slanycukr/riot-api-project --skill TypeScript

简介

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。

  • 适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名或辅助前后端联调。
  • 使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则。
  • 涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。
  • 安装前建议确认权限范围和维护状态,以及是否会触发联网或文件读写操作。

SKILL.md

TypeScript Skill

Quick Start

// Basic type annotations
const name: string = "John";
const age: number = 25;
const isActive: boolean = true;

// Array types
const numbers: number[] = [1, 2, 3];
const users: Array<User> = [user1, user2];

// Object types
interface User {
  id: number;
  name: string;
  email?: string; // optional
}

// Function types
const greet = (name: string): string => `Hello, ${name}!`;
const add = (a: number, b: number): number => a + b;

Common Patterns

Interface Definitions

// Basic interface
interface Product {
  id: string;
  name: string;
  price: number;
}

// Interface with optional properties
interface UserProfile {
  id: number;
  username: string;
  avatar?: string;
  bio?: string;
}

// Interface extending another
interface AdminUser extends UserProfile {
  permissions: string[];
  role: "admin" | "super_admin";
}

// Generic interface
interface ApiResponse<T> {
  data: T;
  status: number;
  message: string;
}

// Usage
const userResponse: ApiResponse<User> = {
  data: { id: 1, username: "john", email: "john@example.com" },
  status: 200,
  message: "Success",
};

Generic Types and Functions

// Generic function
function identity<T>(arg: T): T {
  return arg;
}

// Generic function with constraints
interface Lengthwise {
  length: number;
}

function getLength<T extends Lengthwise>(arg: T): number {
  return arg.length;
}

// Generic class
class Box<T> {
  private contents: T;

  constructor(value: T) {
    this.contents = value;
  }

  getValue(): T {
    return this.contents;
  }
}

// Generic utility function
function createApiResponse<T>(data: T, status = 200): ApiResponse<T> {
  return {
    data,
    status,
    message: status >= 400 ? "Error" : "Success",
  };
}

Utility Types

// Pick - select specific properties
type UserContactInfo = Pick<User, "email" | "phone">;

// Omit - remove specific properties
type CreateUserRequest = Omit<User, "id" | "createdAt">;

// Partial - make all properties optional
type PartialUser = Partial<User>;

// Required - make all properties required
type RequiredUser = Required<UserProfile>;

// Record - create object type with specific keys
type StatusMap = Record<"pending" | "approved" | "rejected", string>;

// Extract properties that match a condition
type StringProperties<T> = {
  [K in keyof T]: T[K] extends string ? K : never;
}[keyof T];

// Function property extraction
type FunctionPropertyNames<T> = {
  [K in keyof T]: T[K] extends Function ? K : never;
}[keyof T];

type FunctionProperties<T> = Pick<T, FunctionPropertyNames<T>>;

Type Guards and Discriminated Unions

// Discriminated union
interface LoadingState {
  status: "loading";
}

interface SuccessState<T> {
  status: "success";
  data: T;
}

interface ErrorState {
  status: "error";
  error: string;
}

type DataState<T> = LoadingState | SuccessState<T> | ErrorState;

// Type guard function
function isLoading<T>(state: DataState<T>): state is LoadingState {
  return state.status === "loading";
}

function isSuccess<T>(state: DataState<T>): state is SuccessState<T> {
  return state.status === "success";
}

// Usage
function handleDataState<T>(state: DataState<T>) {
  if (isLoading(state)) {
    console.log("Loading...");
  } else if (isSuccess(state)) {
    console.log("Data:", state.data);
  } else {
    console.log("Error:", state.error);
  }
}

Advanced Type Patterns

// Conditional types
type NonNullable<T> = T extends null | undefined ? never : T;

// Mapped types
type OptionalFields<T> = {
  [K in keyof T]?: T[K];
};

// Readonly mapped type
type ReadonlyUser = {
  readonly [K in keyof User]: User[K];
};

// Template literal types
type EventName = `on${Capitalize<string>}`;
type EventHandler = Record<EventName, Function>;

// Recursive utility types
type DeepPartial<T> = {
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};

API Response Patterns

// Standard API response
interface PaginatedResponse<T> {
  data: T[];
  pagination: {
    page: number;
    limit: number;
    total: number;
    totalPages: number;
  };
}

// Error response
interface ApiError {
  code: string;
  message: string;
  details?: Record<string, any>;
}

// Union of success and error responses
type ApiResult<T> =
  | { success: true; data: T }
  | { success: false; error: ApiError };

// Type-safe API client
class ApiClient {
  async get<T>(url: string): Promise<ApiResult<T>> {
    try {
      const response = await fetch(url);
      const data = await response.json();
      return { success: true, data };
    } catch (error) {
      return {
        success: false,
        error: { code: "NETWORK_ERROR", message: error.message },
      };
    }
  }
}

React/Component Patterns

// Component props with generics
interface ListProps<T> {
  items: T[];
  renderItem: (item: T) => React.ReactNode;
  keyExtractor: (item: T) => string;
}

function List<T>({ items, renderItem, keyExtractor }: ListProps<T>) {
  return (
    <div>
      {items.map(item => (
        <div key={keyExtractor(item)}>
          {renderItem(item)}
        </div>
      ))}
    </div>
  );
}

// Hook with generic state
interface State<T> {
  data: T | null;
  loading: boolean;
  error: string | null;
}

function useApi<T>(url: string): State<T> {
  const [state, setState] = useState<State<T>>({
    data: null,
    loading: true,
    error: null
  });

  useEffect(() => {
    fetch(url)
      .then(res => res.json())
      .then(data => setState({ data, loading: false, error: null }))
      .catch(error => setState({ data: null, loading: false, error: error.message }));
  }, [url]);

  return state;
}

Requirements

  • TypeScript 4.5+ (for latest utility types and template literal types)
  • Understanding of basic JavaScript concepts
  • Familiarity with object-oriented programming concepts
  • Knowledge of async/await patterns for API work

Best Practices

  1. Use interface for object shapes unless you need union types, then use type aliases
  2. Prefer generic types over any for better type safety
  3. Use utility types (Pick, Omit, Partial) to transform existing types
  4. Create type guards for discriminated unions
  5. Leverage conditional types for advanced type transformations
  6. Use readonly for immutable data structures
  7. Prefer const assertions for literal types and readonly arrays

Common Gotchas

  • any vs unknown: Use unknown when you need type checking before usage
  • [] as any[]: Avoid, use proper typing instead
  • Function overload ordering: Most specific signatures first
  • Generic constraints: Use extends to limit generic types
  • Type inference: Let TypeScript infer when possible, provide explicit types when needed

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

29.11%
按下载量换算21

windsurf

23.08%
按下载量换算16

trae

15.67%
按下载量换算11

OpenCode

11.63%
按下载量换算8

Codex

7.89%
按下载量换算6

Antigravity

3.24%
按下载量换算2

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills