jsdoc-typescript-docs
Documents TypeScript code with JSDoc comments, generates API documentation, and creates type-safe documentation. Use when users request "JSDoc", "code documentation", "API docs", "TypeDoc", or "inline documentation".
What this skill does
# JSDoc TypeScript Documentation
Create comprehensive inline documentation for TypeScript codebases.
## Core Workflow
1. **Document functions**: Parameters, returns, examples
2. **Document types**: Interfaces, types, enums
3. **Add descriptions**: Purpose and usage
4. **Include examples**: Code samples
5. **Generate docs**: TypeDoc output
6. **Integrate CI**: Automated doc generation
## Function Documentation
### Basic Function
```typescript
/**
* Calculates the total price including tax.
*
* @param price - The base price before tax
* @param taxRate - The tax rate as a decimal (e.g., 0.08 for 8%)
* @returns The total price including tax
*
* @example
* ```typescript
* const total = calculateTotal(100, 0.08);
* console.log(total); // 108
* ```
*/
export function calculateTotal(price: number, taxRate: number): number {
return price * (1 + taxRate);
}
```
### Async Function
```typescript
/**
* Fetches user data from the API.
*
* @param userId - The unique identifier of the user
* @param options - Optional configuration for the request
* @returns A promise that resolves to the user data
*
* @throws {NotFoundError} When the user doesn't exist
* @throws {NetworkError} When the request fails
*
* @example
* ```typescript
* try {
* const user = await fetchUser('user-123');
* console.log(user.name);
* } catch (error) {
* if (error instanceof NotFoundError) {
* console.log('User not found');
* }
* }
* ```
*/
export async function fetchUser(
userId: string,
options?: FetchOptions
): Promise<User> {
const response = await fetch(`/api/users/${userId}`, options);
if (response.status === 404) {
throw new NotFoundError(`User ${userId} not found`);
}
if (!response.ok) {
throw new NetworkError('Failed to fetch user');
}
return response.json();
}
```
### Generic Function
```typescript
/**
* Filters an array based on a predicate function.
*
* @typeParam T - The type of elements in the array
* @param array - The array to filter
* @param predicate - A function that returns true for elements to keep
* @returns A new array containing only elements that pass the predicate
*
* @example
* ```typescript
* const numbers = [1, 2, 3, 4, 5];
* const evens = filterArray(numbers, n => n % 2 === 0);
* // evens: [2, 4]
* ```
*/
export function filterArray<T>(
array: T[],
predicate: (item: T, index: number) => boolean
): T[] {
return array.filter(predicate);
}
```
### Overloaded Function
```typescript
/**
* Formats a value for display.
*
* @param value - The value to format
* @returns The formatted string
*/
export function format(value: number): string;
/**
* Formats a value with a specific format string.
*
* @param value - The value to format
* @param formatStr - The format string (e.g., 'currency', 'percent')
* @returns The formatted string
*/
export function format(value: number, formatStr: string): string;
/**
* @internal
*/
export function format(value: number, formatStr?: string): string {
if (formatStr === 'currency') {
return `$${value.toFixed(2)}`;
}
if (formatStr === 'percent') {
return `${(value * 100).toFixed(1)}%`;
}
return value.toString();
}
```
## Interface Documentation
```typescript
/**
* Represents a user in the system.
*
* @example
* ```typescript
* const user: User = {
* id: 'user-123',
* email: '[email protected]',
* name: 'John Doe',
* role: 'admin',
* createdAt: new Date(),
* };
* ```
*/
export interface User {
/**
* The unique identifier for the user.
* @example 'user-123'
*/
id: string;
/**
* The user's email address.
* @example '[email protected]'
*/
email: string;
/**
* The user's display name.
* @example 'John Doe'
*/
name: string;
/**
* The user's role in the system.
* @default 'user'
*/
role: 'admin' | 'user' | 'guest';
/**
* When the user account was created.
*/
createdAt: Date;
/**
* When the user account was last updated.
* @optional
*/
updatedAt?: Date;
/**
* The user's profile settings.
* @see {@link UserProfile}
*/
profile?: UserProfile;
}
/**
* User profile configuration.
*/
export interface UserProfile {
/** URL to the user's avatar image */
avatarUrl?: string;
/** User's preferred language code (e.g., 'en', 'es') */
language: string;
/** User's timezone (e.g., 'America/New_York') */
timezone: string;
/** User notification preferences */
notifications: NotificationSettings;
}
```
## Type Documentation
```typescript
/**
* HTTP methods supported by the API.
*/
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
/**
* Configuration options for API requests.
*
* @typeParam TBody - The type of the request body
*/
export type RequestConfig<TBody = unknown> = {
/** HTTP method to use */
method: HttpMethod;
/** Request headers */
headers?: Record<string, string>;
/** Request body (for POST, PUT, PATCH) */
body?: TBody;
/** Request timeout in milliseconds */
timeout?: number;
/** Number of retry attempts on failure */
retries?: number;
};
/**
* Result type for operations that can fail.
*
* @typeParam T - The type of the success value
* @typeParam E - The type of the error value
*
* @example
* ```typescript
* function divide(a: number, b: number): Result<number, string> {
* if (b === 0) {
* return { success: false, error: 'Division by zero' };
* }
* return { success: true, data: a / b };
* }
* ```
*/
export type Result<T, E = Error> =
| { success: true; data: T }
| { success: false; error: E };
```
## Class Documentation
```typescript
/**
* A client for interacting with the API.
*
* @remarks
* This client handles authentication, retries, and error handling
* automatically. Use the {@link ApiClient.create} factory method
* to create an instance.
*
* @example
* ```typescript
* const client = ApiClient.create({
* baseUrl: 'https://api.example.com',
* apiKey: process.env.API_KEY,
* });
*
* const users = await client.get<User[]>('/users');
* ```
*/
export class ApiClient {
/**
* The base URL for all API requests.
* @readonly
*/
readonly baseUrl: string;
/**
* Creates a new ApiClient instance.
*
* @param config - The client configuration
* @returns A new ApiClient instance
*
* @example
* ```typescript
* const client = ApiClient.create({ baseUrl: 'https://api.example.com' });
* ```
*/
static create(config: ApiClientConfig): ApiClient {
return new ApiClient(config);
}
/**
* @internal
*/
private constructor(private config: ApiClientConfig) {
this.baseUrl = config.baseUrl;
}
/**
* Performs a GET request.
*
* @typeParam T - The expected response type
* @param endpoint - The API endpoint (relative to baseUrl)
* @param options - Optional request configuration
* @returns A promise that resolves to the response data
*
* @throws {ApiError} When the request fails
*
* @example
* ```typescript
* interface User { id: string; name: string; }
* const users = await client.get<User[]>('/users');
* ```
*/
async get<T>(endpoint: string, options?: RequestOptions): Promise<T> {
return this.request<T>('GET', endpoint, options);
}
/**
* Performs a POST request.
*
* @typeParam T - The expected response type
* @typeParam TBody - The request body type
* @param endpoint - The API endpoint
* @param body - The request body
* @param options - Optional request configuration
* @returns A promise that resolves to the response data
*/
async post<T, TBody = unknown>(
endpoint: string,
body: TBody,
options?: RequestOptions
): Promise<T> {
return this.request<T>('POST', endpoint, { ...options, body });
}
/**
* @internal
*/
private async request<T>(
method: HttpMethod,
endpoint: string,
options?: RequestOptions
): Promise<T> {
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.