AgentSkillsCN

docs-creator

为软件项目创建并生成各类文档,包括 README 文件、API 文档、Java 的 Javadoc,以及 TypeScript 的 TSDoc。适用于以下场景:(1) 创建或更新 README 文件;(2) 使用端点与示例文档化 REST API;(3) 为 Java 代码添加或生成 Javadoc 注释;(4) 为 TypeScript 代码添加或生成 TSDoc 注释;(5) 用户要求为这段代码撰写文档、补充文档,或生成完整文档时使用。

SKILL.md
--- frontmatter
name: docs-creator
description: "Create and generate documentation for software projects including READMEs, API documentation, Javadoc (Java), and TSDoc (TypeScript). Use when: (1) Creating or updating README files, (2) Documenting REST APIs with endpoints and examples, (3) Adding or generating Javadoc comments for Java code, (4) Adding or generating TSDoc comments for TypeScript code, (5) User asks to document this code or add docs or generate documentation."

Docs Creator

Generate concise, scannable documentation with code examples.

Quick Reference

TaskReference
README filesreadme-patterns.md
REST API docsapi-docs.md
Java commentsjavadoc.md
TypeScript commentstsdoc.md

Workflow

1. Identify Documentation Type

Determine what the user needs:

  • README → Project overview, setup, usage
  • API docs → Endpoints, parameters, responses
  • Code comments → Javadoc/TSDoc for functions, classes, interfaces

2. Analyze Existing Code

When documenting existing code:

  1. Read the file(s) to understand purpose and interface
  2. Identify public APIs, exported functions, key types
  3. Note parameters, return types, exceptions
  4. Check for existing documentation to preserve/update

3. Generate Documentation

Apply the appropriate pattern from references.

For READMEs:

  • Start with template: README-template.md
  • Focus on: Setup → Usage → API/Configuration
  • Omit: Lengthy intros, tutorials, changelogs

For API docs:

  • Start with template: API-template.md
  • Document: Method, path, parameters, request/response, errors
  • Include: curl example for each endpoint

For code comments:

  • First sentence summarizes action ("Creates...", "Finds...")
  • Document parameters only if purpose isn't obvious
  • Always document return values
  • Document all thrown exceptions

Auto-Generation

When asked to "document this code" or "add docs":

  1. Scan for undocumented items - Find functions/methods without comments
  2. Preserve existing docs - Don't overwrite unless asked
  3. Generate based on signatures - Use parameter names, types, return types
  4. Match language convention - Javadoc for Java, TSDoc for TypeScript

Javadoc Pattern

java
/**
 * {Action verb} {what it does}.
 *
 * @param {name} {description}
 * @return {description}
 * @throws {Type} {when}
 */

TSDoc Pattern

typescript
/**
 * {Action verb} {what it does}.
 *
 * @param {name} - {description}
 * @returns {description}
 */

Style Guidelines

  • Concise: Minimal prose, maximum code examples
  • Scannable: Use tables, bullet lists, code blocks
  • Actionable: Copy-paste ready commands and examples
  • Consistent: Match existing documentation style in project