Nestjs package dev
Skill romtaugranot/nest-forge/.claude/skills/nestjs-package-dev
Guides development, auditing, and publishing of NestJS npm packages. Enforces project conventions from CLAUDE.md, runs pre-publish and version-release checklists, reviews API usability from a consumer's perspective, generates README files, scaffolds new packages, and handles npm/GitHub Packages publishing with CI/CD. Use this skill whenever working on a NestJS npm package — whether scaffolding a new one, preparing for first publish, cutting a new version, reviewing API design, or generating documentation. Also trigger when the user mentions npm publish, package release, version bump, package audit, API review, README generation, or "is this ready to publish" in the context of a NestJS library. Trigger on package.json questions for libraries too.From its SKILL.md
npx -y skills add romtaugranot/nest-forge --skill nestjs-package-devAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
12.0 KB, as published. Nobody here has run it
NestJS Package Developer
This skill helps you take a NestJS npm package from idea to published, production-quality library — and keep it there across releases. It covers the full lifecycle: scaffolding, development, auditing, API review, documentation, CI/CD, and publishing.
First Steps
Before doing anything else:
- Read the project's CLAUDE.md if one exists. It contains the coding conventions that all code in this project must follow. Every suggestion, scaffold, and review you perform must conform to these conventions.
- Read
package.jsonto understand the current state of the package. - Determine what the user needs — then jump to the appropriate section below.
Choosing a Workflow
| User wants to... | Go to |
|---|---|
| Start a new NestJS package from scratch | Scaffold |
| Check if a package is ready to publish | Audit |
| Review the API from a consumer's perspective | API Review |
| Generate or update the README | README Generation |
| Prepare and publish a new version | Release |
| Set up or fix CI/CD | CI/CD Setup |
If the user's intent spans multiple workflows (e.g., "get this package ready to publish"), run them in sequence: Audit first to identify gaps, then fix what's missing, then API Review, then README, then Release.
Scaffold a New Package
Read references/scaffold-guide.md for the full scaffold template and step-by-step process.
High-level flow:
- Ask the user for: package name, description, what the package does, target audience
- Check npm registry availability:
npm view <name>— if taken, suggest alternatives - Generate the project skeleton following the conventions in CLAUDE.md
- Set up package.json with proper exports, peer dependencies, scripts
- Configure TypeScript (strict mode, declarations, build config)
- Set up ESLint, Prettier, Jest
- Create the initial module structure (NestJS module with
forRoot/forRootAsyncif appropriate) - Set up CI/CD workflows
- Create LICENSE, CONTRIBUTING.md, CHANGELOG.md
- Run the pre-publish checklist to verify completeness
The scaffold should produce a package that passes the full audit on day one.
Audit an Existing Package
Read references/pre-publish-checklist.md for the complete checklist.
The audit walks through every aspect of the package systematically. For each item:
- Check the current state
- Report whether it passes or fails
- If it fails, explain what needs to change and offer to fix it
Running the Audit
- Read the full checklist from
references/pre-publish-checklist.md - Work through each section, reading the relevant files
- Search for latest NestJS best practices online when checking NestJS-specific patterns — the ecosystem evolves and the checklist may not cover the newest recommendations
- Present a summary table showing pass/fail for each section
- Offer to fix all failures automatically
Quick Checks via CLI
Run these commands to gather audit data efficiently:
# Check if package name is available (or already yours)
npm view <package-name> version
# Audit dependencies for vulnerabilities
npm audit
# Dry-run publish to see what would be included
npm pack --dry-run
# Check for outdated dependencies
npm outdated
# Verify the build works
npm run build
# Run the test suite
npm test
# Check lint
npm run lint
# Check formatting
npm run format:check
API Usability Review
This is where you think like a developer who just discovered this package on npm and wants to use it. Read references/api-review-guide.md for the full review framework.
The core question: If I were a NestJS developer who needed what this package offers, would I enjoy using it?
Review Process
- Read the package's public API — everything exported from
index.ts(the barrel file). This is what consumers see. - Read the README — is the getting-started experience smooth?
- Trace a typical usage flow — import the module, configure it, call the service methods. Is it intuitive?
- Check for missing features that a consumer would reasonably expect
- Check for sharp edges — confusing naming, unclear error messages, missing types, too many required config options
- Search online for how similar NestJS packages handle the same problems — are we missing patterns that users expect?
- Write up findings organized by severity (blocking, should-fix, nice-to-have)
What to Look For
- Import experience: Can users import everything they need from one path?
- Configuration: Is
forRoot/forRootAsyncstraightforward? Are defaults sensible? - Type safety: Are all public types exported? Do consumers get good autocomplete?
- Error messages: When things go wrong, do errors explain what happened and what to do?
- Documentation: Does every public method have a clear purpose from its name + types?
- Peer dependencies: Are they reasonable? Not pulling in things the consumer wouldn't expect?
Generate the README
A good README is the difference between a package with 10 downloads and 10,000. Generate it by actually understanding the code, not by filling a template with guesses.
Process
- Read the full source code — understand what the package does, how it works, what problems it solves
- Read package.json — extract name, description, dependencies, peer deps, scripts, bin entries
- Identify the target audience — who would use this package and why?
- Trace the main usage paths — what does a consumer do from install to first successful use?
- Search online for similar packages — how do their READMEs structure the information? What do users expect to find?
- Write the README using the structure below
README Structure
# Package Name
One-line description of what the package does and why it matters.
## Features
Bullet list of key capabilities — focus on what the user gets, not implementation details.
## Installation
npm install command with peer dependency notes.
## Quick Start
Minimal working example — from import to working result in under 20 lines.
## Usage
### Basic Usage
### Advanced Configuration
### [Feature-specific sections as needed]
## API Reference
Document every exported class, method, interface, and type.
For services: method signature, parameters, return type, what it does, example.
For modules: forRoot/forRootAsync options, what each option controls.
## CLI (if applicable)
Command, flags, examples.
## Configuration
All configuration options in a table: name, type, default, description.
## Error Handling
What exceptions can be thrown, when, and how to handle them.
## Contributing
Link to CONTRIBUTING.md.
## License
License type with link to LICENSE file.
Quality Standards
- Every code example must actually work — trace it through the source to verify
- Show imports in every example
- Use TypeScript in all examples
- Include output/result comments where it helps understanding
- Link to relevant NestJS docs for patterns the user might not know (e.g., dynamic modules)
- Keep examples realistic — use domain-appropriate names, not
foo/bar
Release a New Version
Read references/version-release-checklist.md for the full release process.
High-level flow:
- Determine the version bump type (major/minor/patch) based on changes since last release
- Run the pre-publish checklist to catch any regressions
- Update CHANGELOG.md with the new version's changes
- Bump the version in package.json
- Create a git commit and tag
- Push the commit and wait for all CI workflows to pass before pushing the tag
- Push the tag to trigger the release workflow only after CI is green
- Verify the package published successfully
Semver Decision Guide
- Patch (1.0.0 -> 1.0.1): Bug fixes, documentation updates, internal refactors with no API changes
- Minor (1.0.0 -> 1.1.0): New features, new exports, new optional configuration — nothing breaks existing consumers
- Major (1.0.0 -> 2.0.0): Breaking changes — removed/renamed exports, changed method signatures, dropped Node versions, changed peer dep ranges
When in doubt, ask the user. Breaking changes are easy to miss (e.g., changing a default value can break consumers who relied on the old default).
CI/CD Setup
GitHub Actions CI (test on push/PR)
The CI workflow should:
- Run on push to main and on pull requests
- Test across the Node.js versions specified in
engines(typically the active LTS versions) - Run:
npm ci-> lint -> format check -> test -> build
GitHub Actions Release (publish on tag)
The release workflow should:
- Trigger on
v*tags - Run the full CI pipeline first (lint, test, build)
- Publish to npm using
NPM_TOKENsecret - Optionally also publish to GitHub Packages
Never publish to npm until all CI workflows succeed. When releasing, push the commit to main first and verify all CI workflows pass before pushing the version tag. This ensures broken code never reaches the registry.
Publishing to GitHub Packages
To publish to both npm and GitHub Packages, the release workflow needs a second publish step:
- uses: actions/setup-node@v4
with:
registry-url: https://npm.pkg.github.com
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The package.json needs a publishConfig field if the default registry should be npm:
"publishConfig": {
"registry": "https://registry.npmjs.org"
}
Required Secrets
NPM_TOKEN: Generate at npmjs.com -> Access Tokens -> Granular Access Token (recommended) or Automation tokenGITHUB_TOKEN: Automatically available in GitHub Actions for GitHub Packages
Research & Staying Current
Whenever auditing, reviewing, or scaffolding, search the web for:
- Latest NestJS release notes and migration guides
- Current best practices for npm package publishing
- How popular NestJS packages (e.g.,
@nestjs/config,@nestjs/throttler,nestjs-zod) structure their exports, modules, and configuration - npm packaging gotchas (dual CJS/ESM, conditional exports,
typefield)
The NestJS ecosystem moves fast. What was best practice six months ago may have better alternatives now. Always verify recommendations against the latest documentation.
Conventions Enforcement
Every piece of code this skill produces or reviews must follow the project's CLAUDE.md conventions. The key ones for package development:
- Barrel files (
index.ts) in every module, exporting only the public API - Named exports only — no default exports
- Folder structure: interfaces/, types/, exceptions/, schemas/, data/, utils/ etc.
- TypeScript strict mode with explicit return types, no
any, noas, no! - Arrow functions only — no
functionkeyword constby default —letonly when reassignment is needed- No abbreviations — spell out all identifiers
- Custom exceptions that extend NestJS HttpException subclasses
- Zod for validation —
safeParseonly, constants in data/ files, schemas in schemas/ files private readonlyfor all constructor injections
Read the full CLAUDE.md for the complete list. When writing code, cross-reference it. When reviewing code, flag violations.