Agent skill
nestjs-typedoc-setup
Install, repair, standardize, and validate TypeDoc in NestJS backends with deterministic preflight checks, non-destructive config updates, package-manager-aware commands, and verification gates. Use when users ask to add TypeDoc, fix broken docs builds, repair typedoc config/scripts, or standardize NestJS API documentation workflows.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/nestjs-typedoc-setup
SKILL.md
NestJS TypeDoc Setup and Repair
Use this workflow to add or repair TypeDoc documentation in a NestJS application.
Scope and safety
- This skill configures TypeDoc tooling and docs generation only.
- Do not modify runtime application behavior unless the user explicitly asks.
- Do not remove existing docs tooling unless there is a proven conflict.
- Run commands from the Nest app root unless the user targets a monorepo package.
Deterministic workflow
1. Preflight checks (required)
Confirm all required markers before editing:
package.jsonexists in target root.src/main.tsexists (or the user explicitly confirms a non-standard entry path).tsconfig.jsonor another projecttsconfig*.jsonexists.
Detect package manager from lockfile:
package-lock.json-> npmpnpm-lock.yaml-> pnpmyarn.lock-> yarnbun.lockb-> bun- If none exist, default to npm and state that assumption.
Detect existing TypeDoc configuration in this order:
typedoc.jsontypedoc.config.{json,cjs,mjs,js}package.json#typedoc
If config already exists, patch minimally and preserve unrelated keys.
2. Install dependencies (required)
Install required packages with the detected package manager:
npm install --save-dev typedoc typedoc-material-theme
pnpm add -D typedoc typedoc-material-theme
yarn add -D typedoc typedoc-material-theme
bun add -d typedoc typedoc-material-theme
3. Create or update TypeDoc config (required)
Preferred config file: typedoc.json at target root.
If no config exists, create:
{
"entryPoints": ["src"],
"out": "docs/api",
"tsconfig": "tsconfig.json",
"plugin": ["typedoc-material-theme"],
"entryPointStrategy": "expand",
"exclude": [
"**/*.spec.ts",
"**/*.test.ts",
"dist/**",
"node_modules/**"
],
"excludePrivate": true,
"excludeProtected": true,
"cleanOutputDir": true
}
Merge policy when config already exists:
- Preserve existing
entryPoints,tsconfig, and output location when they are valid and intentional. - Add missing required defaults only when absent.
- Preserve user excludes and append missing Nest-safe excludes.
- Keep existing plugins and append
"typedoc-material-theme"only if missing.
Exclude policy:
- Ensure these excludes exist:
"**/*.spec.ts","**/*.test.ts","dist/**","node_modules/**". - When Prisma is installed, ensure
"**/prisma/generated/**"is present.
Entry point policy:
- Default
entryPoints: ["src"]for full backend docs. - Use
["src/main.ts"]only when user asks for a constrained public surface. - Default
entryPointStrategy: "expand"unless existing config intentionally uses another strategy.
4. Ensure scripts in package.json (required)
Ensure docs scripts exist without destructive rewrites:
- Add
docs:apiastypedocwhen missing. - Add
docs:api:watchastypedoc --watchwhen missing. - Preserve existing docs script names and values unless broken.
"docs:api": "typedoc",
"docs:api:watch": "typedoc --watch"
5. Update .gitignore idempotently (required)
Add docs output ignore entry once:
docs/api/
If the project already ignores a broader path like docs/, keep it and do not duplicate entries.
6. Verify and troubleshoot (required)
Run docs generation with the local script:
npm run docs:api
Verification gates:
- Command completes without TypeDoc errors.
- Output directory exists at configured
out(defaultdocs/api/). - Main HTML entry exists (
index.html). - Test/build/generated files in exclude list are not documented.
Troubleshooting branch when generation fails:
- Check Node.js version compatibility with the Nest workspace.
- Check
tsconfigpath in TypeDoc config. - Confirm
typedoc-material-themeis installed and listed inplugin. - If plugin errors persist, run once without plugin to isolate root cause.
- If monorepo pathing fails, rerun from the package root containing
src/main.ts.
JSDoc quality conventions
- Prefer behavior-first docs on public API surfaces only.
- Use
@param,@returns, and@examplefor method-level clarity. - Use
@remarksfor non-obvious service or module context. - Avoid repeating type syntax already captured by TypeScript signatures.
See examples.md for concrete snippets.
Optional enhancements
- Add
themeColorfortypedoc-material-themebranding alignment. - Add
typedoc-plugin-markdownwhen markdown output is required. - Run docs generation in CI and publish static output as needed.
See reference.md for full option details.
Checklist
- Validate Nest workspace markers and package manager
- Detect existing TypeDoc config and choose non-destructive merge path
- Install
typedocandtypedoc-material-theme - Create or patch TypeDoc config with required excludes and plugin
- Ensure docs scripts exist in
package.json - Add docs output ignore rule idempotently
- Run docs generation and pass verification gates
References
- TypeDoc options and CI notes: reference.md
- NestJS-focused config and JSDoc examples: examples.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?