accelint-ts-documentation by gohypergiant/agent-skills
npx skills add https://github.com/gohypergiant/agent-skills --skill accelint-ts-documentation用于改进 JavaScript/TypeScript 文档的综合技能,包括 JSDoc 注释、注释标记和通用注释质量。
当任务涉及以下内容时使用此技能:
以下情况请勿激活:
对于 JSDoc 添加/验证:
必须:在实施前完整阅读 jsdoc.md。关键内容:@example 代码围栏语法(此处常见错误)、对象参数点表示法、@template 要求、边缘情况。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
除非任务明确提及注释标记(TODO、FIXME 等)或注释质量问题,否则请勿加载 comments.md。
对于注释质量审计:
必须:在实施前完整阅读 comments.md。关键内容:注释标记标准、删除与保留的内容、放置规则。
除非任务明确提及 JSDoc 标签(@param、@returns 等)或函数/类型文档,否则请勿加载 jsdoc.md。
当仅回答问题(不实施更改)或任务是通用代码质量问题时,请勿加载任何参考资料。
在审计前应用此思维框架:
问题 1:读者是谁?
问题 2:不透明性 vs 复杂性?
cache.invalidate() - 为什么?性能?正确性?)问题 3:维护成本的权衡?
应用思维框架后:
这是导出的(公共 API)吗? → 是:必须全面记录
这是内部代码吗? → 应用判断:记录从以下内容中不显而易见的内容:
经验法则:如果一位有能力的团队成员会问“为什么?”或“边缘情况是什么?” - 就记录它。如果他们觉得“显而易见” - 就跳过它。
使用此决策树来确定文档是否完整:
步骤 1:确定可见性层级
Is it exported (public API)?
YES → Tier 1: Comprehensive documentation required
NO → Tier 2: Judgment-based minimal documentation
步骤 2:应用特定实体的要求
层级 1(导出)- 始终要求:
层级 2(内部)- 基于判断:
特定实体的附加要求:
充分性检查清单:
在将文档标记为“充分”之前,请验证:
如果遇到参考资料或标准模式未涵盖的场景:
备用策略:
// NOTE: JSDoc syntax may need review for [specific case]常见未涵盖场景:
对于这些情况,默认使用自然语言的清晰描述,而不是不完整的 JSDoc 标签。
当用户明确请求文档审计或直接调用技能(/accelint-ts-documentation <path>)时,请使用标准化的报告格式:
审计报告格式提供:
何时使用审计模板:
/accelint-ts-documentation <path> 直接调用技能何时不使用审计模板:
执行文档审计时,请避免以下常见错误:
// Internal utility with verbose documentation
/**
* Internal helper function that validates input
* @internal
* @param x - The input value
* @returns True if valid, false otherwise
* @example
* ```typescript
* if (isValid(data)) { ... }
* ```
*/
function isValid(x: unknown): boolean {
return x != null;
}
错误原因:内部文档比公共 API 文档更容易过时,因为它们紧邻频繁更改的实现。团队成员阅读实际实现比阅读过时且造成混淆的文档更快。将全面的文档留给稳定的导出 API,因为使用者无法访问其实现。
// Internal utility - minimal documentation
/** Checks if value is not null/undefined */
function isValid(x: unknown): boolean {
return x != null;
}
// Public API - comprehensive documentation even if "obvious"
/**
* Validates user input data
* @param data - User input to validate
* @returns True if data is defined and not null
* @example
* ```typescript
* if (validateInput(userData)) {
* processData(userData);
* }
* ```
*/
export function validateInput(data: unknown): boolean {
return data != null;
}
// JSDoc describes implementation details
/**
* Loops through array using reduce to accumulate values into a sum
*/
function sum(numbers: number[]): number {
return numbers.reduce((a, b) => a + b, 0);
}
错误原因:JSDoc 会出现在 API 使用者的 IDE 自动补全中,而他们无法访问实现。在 JSDoc 中解释 HOW 会造成混淆(“为什么我在自动补全中看到实现细节?”)并增加重构的表面区域 - 每次实现更改都需要更新文档,导致文档漂移。
/**
* Calculates the sum of all numbers in the array
* @param numbers - Array of numbers to sum
* @returns The total sum, or 0 for empty array
*/
function sum(numbers: number[]): number {
return numbers.reduce((a, b) => a + b, 0);
}
// Not actionable
// TODO: fix this
// TODO: improve performance
错误原因:“TODO: fix this”会造成责任分散。几个月后,没人知道它是否仍然相关,谁应该修复它,或者“this”指的是什么。模糊的标记会累积成噪音,降低对所有标记的信任,导致开发者甚至忽略关键标记。
// TODO(username): Replace with binary search for O(log n) lookup
// FIXME(username): Throws error on empty array, add guard clause
/**
* Fetches user profile data from the authentication service
*
* Automatically retries up to 3 times on network failures with exponential
* backoff. Throws if user is not authenticated or profile doesn't exist.
*
* @param userId - Unique identifier for the user profile to fetch
* @param options - Configuration for fetch behavior
* @param options.includeMetadata - Include account metadata (creation date, last login)
* @param options.timeout - Request timeout in milliseconds (default: 5000)
* @returns User profile with email, name, and optional metadata
* @throws {AuthenticationError} When user session is expired or invalid
* @throws {NotFoundError} When user profile doesn't exist
* @throws {NetworkError} When all retry attempts are exhausted
*
* @example
* ```typescript
* // Basic usage
* const profile = await fetchUserProfile('user-123');
* console.log(profile.email);
*
* // With metadata and custom timeout
* const profile = await fetchUserProfile('user-123', {
* includeMetadata: true,
* timeout: 10000
* });
* ```
*/
export async function fetchUserProfile(
userId: string,
options?: { includeMetadata?: boolean; timeout?: number }
): Promise<UserProfile> {
// implementation
}
优秀之处:
当判断发生冲突时,应用以下优先级:
复杂场景(已弃用的 API、重载函数、泛型实用程序类型、回调参数、构建器模式、事件发射器)需要详细的语法指导。遇到这些情况时:
加载 jsdoc.md 参考资料 - 包含所有边缘情况的全面示例以及正确的语法模式。
关键原则:边缘情况仍然遵循双层规则(导出 vs 内部),但语法细节更重要。不要猜测 - 加载参考资料。
每周安装次数
77
仓库
GitHub 星标数
7
首次出现
2026 年 1 月 30 日
安全审计
安装于
claude-code70
codex70
opencode58
github-copilot58
gemini-cli55
cursor55
Comprehensive skill for improving JavaScript/TypeScript documentation, including JSDoc comments, comment markers, and general comment quality.
Use this skill when the task involves:
Do not activate for:
For JSDoc additions/validation:
MANDATORY : Read jsdoc.md in full before implementing. Critical content: @example code fence syntax (failures common here), object parameter dot notation, @template requirements, edge cases.
Do NOT load comments.md unless the task explicitly mentions comment markers (TODO, FIXME, etc.) or comment quality issues.
For comment quality audits:
MANDATORY : Read comments.md in full before implementing. Critical content: Comment marker standards, what to remove vs preserve, placement rules.
Do NOT load jsdoc.md unless the task explicitly mentions JSDoc tags (@param, @returns, etc.) or function/type documentation.
Do NOT load any references when only answering questions (not implementing changes) or task is general code quality.
Apply this thinking framework before auditing:
Question 1: Who is the reader?
Question 2: Opacity vs Complexity?
Question 3: Maintenance cost trade-off?
After applying the thinking framework:
Is this exported (public API)? → YES: Comprehensive documentation REQUIRED
Is this internal code? → Apply judgment: Document what's NOT self-evident from:
Rule of thumb : If a competent team member would ask "why?" or "what's the edge case?" - document it. If they'd say "obvious" - skip it.
Use this decision tree to determine if documentation is complete:
Step 1: Determine visibility tier
Is it exported (public API)?
YES → Tier 1: Comprehensive documentation required
NO → Tier 2: Judgment-based minimal documentation
Step 2: Apply entity-specific requirements
Tier 1 (Exported) - Always Required:
Tier 2 (Internal) - Judgment-Based:
Entity-Specific Additions:
Sufficiency Checklist:
Before marking documentation as "sufficient", verify:
If you encounter scenarios not covered in references or standard patterns:
Fallback strategy:
// NOTE: JSDoc syntax may need review for [specific case]Common uncovered scenarios:
For these, default to clear descriptions in natural language rather than incomplete JSDoc tags.
When users explicitly request a documentation audit or invoke the skill directly (/accelint-ts-documentation <path>), use the standardized report format:
Template: assets/output-report-template.md
The audit report format provides:
When to use the audit template:
/accelint-ts-documentation <path>When NOT to use the audit template:
When performing documentation audits, avoid these common mistakes:
// Internal utility with verbose documentation
/**
* Internal helper function that validates input
* @internal
* @param x - The input value
* @returns True if valid, false otherwise
* @example
* ```typescript
* if (isValid(data)) { ... }
* ```
*/
function isValid(x: unknown): boolean {
return x != null;
}
Why this is wrong: Internal docs rot faster than public API docs because they're adjacent to frequently-changed implementation. Team members can read the actual implementation faster than reading outdated documentation that creates confusion. Reserve comprehensive docs for stable exported APIs where consumers cannot access implementation.
// Internal utility - minimal documentation
/** Checks if value is not null/undefined */
function isValid(x: unknown): boolean {
return x != null;
}
// Public API - comprehensive documentation even if "obvious"
/**
* Validates user input data
* @param data - User input to validate
* @returns True if data is defined and not null
* @example
* ```typescript
* if (validateInput(userData)) {
* processData(userData);
* }
* ```
*/
export function validateInput(data: unknown): boolean {
return data != null;
}
// JSDoc describes implementation details
/**
* Loops through array using reduce to accumulate values into a sum
*/
function sum(numbers: number[]): number {
return numbers.reduce((a, b) => a + b, 0);
}
Why this is wrong: JSDoc appears in IDE autocomplete for API consumers who don't have access to implementation. Explaining HOW in JSDoc creates confusion ("why am I seeing implementation details in my autocomplete?") and increases refactoring surface area - every implementation change requires doc updates, leading to drift.
/**
* Calculates the sum of all numbers in the array
* @param numbers - Array of numbers to sum
* @returns The total sum, or 0 for empty array
*/
function sum(numbers: number[]): number {
return numbers.reduce((a, b) => a + b, 0);
}
// Not actionable
// TODO: fix this
// TODO: improve performance
Why this is wrong: "TODO: fix this" creates diffusion of responsibility. After months pass, nobody knows if it's still relevant, who should fix it, or what "this" refers to. Vague markers accumulate as noise that reduces trust in ALL markers, making developers ignore even critical ones.
// TODO(username): Replace with binary search for O(log n) lookup
// FIXME(username): Throws error on empty array, add guard clause
/**
* Fetches user profile data from the authentication service
*
* Automatically retries up to 3 times on network failures with exponential
* backoff. Throws if user is not authenticated or profile doesn't exist.
*
* @param userId - Unique identifier for the user profile to fetch
* @param options - Configuration for fetch behavior
* @param options.includeMetadata - Include account metadata (creation date, last login)
* @param options.timeout - Request timeout in milliseconds (default: 5000)
* @returns User profile with email, name, and optional metadata
* @throws {AuthenticationError} When user session is expired or invalid
* @throws {NotFoundError} When user profile doesn't exist
* @throws {NetworkError} When all retry attempts are exhausted
*
* @example
* ```typescript
* // Basic usage
* const profile = await fetchUserProfile('user-123');
* console.log(profile.email);
*
* // With metadata and custom timeout
* const profile = await fetchUserProfile('user-123', {
* includeMetadata: true,
* timeout: 10000
* });
* ```
*/
export async function fetchUserProfile(
userId: string,
options?: { includeMetadata?: boolean; timeout?: number }
): Promise<UserProfile> {
// implementation
}
What makes this excellent:
When judgment calls conflict, apply these priorities:
Complex scenarios (deprecated APIs, overloaded functions, generic utility types, callback parameters, builder patterns, event emitters) require detailed syntax guidance. When encountering these:
Load jsdoc.md reference - Contains comprehensive examples for all edge cases with correct syntax patterns.
Key principle: Edge cases still follow the two-tier rule (export vs internal), but syntax details matter more. Don't guess - load the reference.
Weekly Installs
77
Repository
GitHub Stars
7
First Seen
Jan 30, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code70
codex70
opencode58
github-copilot58
gemini-cli55
cursor55
测试策略完整指南:单元/集成/E2E测试金字塔与自动化实践
11,200 周安装