Skip to main content
This guide covers the complete publishing workflow for releasing components and updates to npm.

Publishing Overview

The Claude Code Templates project publishes to npm as claude-code-templates. The package provides the CLI tool that users run with npx claude-code-templates@latest.
Current version: Check package.json or run npm view claude-code-templates version

Prerequisites

1. npm Account Setup

  • Create account at npmjs.com
  • Request access to the claude-code-templates package (for maintainers)

2. npm Authentication

Classic npm tokens were revoked in December 2025. You MUST use granular access tokens.
Create a granular access token:
1

Generate Token

  1. Go to npmjs.com/settings/~/tokens
  2. Click “Generate New Token” → “Granular Access Token”
  3. Configure:
    • Permissions: Read and Write
    • Packages: Select claude-code-templates
    • IP Allowlist: Optional (for security)
    • Bypass 2FA: Enable (required for publishing)
2

Store Token Securely

Never commit tokens to the repository. Always clean up after publishing:

Complete Publishing Workflow

Step 1: Update Component Catalog

Before publishing, regenerate the component catalog to include all changes:
The script:
  • Scans all components in cli-tool/components/
  • Validates format and structure
  • Generates docs/components.json (~2MB)
  • Runs security validation

Step 2: Run Tests

Ensure all tests pass before publishing:
All tests must pass. Fix any failures before continuing.

Step 3: Version Management

Determine and update the version number:

Manual Version Update

Edit package.json to bump the version:

Automated Version Bump

Or use npm version command:
The local package.json version may drift from npm if published from CI. Always check npm view claude-code-templates version first.

Step 4: Commit Version Bump

Commit the version change:

Step 5: Publish to npm

Publishing is irreversible. Double-check version and changes before publishing.
Expected output:

Step 6: Tag Release

Create a Git tag for the release:

Step 7: Deploy Website

Deploy the updated website with new components:
For production deployments, always use the deployer agent (.claude/agents/deployer.md) which runs pre-deploy checks.

Step 8: Verify Release

Verify the release was successful:

Publishing Components Only

If you’re adding components without changing the CLI:
Users will see new components immediately on the website. The CLI will fetch them from GitHub.

Version Numbering Guidelines

Patch Version (x.x.X)

Increment for:
  • Bug fixes
  • Documentation updates
  • Minor component improvements
  • Security patches

Minor Version (x.X.0)

Increment for:
  • New components added
  • New features (backward compatible)
  • Significant improvements
  • New CLI options

Major Version (X.0.0)

Increment for:
  • Breaking changes
  • Major architecture changes
  • Incompatible API changes
  • CLI breaking changes

Rollback Procedure

If a release has issues:

1. Deprecate Bad Version

2. Publish Fixed Version

3. Rollback Website

npm does NOT allow unpublishing versions after 72 hours. You can only deprecate them.

Common Issues

”Version already exists"

"401 Unauthorized"

"403 Forbidden"

"EPUBLISHCONFLICT”

npm Publishing Notes

Granular Access Tokens

  • Classic tokens were revoked December 2025
  • Use granular access tokens from npmjs.com/settings/~/tokens
  • Token must have:
    • Read and Write permissions for claude-code-templates
    • “Bypass 2FA” enabled (required for publishing)
  • Always remove token after publishing: npm config delete

Package Scope

Package is unscoped (claude-code-templates not @org/claude-code-templates):
  • Simpler installation: npx claude-code-templates
  • No organization required
  • Public package (not private)

.npmignore

Files excluded from npm package:

Publishing Checklist

Before publishing:
1

Component Catalog

✅ No errors during generation
2

Tests Pass

✅ All tests passing
3

Version Updated

✅ Version bumped correctly
4

Changes Committed

✅ All changes committed and pushed
5

Token Configured

✅ Token configured correctly
6

Publish

✅ Published successfully
7

Tag Release

✅ Git tag created
8

Deploy Website

✅ Website deployed
9

Clean Up

✅ Token removed
10

Verify

✅ Version verified on npm

Post-Publishing

After successful publishing:

1. Announce Release

  • Update GitHub Discussions
  • Post in Discord community
  • Tweet about new features (if significant)

2. Monitor for Issues

3. Update Documentation

  • Update CHANGELOG.md with release notes
  • Update README.md if features changed
  • Update docs site if needed

Next Steps

Component Guidelines

Best practices for creating components

Testing Workflow

Complete testing guide

Architecture

Project architecture overview

Code Standards

Coding conventions and style