PluginBench
Skill
Review
Audit score 70

typescript-docs

giuseppe-trisciuoglio/developer-kit

Generate production-ready TypeScript documentation with JSDoc, TypeDoc, and ADRs for multiple audiences.

What is typescript-docs?

Generates comprehensive TypeScript documentation using JSDoc annotations, TypeDoc for API reference generation, and Architectural Decision Records (ADRs). Use this skill when creating API documentation, code examples, and framework-specific patterns for NestJS, Express, React, Angular, and Vue.

  • Generate API documentation with TypeDoc and markdown output
  • Write and validate JSDoc comments for all TypeScript constructs
  • Create and maintain Architectural Decision Records (ADRs)
  • Apply framework-specific documentation patterns for NestJS, React, Express, Angular, and Vue
  • Validate documentation quality with ESLint JSDoc rules
  • Set up GitHub Actions CI/CD pipelines for automated documentation generation

How to install typescript-docs

npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill typescript-docs
Prerequisites
  • Node.js 20 or later
  • npm or yarn package manager
  • TypeScript project with tsconfig.json
Claude Code
Cursor
Windsurf
Cline

How to use typescript-docs

  1. 1.Install TypeDoc and related packages: npm install --save-dev typedoc typedoc-plugin-markdown
  2. 2.Create typedoc.json configuration with entry points and output directory
  3. 3.Add JSDoc comments to all public classes, functions, and interfaces using @param, @returns, @throws, @example tags
  4. 4.Create ADR markdown files in docs/adr/ directory following the ADR template
  5. 5.Configure ESLint with jsdoc rules to validate documentation completeness
  6. 6.Set up GitHub Actions workflow to generate and validate docs on push
  7. 7.Run npx typedoc to generate API documentation and npm run docs:validate to check for missing comments

Use cases

Good for
  • Documenting REST API endpoints with security and rate-limiting notes
  • Creating reusable React hook documentation with usage examples
  • Generating NestJS controller and service documentation
  • Building utility function libraries with performance and RFC specifications
  • Tracking architectural decisions and design choices across projects
Who it's for
  • Backend engineers building NestJS or Express APIs
  • Frontend developers documenting React and Angular components
  • Full-stack teams maintaining TypeScript monorepos
  • Technical leads creating architectural decision records
  • Open-source maintainers generating API reference documentation

typescript-docs FAQ

What's the difference between JSDoc and TypeDoc?

JSDoc provides inline code comments using tags like @param and @returns. TypeDoc parses these JSDoc comments and generates formatted API reference documentation in HTML or Markdown. Use JSDoc for inline documentation and TypeDoc to generate the final API docs.

Do I need to document private methods and internal classes?

No. Use @private tag or configure TypeDoc with excludePrivate: true to hide internal implementation details. Focus documentation on public APIs that external users interact with.

How do I document TypeScript generics and complex types?

Use @param and @returns tags with full type notation. For generics, document the constraints and explain what each type parameter represents. See references/jsdoc-patterns.md for detailed examples.

Can I use this skill with existing projects?

Yes. Install TypeDoc and ESLint JSDoc plugin, then incrementally add JSDoc comments to your codebase. Start with public APIs and gradually expand coverage. The CI/CD pipeline can enforce documentation standards on new code.

What should I include in an ADR?

An ADR should include: Status (Accepted/Proposed/Deprecated), Context (the problem), Decision (what you chose), and Consequences (tradeoffs). See references/adr-patterns.md for templates and examples.

Full instructions (SKILL.md)

Source of truth, from giuseppe-trisciuoglio/developer-kit.


name: typescript-docs description: Generates comprehensive TypeScript documentation using JSDoc, TypeDoc, and multi-layered documentation patterns for different audiences. Use when creating API documentation, architectural decision records (ADRs), code examples, and framework-specific patterns for NestJS, Express, React, Angular, and Vue. allowed-tools: Read, Write, Edit, Bash, Grep, Glob

TypeScript Documentation

Generate production-ready TypeScript documentation with layered architecture for multiple audiences. Supports API docs with TypeDoc, ADRs, and framework-specific patterns.

Overview

Use JSDoc annotations for inline documentation, TypeDoc for API reference generation, and ADRs for tracking design choices.

Key capabilities:

  • TypeDoc configuration and API documentation generation
  • JSDoc patterns for all TypeScript constructs
  • ADR creation and maintenance
  • Framework-specific patterns (NestJS, React, Express, Angular, Vue)
  • ESLint validation rules for documentation quality
  • GitHub Actions pipeline setup

When to Use

Use this skill when creating API documentation, architectural decision records, code examples, or framework-specific patterns for NestJS, Express, React, Angular, or Vue.

Quick Reference

ToolPurposeCommand
TypeDocAPI documentation generationnpx typedoc
CompodocAngular documentationnpx compodoc -p tsconfig.json
ESLint JSDocDocumentation validationeslint --ext .ts src/

JSDoc Tags

TagUse Case
@paramDocument parameters
@returnsDocument return values
@throwsDocument error conditions
@exampleProvide code examples
@remarksAdd implementation notes
@seeCross-reference related items
@deprecatedMark deprecated APIs

Instructions

1. Configure TypeDoc

npm install --save-dev typedoc typedoc-plugin-markdown
{
  "entryPoints": ["src/index.ts"],
  "out": "docs/api",
  "theme": "markdown",
  "excludePrivate": true,
  "readme": "README.md"
}

2. Add JSDoc Comments

/**
 * 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
  }
}

3. Create an ADR

# 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?

4. Set Up CI/CD Pipeline

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

5. Validate Documentation

{
  "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.

Examples

Documenting a React Hook

/**
 * 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
}

Documenting a Utility Function

/**
 * 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);
}

NestJS Controller Documentation

/**
 * 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
  }
}

Best Practices

  1. Document Public APIs: All public methods, classes, and interfaces
  2. Use @example: Provide runnable examples for complex functions
  3. Include @throws: Document all possible errors
  4. Add @see: Cross-reference related functions/types
  5. Use @remarks: Add implementation details and notes
  6. Document Generics: Explain generic constraints and usage
  7. Include Performance Notes: Document time/space complexity
  8. Add Security Warnings: Highlight security considerations
  9. Keep Updated: Update docs when code changes
  10. Don't document obvious code: Focus on why, not what

Constraints and Warnings

  • Private Members: Use @private or exclude from TypeDoc output
  • Complex Types: Document generic constraints and type parameters
  • Breaking Changes: Use @deprecated with migration guidance
  • Security Info: Never include secrets or credentials in documentation
  • Link Validity: Ensure @see references point to valid locations
  • Example Code: All examples should be runnable and tested
  • Versioning: Keep documentation in sync with code versions

References