Distribute AI agent skills like any other npm package
AI coding tools (Claude Code, Cursor, Windsurf) support custom "skills" - reusable instructions that extend agent capabilities. But distributing them means manual file copying, no versioning, and painful updates.
This template lets you publish skills to npm:
# Install
npm install -g @your-org/git-commit-helper
# Update
npm update -g @your-org/git-commit-helper
# It just works - installs to ~/.claude/skills/, ~/.cursor/skills/, etc.Why this matters: Skills become proper software artifacts with semantic versioning, dependency management, private registries, and global discovery. Same infrastructure that distributes React and Express.
Quick start: Fork this template, edit SKILL.md, run npm publish. Your skill is now installable worldwide.
Supports: Claude Code, Cursor, Windsurf, and any tool following similar skill patterns. See MULTI-TOOL-SUPPORT.md.
Manual skill distribution requires downloading files, copying to ~/.claude/skills/, and repeating for every update. No versioning, no dependency management, no discovery.
npm solves this:
# Install/update/uninstall with standard commands
npm install -g @your-org/skill-name
npm update -g @your-org/skill-name
npm uninstall -g @your-org/skill-name
# Semantic versioning for controlled updates
npm install @your-org/skill@^2.1.0
# Project-specific skills (version-locked, committed to git)
npm install --save-dev @your-org/skill-nameCore benefits:
- Version control - Semantic versioning, upgrade/rollback easily
- Global distribution - Publish once, available worldwide via npm's CDN
- Discoverability - Searchable on npmjs.com
- Enterprise ready - Private registries for internal skills
- Ecosystem integration - Works with CI/CD, monorepos, existing tooling
Skills become first-class software artifacts, using the same infrastructure as React, Express, and millions of other packages.
- β Official Specification: Fully compliant with Claude Code skills format
- β Multi-Tool Support: Install to Claude Code, Cursor, Windsurf, and more! (See Multi-Tool Support)
- β Smart Installation: Auto-detects global vs project-level installation
- β Progressive Disclosure: Supports main SKILL.md + reference files
- β Lifecycle Management: Install, update, uninstall scripts included
- β Best Practices: Follows all recommended patterns from official docs
- β Ready to Publish: Just customize and publish to npm
This is a GitHub Template Repository. The easiest way to use it:
- Click the "Use this template" button at the top of this repository (or click here)
- Name your new repository (e.g.,
my-awesome-skill) - Clone your new repository:
git clone https://github.com/YOUR-USERNAME/my-awesome-skill.git cd my-awesome-skill - Customize your skill (see Customization Guide)
- Publish to npm:
npm login npm publish --access public
# Clone this repository
git clone https://github.com/YOUR-USERNAME/agent-skill-npm-boilerplate.git my-skill
cd my-skill
# Remove git history and start fresh
rm -rf .git
git init
# Install dependencies (for development)
npm install
# Customize your skillagent-skill-npm-boilerplate/
βββ package.json # npm package configuration
βββ SKILL.md # Main skill definition (REQUIRED)
βββ .claude-skill.json # Installation configuration
βββ install-skill.js # Installation script
βββ uninstall-skill.js # Uninstallation script
βββ reference.md # Detailed documentation (optional)
βββ examples.md # Usage examples (optional)
βββ scripts/ # Utility scripts (optional)
β βββ setup.sh # Post-install setup
β βββ config.json.example # Configuration template
βββ README.md # This file (customize for your skill)
βββ LICENSE # License file
βββ .gitignore # Git ignore rules
Replace the following placeholders:
{
"name": "@your-org/your-skill-name", // Change this
"version": "1.0.0",
"description": "YOUR SKILL DESCRIPTION", // Change this
"author": "YOUR NAME", // Change this
"repository": {
"url": "YOUR-REPO-URL" // Change this
}
}About npm scopes:
- Use a scope (
@your-org/skill-name) if you want to organize skills under your organization - Use no scope (
skill-name) for standalone packages - Popular scopes:
@your-company,@your-username, or custom like@claude-skills - Scopes require configuration:
npm config set @your-org:registry https://registry.npmjs.org/
Edit SKILL.md and replace placeholders:
---
name: your-skill-name # Must match directory name
description: Your skill description here. Use when [scenarios].
allowed-tools: Read, Bash # Tools your skill can use
---{
"name": "your-skill-name", // Must match SKILL.md name
"package": "@your-org/your-skill-name"
}Edit the "Instructions" section in SKILL.md:
## Instructions
When the user [describes scenario]:
1. **Step 1**: Do something
2. **Step 2**: Do something else
3. **Step 3**: Complete the task# Test the installation script
node install-skill.js
# Check if installed correctly
ls -la ~/.claude/skills/your-skill-name/
cat ~/.claude/skills/your-skill-name/SKILL.md
# Open Claude Code and verify
# Ask Claude: "What skills are available?"# Login to npm (first time only)
npm login
# Publish your skill
npm publish --access publicThe description field in SKILL.md is crucial - it determines when Claude uses your skill:
# β Bad: Too vague
description: Helps with files
# β
Good: Specific and includes trigger keywords
description: Analyzes TypeScript files for type errors. Use when checking types, debugging TypeScript issues, or validating .ts files.Keep SKILL.md under 500 lines. Put detailed content in separate files:
# In SKILL.md
For complete API reference, see [reference.md](reference.md)
For examples, see [examples.md](examples.md)Claude will only load these files when needed, saving context.
Use allowed-tools to restrict what your skill can do:
# Read-only skill
allowed-tools: Read, Grep, Glob
# Can read and execute (but not modify files)
allowed-tools: Read, Bash
# Full access
allowed-tools: Read, Edit, Write, BashShow concrete examples in your SKILL.md:
## Examples
### Example 1: Basic Usage
User asks: "Check my commit message"
Claude will:
1. Read the commit message
2. Validate format
3. Suggest improvementsnpm install -g @your-org/your-skillInstalls to: ~/.claude/skills/your-skill-name/
Available: Across all projects for the current user
npm install --save-dev @your-org/your-skillInstalls to: .claude/skills/your-skill-name/
Available: Only in this project (can be committed to git)
When multiple skills exist:
- Enterprise (managed settings)
- Personal (
~/.claude/skills/) - Project (
.claude/skills/) - Plugin
This boilerplate includes automatic installation and uninstallation scripts that run when users install or remove your skill package via npm.
When a user runs npm install (or npm install -g) on your skill package:
- Target Detection: The script identifies which AI coding tools are configured for installation based on
.claude-skill.json - Scope Prefix Handling: Extracts the actual skill name by removing any npm scope prefix (e.g.,
@your-org/skill-namebecomesskill-name) - Path Resolution: For each target tool, it determines the appropriate installation location:
- Global installation:
~/{tool-path}/skills/(user's home directory) - Project installation:
./{tool-path}/skills/(project root directory)
- Global installation:
- Directory Setup: Creates the skill directory using the skill name (without npm scope prefix)
- File Copying: Copies essential files:
SKILL.md(required) - The main skill definition- Any additional files specified in
.claude-skill.json
- Compatibility Cleanup: Removes any legacy installation paths for backward compatibility
- Manifest Update: Updates the
.skills-manifest.jsonto track installed skills - Post-install Hooks: Runs any custom setup scripts defined in
.claude-skill.json
When a user runs npm uninstall (or npm uninstall -g) on your skill package:
- Target Detection: Identifies which AI coding tools were configured for the skill
- Scope Prefix Handling: Uses both the skill name (without scope prefix) and full package name (with scope prefix) for compatibility
- Path Resolution: Determines the appropriate uninstallation locations
- Directory Removal: Removes the skill directory from all configured targets:
- Path using skill name (primary location)
- Path with full package name (legacy location for compatibility)
- Manifest Update: Removes the skill entry from
.skills-manifest.json - Best-effort Cleanup: Continues even if some steps fail to ensure clean removal
Run scripts during installation:
// .claude-skill.json
{
"hooks": {
"postinstall": "bash scripts/setup.sh"
}
}Support rich documentation:
// .claude-skill.json
{
"files": {
"reference.md": "reference.md",
"examples.md": "examples.md",
"scripts": "scripts/"
}
}Let users customize your skill:
# scripts/setup.sh
cat > scripts/config.json <<EOF
{
"option1": "default",
"option2": true
}
EOF# Check installation location
ls -la ~/.claude/skills/
# Verify SKILL.md format
cat ~/.claude/skills/your-skill/SKILL.md
# Check manifest
cat ~/.claude/skills/.skills-manifest.json# Fix npm permissions (recommended)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
# Or use sudo (not recommended)
sudo npm install -g @your-org/your-skill- Make sure the
descriptionincludes keywords users would naturally say - Test by asking Claude directly: "Use the your-skill-name skill to..."
- Claude Code Skills Documentation
- Skills Best Practices
- npm Package Publishing Guide
- Conventional Commits
Contributions are welcome! Please:
- Fork this repository
- Create a feature branch
- Make your changes
- Submit a pull request
See CONTRIBUTING.md for details.
This template is MIT licensed. Skills you create from this template can use any license you choose.
Skills built with this template:
@your-org/git-commit-helper- Generate conventional commit messages@your-org/code-reviewer- Automated code review assistance@your-org/test-generator- Generate test cases from code
(Add your skill here after publishing!)
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Wiki
If you find this template helpful:
- β Star this repository
- π Report bugs
- π‘ Suggest features
- π Improve documentation
Made with β€οΈ for the Claude Code community