typescript-docs by giuseppe-trisciuoglio/developer-kit
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill typescript-docs为多类受众生成具备分层架构的生产就绪型 TypeScript 文档。支持使用 TypeDoc 生成 API 文档、架构决策记录以及特定框架的模式。
使用 JSDoc 注释进行内联文档编写,使用 TypeDoc 生成 API 参考,使用架构决策记录来追踪设计决策。
核心功能:
在为 NestJS、Express、React、Angular 或 Vue 创建 API 文档、架构决策记录、代码示例或特定框架的模式时,使用此技能。
| 工具 | 用途 | 命令 |
|---|---|---|
| TypeDoc | API 文档生成 | npx typedoc |
| Compodoc | Angular 文档 | npx compodoc -p tsconfig.json |
| ESLint JSDoc |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 文档验证 |
eslint --ext .ts src/ |
| 标签 | 用例 |
|---|---|
@param | 记录参数 |
@returns | 记录返回值 |
@throws | 记录错误情况 |
@example | 提供代码示例 |
@remarks | 添加实现说明 |
@see | 交叉引用相关项 |
@deprecated | 标记已弃用的 API |
npm install --save-dev typedoc typedoc-plugin-markdown
{
"entryPoints": ["src/index.ts"],
"out": "docs/api",
"theme": "markdown",
"excludePrivate": true,
"readme": "README.md"
}
/**
* 用户认证管理服务
*
* @remarks
* 处理基于 JWT 的认证,并使用 bcrypt 进行密码哈希。
*
* @example
* ```typescript
* const authService = new AuthService(config);
* const token = await authService.login(email, password);
* ```
*
* @security
* - 使用 bcrypt 哈希密码(成本因子 12)
* - 使用 RS256 算法签名 JWT 令牌
*/
@Injectable()
export class AuthService {
/**
* 验证用户并返回访问令牌
* @param credentials - 用户登录凭据
* @returns 包含令牌的认证结果
* @throws {InvalidCredentialsError} 如果凭据无效
*/
async login(credentials: LoginCredentials): Promise<AuthResult> {
// 实现
}
}
# ADR-001: TypeScript 严格模式配置
## 状态
已接受
## 背景
促使做出此决策的问题是什么?
## 决策
我们提议进行什么变更?
## 后果
什么会变得更容易或更困难?
name: Documentation
on:
push:
branches: [main]
paths: ['src/**', 'docs/**']
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run docs:generate
- run: npm run docs:validate
{
"rules": {
"jsdoc/require-description": "error",
"jsdoc/require-param-description": "error",
"jsdoc/require-returns-description": "error",
"jsdoc/require-example": "warn"
}
}
如果验证失败: 检查 ESLint 错误,修复 JSDoc 注释(添加缺失的描述,在缺少的地方添加 @param/@returns/@throws),重新运行 eslint --ext .ts src/ 直到所有错误通过,然后提交。
/**
* 用于获取分页数据的自定义 Hook
*
* @remarks
* 此 Hook 管理加载状态、错误处理以及在页面或过滤器更改时的自动重新获取。
*
* @example
* ```tsx
* function UserList() {
* const { data, isLoading, error } = usePaginatedData('/api/users', {
* page: currentPage,
* limit: 10
* });
*
* if (isLoading) return <Spinner />;
* if (error) return <ErrorMessage error={error} />;
* return <UserTable users={data.items} />;
* }
* ```
*
* @param endpoint - 要获取数据的 API 端点
* @param options - 分页和过滤器选项
* @returns 包含条目和元数据的分页响应
*/
export function usePaginatedData<T>(
endpoint: string,
options: PaginationOptions
): UsePaginatedDataResult<T> {
// 实现
}
/**
* 使用 RFC 5322 规范验证电子邮件地址
*
* @param email - 要验证的电子邮件地址
* @returns 如果电子邮件格式有效则为 true
*
* @example
* ```typescript
* isValidEmail('user@example.com'); // true
* isValidEmail('invalid-email'); // false
* ```
*
* @performance
* O(n),其中 n 是电子邮件字符串的长度
*
* @see {@link https://tools.ietf.org/html/rfc5322} RFC 5322 规范
*/
export function isValidEmail(email: string): boolean {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
/**
* 用户管理的 REST API 端点
*
* @remarks
* 所有端点都需要通过 Bearer 令牌进行身份验证。
* 速率限制:每个用户每分钟 100 个请求。
*
* @example
* ```bash
* curl -H "Authorization: Bearer <token>" https://api.example.com/users/123
* ```
*
* @security
* - 所有端点都使用 HTTPS
* - JWT 令牌在 1 小时后过期
* - 敏感数据在日志中被脱敏
*/
@Controller('users')
export class UsersController {
/**
* 通过 ID 检索用户
* @param id - 用户 UUID
* @returns 用户个人资料(密码除外)
*/
@Get(':id')
async getUser(@Param('id') id: string): Promise<UserProfile> {
// 实现
}
}
@example:为复杂函数提供可运行的示例@throws:记录所有可能的错误@see:交叉引用相关函数/类型@remarks:添加实现细节和说明@private 或从 TypeDoc 输出中排除@deprecated 并提供迁移指导@see 引用指向有效位置每周安装数
678
代码仓库
GitHub 星标数
174
首次出现
2026年1月20日
安全审计
安装于
claude-code498
opencode483
gemini-cli474
cursor458
codex445
github-copilot409
Generate production-ready TypeScript documentation with layered architecture for multiple audiences. Supports API docs with TypeDoc, ADRs, and framework-specific patterns.
Use JSDoc annotations for inline documentation, TypeDoc for API reference generation, and ADRs for tracking design choices.
Key capabilities:
Use this skill when creating API documentation, architectural decision records, code examples, or framework-specific patterns for NestJS, Express, React, Angular, or Vue.
| Tool | Purpose | Command |
|---|---|---|
| TypeDoc | API documentation generation | npx typedoc |
| Compodoc | Angular documentation | npx compodoc -p tsconfig.json |
| ESLint JSDoc | Documentation validation | eslint --ext .ts src/ |
| Tag | Use Case |
|---|---|
@param | Document parameters |
@returns | Document return values |
@throws | Document error conditions |
@example | Provide code examples |
@remarks | Add implementation notes |
@see | Cross-reference related items |
npm install --save-dev typedoc typedoc-plugin-markdown
{
"entryPoints": ["src/index.ts"],
"out": "docs/api",
"theme": "markdown",
"excludePrivate": true,
"readme": "README.md"
}
/**
* Service for managing user authentication
*
* @remarks
* Handles JWT-based authentication with bcrypt password hashing.
*
* @example
* ```typescript
* const authService = new AuthService(config);
* const token = await authService.login(email, password);
* ```
*
* @security
* - Passwords hashed with bcrypt (cost factor 12)
* - JWT tokens signed with RS256
*/
@Injectable()
export class AuthService {
/**
* Authenticates a user and returns access tokens
* @param credentials - User login credentials
* @returns Authentication result with tokens
* @throws {InvalidCredentialsError} If credentials are invalid
*/
async login(credentials: LoginCredentials): Promise<AuthResult> {
// Implementation
}
}
# ADR-001: TypeScript Strict Mode Configuration
## Status
Accepted
## Context
What is the issue motivating this decision?
## Decision
What change are we proposing?
## Consequences
What becomes easier or more difficult?
name: Documentation
on:
push:
branches: [main]
paths: ['src/**', 'docs/**']
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run docs:generate
- run: npm run docs:validate
{
"rules": {
"jsdoc/require-description": "error",
"jsdoc/require-param-description": "error",
"jsdoc/require-returns-description": "error",
"jsdoc/require-example": "warn"
}
}
If validation fails: review ESLint errors, fix JSDoc comments (add missing descriptions, add @param/@returns/@throws where absent), re-run eslint --ext .ts src/ until all errors pass before committing.
/**
* Custom hook for fetching paginated data
*
* @remarks
* This hook manages loading states, error handling, and automatic
* refetching when the page or filter changes.
*
* @example
* ```tsx
* function UserList() {
* const { data, isLoading, error } = usePaginatedData('/api/users', {
* page: currentPage,
* limit: 10
* });
*
* if (isLoading) return <Spinner />;
* if (error) return <ErrorMessage error={error} />;
* return <UserTable users={data.items} />;
* }
* ```
*
* @param endpoint - API endpoint to fetch from
* @param options - Pagination and filter options
* @returns Paginated response with items and metadata
*/
export function usePaginatedData<T>(
endpoint: string,
options: PaginationOptions
): UsePaginatedDataResult<T> {
// Implementation
}
/**
* Validates email addresses using RFC 5322 specification
*
* @param email - Email address to validate
* @returns True if email format is valid
*
* @example
* ```typescript
* isValidEmail('user@example.com'); // true
* isValidEmail('invalid-email'); // false
* ```
*
* @performance
* O(n) where n is the email string length
*
* @see {@link https://tools.ietf.org/html/rfc5322} RFC 5322 Specification
*/
export function isValidEmail(email: string): boolean {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
/**
* REST API endpoints for user management
*
* @remarks
* All endpoints require authentication via Bearer token.
* Rate limiting: 100 requests per minute per user.
*
* @example
* ```bash
* curl -H "Authorization: Bearer <token>" https://api.example.com/users/123
* ```
*
* @security
* - All endpoints use HTTPS
* - JWT tokens expire after 1 hour
* - Sensitive data is redacted from logs
*/
@Controller('users')
export class UsersController {
/**
* Retrieves a user by ID
* @param id - User UUID
* @returns User profile (password excluded)
*/
@Get(':id')
async getUser(@Param('id') id: string): Promise<UserProfile> {
// Implementation
}
}
@example: Provide runnable examples for complex functions@throws: Document all possible errors@see: Cross-reference related functions/types@remarks: Add implementation details and notes@private or exclude from TypeDoc output@deprecated with migration guidance@see references point to valid locationsWeekly Installs
678
Repository
GitHub Stars
174
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code498
opencode483
gemini-cli474
cursor458
codex445
github-copilot409
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
136,300 周安装
@deprecated| Mark deprecated APIs |