| name | documentation-standards |
| description | JSDoc/TSDoc standards for documenting types, functions, and constructs. Use when writing or reviewing documentation. |
Documentation Standards
This project uses TSDoc (TypeScript Documentation) for all code documentation. TSDoc is the TypeScript-specific standard built on JSDoc.
Philosophy
Inline TSDoc provides quick reference for IDE tooltips. Comprehensive guides, tutorials, and detailed examples belong in /docs directories within each subpackage.
General Principles
- Every public API must have documentation
- Keep it concise - inline docs are for quick reference
- One example maximum per type/function (simple usage only)
- Link to related types with
{@link TypeName}
- Tag visibility with
@public, @internal, or @private
- Detailed guides go in /docs, not inline
Documentation Structure
For Type Properties
propertyName: string;
optionalProperty?: number;
For Types/Interfaces
export type MyType = {
property: string;
};
For Functions
export const myFunction = (paramName: string): ReturnType => {
};
Tag Reference
Required Tags
Description (No Tag)
The first paragraph is always the main description. Keep it brief (1-2 sentences).
@param - Parameter Documentation
One-line description per parameter.
@public / @internal / @private - API Visibility
Always tag the visibility.
Optional Tags (Use Sparingly)
@remarks - Critical Information Only
Use only for critical prerequisites, warnings, or non-obvious behavior.
@returns - Return Value Description
Only include if the return value needs clarification beyond the type signature.
@example - Single Simple Example
One example maximum. Keep it simple and basic usage only.
@see - Related References
Link to related types or functions.
@defaultValue - Default Values
Use inline for optional properties.
instanceType?: InstanceType;
@deprecated - Deprecation Notice
Mark deprecated APIs with brief migration guidance.
Common Patterns
Types
export type AuroraClusterProps = {
vpc: IVpc;
databaseName: string;
instanceType?: InstanceType;
};
Functions
export const createAuroraCluster = (scope: Construct, id: string, props: AuroraClusterProps): DatabaseCluster => {
};
Enums
export enum Account {
BUILD = '000000000000',
DEV = '111111111111',
}
CDK Constructs (Classes)
export class CodeArtifactStack extends Stack {
constructor(scope: Construct, id: string, props: CodeArtifactStackPropsWithEnv) {
}
}
Anti-Patterns (What NOT to Do)
❌ Don't: Verbose property descriptions
export type Props = {
databaseName: string;
};
✅ Do: Concise one-liners
export type Props = {
databaseName: string;
};
❌ Don't: Multiple examples
✅ Do: One simple example
❌ Don't: Explain implementation details
✅ Do: Explain what it does
❌ Don't: Tutorial-style documentation
✅ Do: Brief critical information only
Documentation Checklist
Before committing, ensure:
Tools Integration
TSDoc comments integrate with:
- VS Code IntelliSense - Hover tooltips (primary use case)
- TypeDoc - Generated documentation sites
- API Extractor - API documentation reports
Comprehensive guides belong in /docs directories within each subpackage.