Claude Skill

prpm-json-best-practices

Best practices for structuring prpm.json package manifests with required fields, tags, organization, multi-package management, enhanced file format, eager/lazy activation, and conversion hints

LLM Mart · 0 points · 19 views 0 listing impressions 0 install-command copies
Virus-scanned Reviewed automatically before listing.

Full trust report

Download agentworkforce-relay-.claude_skills_prpm-json-best-practices-skill-a8d2cab.zip · 16 KB
Part of agentworkforce/relay — 57 skills

Install

skills CLI npx skills add https://github.com/AgentWorkforce/relay/tree/main/.claude/skills/prpm-json-best-practices-skill
Claude Code claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install agentworkforce-relay@llmmart
Git git clone https://github.com/AgentWorkforce/relay.git

The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole agentworkforce/relay collection as a plugin from our marketplace. Git is the plain clone.

Skill manifest

PRPM JSON Best Practices

You are an expert at creating and maintaining prpm.json package manifests for PRPM (Prompt Package Manager). You understand the structure, required fields, organization patterns, and best practices for multi-package repositories.

When to Apply This Skill

Use when:

  • Creating a new prpm.json manifest for publishing packages
  • Maintaining existing prpm.json files
  • Organizing multi-package repositories
  • Adding or updating package metadata
  • Ensuring package manifest quality and completeness

Don't use for:

  • User configuration files (.prpmrc) - those are for users
  • Lockfiles (prpm.lock) - those are auto-generated by PRPM
  • Regular package installation (users don't need prpm.json)
  • Dependencies already tracked in lockfiles

Core Purpose

prpm.json is only needed if you're publishing packages. Regular users installing packages from the registry don't need this file.

Use prpm.json when you're:

  • Publishing a package to the PRPM registry
  • Creating a collection of packages
  • Distributing your own prompts/rules/skills/agents
  • Managing multiple related packages in a monorepo

File Structure

Single Package

See examples/single-package.json for complete structure.

Key fields: name, version, description, author, license, format, subtype, files

Multi-Package Repository

See examples/multi-package.json for complete structure.

Use when: Publishing multiple related packages from one repo Key difference: Top-level packages array with individual package definitions

Collections Repository

See examples/collections-repository.json for complete structure.

Use when: Bundling existing published packages into curated collections Key points:

  • collections array references packages by packageId (not files)
  • Each collection has id, name, description, packages
  • Packages can be required: true (default) or false (optional)
  • Use version ranges (^1.0.0) or latest
  • Add reason to explain why package is included

Packages + Collections (Combined)

See examples/packages-with-collections.json for complete structure.

Use when: Publishing packages AND creating collections that bundle them Key points:

  • Define packages in packages array with files
  • Define collections in collections array referencing those packages
  • Collections can reference both local packages and external ones
  • Publish both individual packages and collection bundles from same repo

Required Fields

Top-Level (Single Package)

Field Type Required Description
name string Yes Package name (kebab-case, unique in registry)
version string Yes Semver version (e.g., 1.0.0)
description string Yes Clear description of what the package does
author string Yes Author name and optional email
license string Yes SPDX license identifier (e.g., MIT, Apache-2.0)
format string Yes Target format: claude, cursor, continue, windsurf, etc.
subtype string Yes Package type: agent, skill, rule, slash-command, prompt, collection
files string[] Yes Array of files to include in package

Optional Top-Level Fields

Field Type Description
repository string Git repository URL
organization string Organization name (for scoped packages)
homepage string Package homepage URL
documentation string Documentation URL
license_text string Full text of the license file for proper attribution
license_url string URL to the license file in the repository
tags string[] Searchable tags (kebab-case)
keywords string[] Additional keywords for search
category string Package category
private boolean If true, won't be published to public registry
dependencies object Package dependencies (name: semver)
scripts object Lifecycle scripts (multi-package only)
eager boolean If true, skill/agent loads at session start (not on-demand)

Multi-Package Fields

When using packages array:

Field Type Required Description
name string Yes Unique package name
version string Yes Package version
description string Yes Package description
format string Yes Package format
subtype string Yes Package subtype
tags string[] Recommended Searchable tags
files string[] Yes Files to include
private boolean No Mark as private
eager boolean No Load at session start (skills/agents only)

Collection Fields

When using collections array:

Top-level (repository with collections):

  • name, version, description, author, license - Required
  • repository, organization - Recommended
  • Note: No format, subtype, or files required at top level

Each collection object:

Field Type Required Description
id string Yes Unique collection identifier (kebab-case, 3-100 chars)
name string Yes Display name (3-100 chars)
description string Yes What the collection provides (10-500 chars)
packages array Yes Array of packages to include (minimum 1)
version string Recommended Semantic version of collection
category string Recommended Collection category (development, testing, etc.)
tags string[] Recommended Searchable tags (kebab-case, 1-10 items)
icon string Optional Emoji or icon (max 10 chars)

Each package within collection:

Field Type Required Description
packageId string Yes Package to include
version string Optional Version range (^1.0.0, ~2.1.0, 1.0.0, latest)
required boolean Optional Whether package is required (default: true)
reason string Optional Why package is included (max 200 chars)

Format and Subtype Values

Format (Target AI Tool)

Format Description
claude Claude Code (agents, skills)
cursor Cursor IDE (rules, MDC files)
continue Continue.dev extension
windsurf Windsurf IDE
copilot GitHub Copilot
kiro Kiro IDE
agents.md Agents.md format
generic Generic/universal format
mcp Model Context Protocol

Subtype (Package Type)

Subtype Description Typical Formats
agent Autonomous agents claude, agents.md
skill Specialized capabilities claude
rule IDE rules and guidelines cursor, windsurf
slash-command Slash commands cursor, continue
prompt Prompt templates generic
collection Package collections Any
chatmode Chat modes kiro
tool MCP tools mcp

Eager vs Lazy Activation

Skills and agents can be configured to load eagerly (at session start) or lazily (on-demand when relevant).

When to Use Eager

Use eager: true when:

  • The skill should ALWAYS be active (coding standards, style guides)
  • Critical behavior that must never be skipped
  • Small, foundational skills with minimal token cost

Keep lazy (default) when:

  • Specialized skills for specific contexts
  • Large skills with significant token overhead
  • Skills that only apply to certain file types

Setting Eager in prpm.json

Package-level:

{
  "name": "code-style-enforcer",
  "version": "1.0.0",
  "format": "claude",
  "subtype": "skill",
  "eager": true,
  "files": [".claude/skills/code-style/SKILL.md"]
}

File-level (enhanced files format):

{
  "files": [
    {
      "path": ".claude/skills/critical-skill/SKILL.md",
      "format": "claude",
      "subtype": "skill",
      "eager": true
    },
    {
      "path": ".claude/skills/optional-skill/SKILL.md",
      "format": "claude",
      "subtype": "skill",
      "eager": false
    }
  ]
}

Precedence

When installing, the final eager setting is determined by:

  1. CLI flag (--eager/--lazy) - highest priority
  2. File-level eager setting (enhanced files)
  3. Package-level eager setting
  4. Default: lazy (false)

Applicable Subtypes

Subtype Supports Eager
skill Yes
agent Yes
rule No
slash-command No
hook No

Eager loading only affects progressive disclosure formats (agents.md, gemini.md, claude.md, aider).

Tags Best Practices

Tag Structure

  • Use kebab-case for all tags
  • Be specific and searchable
  • Include 3-8 tags per package
  • Combine technology, domain, and purpose tags

Tag Categories

Technology Tags:

  • Languages: typescript, python, javascript, rust
  • Frameworks: react, nextjs, fastify, django
  • Tools: aws, docker, kubernetes, postgresql

Domain Tags:

  • deployment, testing, ci-cd, database
  • infrastructure, cloud, monitoring
  • documentation, code-review, security

Purpose Tags:

  • troubleshooting, debugging, best-practices
  • automation, quality-assurance, performance
  • architecture, design-patterns

Meta Tags:

  • meta - For packages about creating packages
  • prpm-internal - For internal/private packages
  • prpm-development - For PRPM development itself

Tag Examples

Good Tags:

{
  "tags": ["typescript", "type-safety", "code-quality", "best-practices", "static-analysis"]
}

Poor Tags:

{
  "tags": [
    "code", // Too generic
    "stuff", // Meaningless
    "TypeScript", // Wrong case
    "type_safety" // Wrong format (use kebab-case)
  ]
}

Organization Best Practices

Multi-Package Organization

Order packages by:

  1. Privacy - Private packages first
  2. Format - Group by format (claude, cursor, etc.)
  3. Subtype - Group by subtype (agent, skill, rule)

Example organization:

{
  "packages": [
    // Private > Claude > Agents
    { "name": "internal-agent", "private": true, "format": "claude", "subtype": "agent" },

    // Private > Claude > Skills
    { "name": "internal-skill", "private": true, "format": "claude", "subtype": "skill" },

    // Private > Cursor > Rules
    { "name": "internal-rule", "private": true, "format": "cursor", "subtype": "rule" },

    // Public > Claude > Skills
    { "name": "public-skill", "format": "claude", "subtype": "skill" },

    // Public > Cursor > Rules
    { "name": "public-rule", "format": "cursor", "subtype": "rule" }
  ]
}

Naming Conventions

Package Names:

  • Use kebab-case: my-awesome-skill
  • Be descriptive: typescript-type-safety not ts-types
  • Avoid duplicates across formats: use suffixes if needed
    • format-conversion-agent (Claude agent)
    • format-conversion (Cursor rule)

File Paths:

  • Use full paths from project root (where prpm.json lives)
  • Agents: .claude/agents/name.md
  • Skills: .claude/skills/name/SKILL.md
  • Rules: .cursor/rules/name.mdc
  • Commands: .claude/commands/category/name.md

Version Management

Semver Guidelines

Follow semantic versioning:

  • Major (1.0.0 → 2.0.0): Breaking changes
  • Minor (1.0.0 → 1.1.0): New features, backward compatible
  • Patch (1.0.0 → 1.0.1): Bug fixes, backward compatible

Version Bumping

When to bump versions:

  • Patch: Bug fixes, typo corrections, minor improvements
  • Minor: New sections, additional examples, new features
  • Major: Complete rewrites, breaking changes, renamed fields

Keep Versions in Sync

For multi-package repos, keep related packages in sync:

{
  "packages": [
    { "name": "pkg-one", "version": "1.2.0" },
    { "name": "pkg-two", "version": "1.2.0" },
    { "name": "pkg-three", "version": "1.2.0" }
  ]
}

File Management

Files Array

CRITICAL: File paths must be full paths from project root (where prpm.json lives).

Required:

  • List all files to include in the package
  • Use full paths from project root - not relative to destination directories
  • Paths should start with .claude/, .cursor/, etc.
  • Include documentation files

Why Full Paths? File paths in prpm.json are used for:

  1. Tarball creation - Reads files directly from these paths
  2. Snippet extraction - Shows file preview before install
  3. Installation - CLI derives destination from format/subtype

Examples:

Claude agent (single file):

{
  "format": "claude",
  "subtype": "agent",
  "files": [".claude/agents/my-agent.md"]
}

Claude skill (multiple files):

{
  "format": "claude",
  "subtype": "skill",
  "files": [
    ".claude/skills/my-skill/SKILL.md",
    ".claude/skills/my-skill/EXAMPLES.md",
    ".claude/skills/my-skill/README.md"
  ]
}

Cursor rule:

{
  "format": "cursor",
  "subtype": "rule",
  "files": [".cursor/rules/my-rule.mdc"]
}

Slash command:

{
  "format": "claude",
  "subtype": "slash-command",
  "files": [".claude/commands/category/my-command.md"]
}

Enhanced File Format

Advanced: Files can be objects with metadata instead of simple strings. Useful for packages with multiple files targeting different formats or needing per-file metadata.

Enhanced file object structure:

{
  "files": [
    {
      "path": ".cursor/rules/typescript.mdc",
      "format": "cursor",
      "subtype": "rule",
      "name": "TypeScript Rules",
      "description": "TypeScript coding standards and best practices",
      "tags": ["typescript", "frontend"]
    },
    {
      "path": ".cursor/rules/python.mdc",
      "format": "cursor",
      "subtype": "rule",
      "name": "Python Rules",
      "description": "Python best practices for backend development",
      "tags": ["python", "backend"]
    }
  ]
}

When to use enhanced format:

  • Multi-file packages with different formats/subtypes per file
  • Need per-file descriptions or tags
  • Want to provide display names for individual files
  • Building collection packages with mixed content types

Enhanced file fields:

Field Required Description
path Yes Relative path to file from project root
format Yes File's target format (cursor, claude, etc.)
subtype No File's subtype (rule, skill, agent, etc.)
name No Display name for this file
description No Description of what this file does
tags No File-specific tags (array of strings)

Note: Cannot mix simple strings and objects in the same files array. Use all strings OR all objects, not both.

Common Mistake:

{
  // ❌ WRONG - Relative paths without directory prefix
  "files": ["agents/my-agent.md"]  // Will fail to find file

  // ✅ CORRECT - Full path from project root
  "files": [".claude/agents/my-agent.md"]
}

File Verification

Always verify files exist:

# Check all files in prpm.json exist
for file in $(cat prpm.json | jq -r '.packages[].files[]'); do
  if [ ! -f "$file" ]; then
    echo "Missing: $file"
  fi
done

Duplicate Detection

Check for Duplicate Names

Run this check before committing:

# Check for duplicate package names
cat prpm.json | jq -r '.packages[].name' | sort | uniq -d

If output is empty, no duplicates exist. If names appear, you have duplicates to resolve.

Resolving Duplicates

Bad:

{
  "packages": [
    { "name": "typescript-safety", "format": "claude" },
    { "name": "typescript-safety", "format": "cursor" }
  ]
}

Good:

{
  "packages": [
    { "name": "typescript-safety", "format": "claude", "subtype": "skill" },
    { "name": "typescript-safety-rule", "format": "cursor", "subtype": "rule" }
  ]
}

Conversion Hints (Advanced)

Purpose: Help improve quality when converting packages to other formats. The conversion field provides format-specific hints for cross-format transformations.

Note: This is an advanced feature primarily used by format conversion tools. Most packages don't need this.

Structure:

{
  "name": "my-package",
  "version": "1.0.0",
  "format": "claude",
  "conversion": {
    "cursor": {
      "alwaysApply": false,
      "priority": "high",
      "globs": ["**/*.ts", "**/*.tsx"]
    },
    "kiro": {
      "inclusion": "fileMatch",
      "fileMatchPattern": "**/*.ts",
      "domain": "typescript",
      "tools": ["fs_read", "fs_write"],
      "mcpServers": {
        "database": {
          "command": "mcp-server-postgres",
          "args": [],
          "env": {
            "DATABASE_URL": "${DATABASE_URL}"
          }
        }
      }
    },
    "copilot": {
      "applyTo": ["src/**", "lib/**"],
      "excludeAgent": "code-review"
    }
  }
}

Supported conversion hints:

Cursor Hints

{
  "conversion": {
    "cursor": {
      "alwaysApply": boolean,      // Whether rule should always apply
      "priority": "high|medium|low", // Rule priority level
      "globs": ["**/*.ts"]         // File patterns to auto-attach
    }
  }
}

Claude Hints

{
  "conversion": {
    "claude": {
      "model": "sonnet|opus|haiku|inherit", // Preferred model
      "tools": ["Read", "Write"], // Allowed tools
      "subagentType": "format-conversion" // Subagent type if agent
    }
  }
}

Kiro Hints

{
  "conversion": {
    "kiro": {
      "inclusion": "always|fileMatch|manual", // When to include
      "fileMatchPattern": "**/*.ts", // Pattern for fileMatch mode
      "domain": "typescript", // Domain category
      "tools": ["fs_read", "fs_write"], // Available tools
      "mcpServers": {
        // MCP server configs
        "database": {
          "command": "mcp-server-postgres",
          "args": [],
          "env": { "DATABASE_URL": "${DATABASE_URL}" }
        }
      }
    }
  }
}

Copilot Hints

{
  "conversion": {
    "copilot": {
      "applyTo": "src/**", // Path patterns
      "excludeAgent": "code-review|coding-agent" // Agent to exclude
    }
  }
}

Continue Hints

{
  "conversion": {
    "continue": {
      "alwaysApply": boolean,           // Always apply rule
      "globs": ["**/*.ts"],             // File patterns
      "regex": ["import.*from"]         // Regex patterns
    }
  }
}

Windsurf Hints

{
  "conversion": {
    "windsurf": {
      "characterLimit": 12000 // Warn if exceeding limit
    }
  }
}

Agents.md Hints

{
  "conversion": {
    "agentsMd": {
      "project": "my-project", // Project name
      "scope": "backend" // Scope/domain
    }
  }
}

When to use conversion hints:

  • Publishing cross-format packages that need specific settings per format
  • Format conversion tools need guidance on how to transform content
  • Package behavior should change based on target format
  • Want to preserve format-specific metadata during conversions

Common Patterns

Private Internal Packages

{
  "name": "internal-tool",
  "version": "1.0.0",
  "description": "Internal development tool",
  "private": true,
  "format": "claude",
  "subtype": "skill",
  "tags": ["prpm-internal", "development"],
  "files": [".claude/skills/internal-tool/SKILL.md"]
}

Meta Packages (Creating Other Packages)

{
  "name": "creating-skills",
  "version": "1.0.0",
  "description": "Guide for creating effective Claude Code skills",
  "format": "claude",
  "subtype": "skill",
  "tags": ["meta", "claude-code", "skills", "documentation", "best-practices"],
  "files": [".claude/skills/creating-skills/SKILL.md"]
}

Cross-Format Packages

When you have the same content for multiple formats:

{
  "packages": [
    {
      "name": "format-conversion-agent",
      "format": "claude",
      "subtype": "agent",
      "description": "Agent for converting between AI prompt formats",
      "files": [".claude/agents/format-conversion.md"]
    },
    {
      "name": "format-conversion",
      "format": "cursor",
      "subtype": "rule",
      "description": "Rule for converting between AI prompt formats",
      "files": [".cursor/rules/format-conversion.mdc"]
    }
  ]
}

Collections in prpm.json

Collections CAN be defined in prpm.json alongside packages using the collections array. Collections bundle multiple packages together for easier installation.

Example with both packages and collections:

{
  "name": "my-prompts-repo",
  "author": "Your Name",
  "license": "MIT",
  "packages": [
    {
      "name": "typescript-rules",
      "version": "1.0.0",
      "description": "TypeScript best practices",
      "format": "cursor",
      "subtype": "rule",
      "tags": ["typescript"],
      "files": [".cursor/rules/typescript.mdc"]
    }
  ],
  "collections": [
    {
      "id": "my-dev-setup",
      "name": "My Development Setup",
      "description": "Complete development setup with TypeScript and React",
      "version": "1.0.0",
      "category": "development",
      "tags": ["typescript", "react"],
      "packages": [
        {
          "packageId": "typescript-strict",
          "version": "^1.0.0",
          "required": true,
          "reason": "Enforces strict TypeScript type safety"
        },
        {
          "packageId": "react-best-practices",
          "version": "^2.0.0",
          "required": true
        }
      ]
    }
  ]
}

For more details on creating collections, see the PRPM documentation at https://docs.prpm.dev or run prpm help collections.

Summary: prpm.json can contain both packages (skills, agents, rules, slash-commands, etc.) and collections.

Lifecycle Scripts

IMPORTANT: The scripts field only applies to multi-package manifests (prpm.json with a packages array). It does NOT work in single-package manifests.

Use the scripts field to run commands automatically during package operations, particularly for building TypeScript hooks before publishing.

When to Use Scripts

Primary use case: Building TypeScript Hooks

If your packages include Claude Code hooks written in TypeScript, you MUST build them to JavaScript before publishing:

{
  "name": "my-packages",
  "license": "MIT",
  "scripts": {
    "prepublishOnly": "cd packages/hooks && npm run build"
  },
  "packages": [
    {
      "name": "my-hook",
      "version": "1.0.0",
      "format": "claude",
      "subtype": "hook",
      "files": [
        ".claude/hooks/my-hook/hook.ts",
        ".claude/hooks/my-hook/hook.json",
        ".claude/hooks/my-hook/dist/hook.js"
      ]
    }
  ]
}

Available Script Types

Script When it Runs Use Case
prepublishOnly Before prpm publish only Recommended - Build hooks, compile assets
prepublish Before publish AND on npm install Not recommended - causes unexpected builds

Always use prepublishOnly instead of prepublish to avoid running builds when users install your packages.

prepublishOnly Examples

Single hook:

{
  "scripts": {
    "prepublishOnly": "cd .claude/hooks/my-hook && npm run build"
  }
}

Multiple hooks:

{
  "scripts": {
    "prepublishOnly": "cd .claude/hooks/hook-one && npm run build && cd ../hook-two && npm run build"
  }
}

With tests:

{
  "scripts": {
    "prepublishOnly": "npm test && cd packages/hooks && npm run build"
  }
}

What Happens During Publishing

When you run prpm publish:

  1. PRPM checks for scripts.prepublishOnly in your prpm.json
  2. If found, runs the script from the directory containing prpm.json
  3. If script succeeds (exit code 0), publishing continues
  4. If script fails (non-zero exit code), publishing is aborted

Script execution details:

  • Working directory: Same directory as prpm.json
  • Timeout: 5 minutes (300,000ms) default
  • Environment: Inherits your shell's environment variables
  • Output: Shown in real-time

Best Practices for Scripts

DO:

  • ✅ Use prepublishOnly for building hooks
  • ✅ Chain commands with && for dependencies: npm test && npm run build
  • ✅ Keep scripts fast (under 1 minute if possible)
  • ✅ Test scripts locally before publishing

DON'T:

  • ❌ Use prepublish (runs on install too)
  • ❌ Forget to build hooks before publishing
  • ❌ Use scripts in single-package manifests (not supported)
  • ❌ Put long-running operations in scripts

Common Patterns

Hooks in packages/ directory:

{
  "scripts": {
    "prepublishOnly": "cd packages/hooks && npm run build"
  }
}

Hooks in .claude/ directory:

{
  "scripts": {
    "prepublishOnly": "cd .claude/hooks/my-hook && npm run build"
  }
}

Build multiple components:

{
  "scripts": {
    "prepublishOnly": "npm run build:hooks && npm run build:assets"
  }
}

Debugging Script Failures

If your prepublishOnly script fails:

  1. Check the output - Error messages show what went wrong
  2. Run manually - Test the exact command in your terminal
  3. Verify working directory - Scripts run from prpm.json location
  4. Check dependencies - Ensure npm packages are installed

Example debugging:

# Test your prepublishOnly script manually
cd /path/to/prpm.json/directory
cd packages/hooks && npm run build

# If it works manually but fails in PRPM, check:
# - Working directory assumptions
# - Environment variables
# - Installed dependencies

Why This Matters

Without prepublishOnly:

  • You might forget to build hooks before publishing
  • Published packages contain stale/outdated JavaScript
  • Users install broken hooks
  • Manual builds are error-prone

With prepublishOnly:

  • Hooks automatically build before every publish
  • JavaScript always matches TypeScript source
  • Prevents publishing broken code
  • Consistent, reliable publishing workflow

Validation Checklist

Before publishing, verify:

Required Fields:

  • All packages have name, version, description
  • All packages have format and subtype
  • All packages have files array
  • Top-level has author and license

File Verification:

  • All files in files arrays exist
  • File paths are relative to repo root
  • No missing or broken file references

No Duplicates:

  • No duplicate package names
  • Package names are unique across entire manifest

Tags:

  • Tags use kebab-case
  • 3-8 relevant tags per package
  • Tags include technology, domain, and purpose

Organization:

  • Private packages listed first
  • Packages grouped by format and subtype
  • Consistent versioning across related packages

Lockfile Management

Understanding prpm.lock

The prpm.lock file is auto-generated and tracks installed packages. It serves as the source of truth for what's installed in your project.

IMPORTANT: Do NOT add packages to prpm.json if they already exist in prpm.lock:

  • prpm.lock tracks installed dependencies (packages you use)
  • prpm.json defines published packages (packages you create and share)

When to Use prpm.json vs prpm.lock

Use prpm.json when:

  • You're creating a package to publish to the registry
  • You want to define metadata for YOUR packages
  • You're setting up a multi-package repository

Use prpm.lock (auto-generated) when:

  • You install packages with prpm install
  • You want to track which packages are installed
  • You want reproducible installations across environments

Common Mistake: Duplicating Dependencies

❌ WRONG - Don't add installed packages to prpm.json:

// prpm.json
{
  "name": "my-project",
  "packages": [
    {
      "name": "typescript-safety", // ❌ This is an INSTALLED package
      "version": "1.0.0",
      "format": "cursor",
      "subtype": "rule",
      "files": [".cursor/rules/typescript-safety.mdc"]
    }
  ]
}
// prpm.lock (auto-generated)
{
  "packages": {
    "@prpm/typescript-safety": {
      // ✅ Already tracked here
      "version": "1.0.0",
      "format": "cursor",
      "subtype": "rule"
    }
  }
}

✅ CORRECT - prpm.json only for YOUR packages:

// prpm.json - Only YOUR packages you're publishing
{
  "name": "my-project",
  "packages": [
    {
      "name": "my-custom-rule", // ✅ This is YOUR package
      "version": "1.0.0",
      "format": "cursor",
      "subtype": "rule",
      "files": [".cursor/rules/my-custom-rule.mdc"]
    }
  ]
}
// prpm.lock - Installed dependencies (auto-generated)
{
  "packages": {
    "@prpm/typescript-safety": {
      // ✅ Installed from registry
      "version": "1.0.0",
      "format": "cursor",
      "subtype": "rule"
    }
  }
}

Key Principles

  1. Lockfile is Auto-Generated - Never manually edit prpm.lock
  2. Separation of Concerns:
    • prpm.json = What you PUBLISH
    • prpm.lock = What you INSTALL
  3. Check Lockfile First - Before adding to prpm.json, check if it's already in prpm.lock
  4. Trust the Lockfile - It's the authoritative record of installed packages

Workflow Example

# Install a package (updates prpm.lock automatically)
prpm install @prpm/typescript-safety

# This creates/updates prpm.lock - DO NOT add to prpm.json!

# Only create prpm.json entries for packages YOU create:
# 1. Create your custom rule/skill/agent
# 2. Add entry to prpm.json
# 3. Publish with: prpm publish

Publishing Workflow

1. Validate Manifest

# Validate JSON syntax
cat prpm.json | jq . > /dev/null

# Check for duplicates
cat prpm.json | jq -r '.packages[].name' | sort | uniq -d

# Verify files exist
# (see File Verification section)

2. Bump Versions

Update version numbers for changed packages.

3. Test Locally

# Test package installation
prpm install . --dry-run

4. Publish

# Publish all packages
prpm publish

# Or publish specific package
prpm publish --package my-skill

Common Mistakes to Avoid

❌ Missing Required Fields

{
  "name": "my-skill"
  // Missing: version, description, format, subtype, files
}

❌ Wrong Tag Format

{
  "tags": ["TypeScript", "Code_Quality", "bestPractices"]
  // Should be: ["typescript", "code-quality", "best-practices"]
}

❌ Duplicate Names

{
  "packages": [
    { "name": "my-skill", "format": "claude" },
    { "name": "my-skill", "format": "cursor" }
    // Second should be: "my-skill-rule" or similar
  ]
}

❌ Missing Files

{
  "files": [".claude/skills/my-skill/SKILL.md"]
  // But .claude/skills/my-skill/SKILL.md doesn't exist in the repo
}

❌ Absolute Paths

{
  "files": ["/Users/me/project/.claude/skills/my-skill/SKILL.md"]
  // Should be: ".claude/skills/my-skill/SKILL.md" (relative to project root)
}

❌ Missing Directory Prefix

{
  "files": ["agents/my-agent.md"]
  // Should be: ".claude/agents/my-agent.md" (include .claude/ prefix)
}

Remember

  • prpm.json is only for publishing YOUR packages/collections, not for installed dependencies
  • Never add packages from prpm.lock to prpm.json - they serve different purposes
  • prpm.lock tracks what you INSTALL, prpm.json defines what you PUBLISH
  • Use collections array to bundle existing packages (references by packageId)
  • Use packages array to define packages with files
  • Can combine both packages and collections in same repo
  • Always validate before committing
  • Keep versions in sync for related packages
  • Use consistent, searchable tags
  • Verify all file paths exist
  • Check for duplicate names
  • Follow semver for version management

Goal: Create maintainable, well-organized package manifests and curated collections that are easy to publish and discover in the PRPM registry.

Files (relay)
  • examples
    • collections-repository.json 1.2 KB
      {
        "name": "@prpm/collections",
        "version": "1.0.0",
        "description": "Official PRPM collections for popular development workflows",
        "author": "PRPM Team",
        "license": "MIT",
        "repository": "https://github.com/prpm/collections",
        "organization": "prpm",
        "collections": [
          {
            "id": "nextjs-pro",
            "name": "Next.js Professional Setup",
            "description": "Complete Next.js development environment with TypeScript, React best practices, and modern tooling",
            "version": "1.0.0",
            "category": "development",
            "tags": ["nextjs", "react", "typescript", "frontend"],
            "icon": "⚡",
            "packages": [
              {
                "packageId": "react-best-practices",
                "version": "^2.0.0",
                "required": true,
                "reason": "Core React patterns and component guidelines"
              },
              {
                "packageId": "typescript-strict",
                "version": "latest",
                "required": true,
                "reason": "TypeScript strict mode for type safety"
              },
              {
                "packageId": "tailwind-helper",
                "version": "^1.5.0",
                "required": false,
                "reason": "Optional Tailwind CSS utilities"
              }
            ]
          }
        ]
      }
      
    • multi-package.json 744 B
      {
        "name": "prpm-packages",
        "version": "1.0.0",
        "author": "yourgithubusername",
        "license": "MIT",
        "repository": "https://github.com/yourgithubusername/repo",
        "organization": "your-org",
        "packages": [
          {
            "name": "package-one",
            "version": "1.0.0",
            "description": "Description of package one",
            "private": true,
            "format": "claude",
            "subtype": "agent",
            "tags": ["tag1", "tag2"],
            "files": [".claude/agents/package-one.md"]
          },
          {
            "name": "package-two",
            "version": "1.0.0",
            "description": "Description of package two",
            "format": "cursor",
            "subtype": "rule",
            "tags": ["tag1", "tag3"],
            "files": [".cursor/rules/package-two.mdc"]
          }
        ]
      }
      
    • packages-with-collections.json 1.4 KB
      {
        "name": "@username/my-prompts-repo",
        "author": "yourgithubusername",
        "license": "MIT",
        "repository": "https://github.com/username/my-collection",
        "packages": [
          {
            "name": "tdd-skill",
            "version": "1.0.0",
            "description": "Guides you through TDD workflow",
            "format": "claude",
            "subtype": "skill",
            "tags": ["testing", "tdd"],
            "files": [".claude/skills/tdd.md"]
          },
          {
            "name": "typescript-rules",
            "version": "1.0.0",
            "description": "Best practices for TypeScript development",
            "format": "cursor",
            "subtype": "rule",
            "tags": ["typescript", "frontend"],
            "files": [".cursor/rules/typescript.mdc"]
          }
        ],
        "collections": [
          {
            "id": "testing-suite",
            "name": "Complete Testing Suite",
            "description": "A collection of testing tools and best practices for TDD",
            "version": "1.0.0",
            "category": "testing",
            "tags": ["testing", "tdd", "productivity"],
            "icon": "🧪",
            "packages": [
              {
                "packageId": "tdd-skill",
                "version": "^1.0.0",
                "required": true,
                "reason": "Essential TDD workflow guidance"
              },
              {
                "packageId": "@external/test-runner",
                "version": "^2.0.0",
                "required": false,
                "reason": "Optional external test runner"
              }
            ]
          }
        ]
      }
      
    • single-package.json 435 B
      {
        "name": "my-awesome-skill",
        "version": "1.0.0",
        "description": "Clear, concise description of what this package does",
        "author": "yourgithubusername",
        "license": "MIT",
        "repository": "https://github.com/yourgithubusername/repo",
        "organization": "your-org",
        "format": "claude",
        "subtype": "skill",
        "tags": ["typescript", "best-practices", "code-quality"],
        "files": [".claude/skills/my-awesome-skill/SKILL.md"]
      }
      
  • prpm-manifest.schema.json 20 KB
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "$id": "https://prpm.dev/schemas/manifest.json",
      "title": "PRPM Package Manifest",
      "description": "Schema for PRPM package manifest (prpm.json)",
      "type": "object",
      "required": ["name", "version", "description", "format"],
      "properties": {
        "name": {
          "type": "string",
          "description": "Package name in format: package-name or @scope/package-name",
          "pattern": "^(@[a-z0-9-]+\\/)?[a-z0-9-]+$",
          "minLength": 1,
          "maxLength": 214,
          "examples": ["react-rules", "@community/testing-skills", "@company/cursor-rules"]
        },
        "version": {
          "type": "string",
          "description": "Semantic version (semver)",
          "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$",
          "examples": ["1.0.0", "2.1.3", "1.0.0-beta.1"]
        },
        "description": {
          "type": "string",
          "description": "Package description",
          "minLength": 10,
          "maxLength": 500
        },
        "format": {
          "type": "string",
          "description": "Package format - the AI tool/platform this package is for",
          "enum": [
            "cursor",
            "claude",
            "claude-plugin",
            "continue",
            "windsurf",
            "copilot",
            "kiro",
            "agents.md",
            "generic",
            "mcp"
          ]
        },
        "subtype": {
          "type": "string",
          "description": "Package subtype - the functional category (optional, defaults to 'rule')",
          "enum": [
            "rule",
            "agent",
            "skill",
            "slash-command",
            "prompt",
            "workflow",
            "tool",
            "template",
            "collection",
            "chatmode",
            "hook",
            "plugin",
            "server"
          ]
        },
        "author": {
          "description": "Package author",
          "oneOf": [
            {
              "type": "string",
              "examples": ["John Doe", "Jane Smith"]
            },
            {
              "type": "object",
              "required": ["name"],
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Author name"
                },
                "email": {
                  "type": "string",
                  "format": "email",
                  "description": "Author email"
                },
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Author URL"
                }
              }
            }
          ]
        },
        "license": {
          "type": "string",
          "description": "SPDX license identifier",
          "examples": ["MIT", "Apache-2.0", "GPL-3.0", "BSD-3-Clause"]
        },
        "license_text": {
          "type": "string",
          "description": "Full text of the license file for proper attribution"
        },
        "license_url": {
          "type": "string",
          "format": "uri",
          "description": "URL to the license file in the repository"
        },
        "repository": {
          "type": "string",
          "format": "uri",
          "description": "Repository URL",
          "examples": ["https://github.com/username/repo"]
        },
        "homepage": {
          "type": "string",
          "format": "uri",
          "description": "Package homepage URL"
        },
        "documentation": {
          "type": "string",
          "format": "uri",
          "description": "Documentation URL"
        },
        "organization": {
          "type": "string",
          "description": "Organization name or ID to publish this package under. If not specified, publishes to personal account.",
          "examples": ["my-team", "my-company"]
        },
        "private": {
          "type": "boolean",
          "description": "Whether the package is private. Private packages are only accessible to the owner/organization members. Defaults to false (public).",
          "default": false
        },
        "eager": {
          "type": "boolean",
          "description": "Whether this package should be loaded eagerly (at session start) or lazily (on-demand). Only applies to skills and agents in progressive disclosure formats (AGENTS.md, GEMINI.md, etc.). Defaults to false (lazy loading).",
          "default": false,
          "examples": [true, false]
        },
        "scripts": {
          "type": "object",
          "description": "Lifecycle scripts that run during package operations. Only applies to multi-package manifests (prpm.json with packages array).",
          "properties": {
            "prepublishOnly": {
              "type": "string",
              "description": "Script to run before publishing (recommended - only runs on 'prpm publish')",
              "examples": ["npm run build", "cd packages/hooks && npm run build", "npm test && npm run build"]
            },
            "prepublish": {
              "type": "string",
              "description": "Script to run before publishing and on npm install (not recommended - use prepublishOnly instead)",
              "examples": ["npm run build"]
            }
          },
          "additionalProperties": false
        },
        "tags": {
          "type": "array",
          "description": "Package tags for categorization",
          "items": {
            "type": "string"
          },
          "maxItems": 10,
          "uniqueItems": true,
          "examples": [
            ["productivity", "coding"],
            ["testing", "quality"]
          ]
        },
        "keywords": {
          "type": "array",
          "description": "Search keywords",
          "items": {
            "type": "string"
          },
          "maxItems": 20,
          "uniqueItems": true,
          "examples": [["ai", "prompts", "development"]]
        },
        "category": {
          "type": "string",
          "description": "Package category",
          "examples": ["development", "productivity", "testing"]
        },
        "files": {
          "description": "Files to include in package. Can be simple paths or enhanced file objects with metadata.",
          "oneOf": [
            {
              "type": "array",
              "description": "Simple format: array of file paths",
              "items": {
                "type": "string"
              },
              "minItems": 1,
              "examples": [
                ["skill.md", "README.md"],
                [".cursor/rules/react.mdc", "LICENSE"]
              ]
            },
            {
              "type": "array",
              "description": "Enhanced format: array of file objects with metadata",
              "items": {
                "type": "object",
                "required": ["path", "format"],
                "properties": {
                  "path": {
                    "type": "string",
                    "description": "Relative path to file",
                    "examples": [
                      ".claude/skills/tdd.md",
                      ".cursor/rules/react.mdc",
                      ".continue/rules/python.json"
                    ]
                  },
                  "format": {
                    "type": "string",
                    "description": "File format - the AI tool/platform this file is for",
                    "enum": [
                      "cursor",
                      "claude",
                      "claude-plugin",
                      "continue",
                      "windsurf",
                      "copilot",
                      "kiro",
                      "agents.md",
                      "generic",
                      "mcp"
                    ]
                  },
                  "subtype": {
                    "type": "string",
                    "description": "File subtype - the functional category",
                    "enum": [
                      "rule",
                      "agent",
                      "skill",
                      "slash-command",
                      "prompt",
                      "workflow",
                      "tool",
                      "template",
                      "collection",
                      "chatmode",
                      "hook",
                      "plugin",
                      "server"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "description": "Display name for this file",
                    "examples": ["React Rules", "Test-Driven Development"]
                  },
                  "description": {
                    "type": "string",
                    "description": "Description of what this file does"
                  },
                  "tags": {
                    "type": "array",
                    "description": "File-specific tags",
                    "items": {
                      "type": "string"
                    },
                    "uniqueItems": true,
                    "examples": [
                      ["react", "typescript"],
                      ["testing", "tdd"]
                    ]
                  },
                  "eager": {
                    "type": "boolean",
                    "description": "File-level eager setting. Overrides package-level eager for this specific file.",
                    "default": false
                  }
                },
                "additionalProperties": false
              },
              "minItems": 1
            }
          ]
        },
        "main": {
          "type": "string",
          "description": "Main entry file (for single-file packages)",
          "examples": ["index.md", "skill.md"]
        },
        "dependencies": {
          "type": "object",
          "description": "Package dependencies",
          "patternProperties": {
            "^(@[a-z0-9-]+\\/)?[a-z0-9-]+$": {
              "type": "string",
              "pattern": "^(\\^|~)?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$"
            }
          },
          "additionalProperties": false,
          "examples": [
            {
              "@pr-pm/utils": "^1.0.0",
              "common-rules": "~2.1.0"
            }
          ]
        },
        "peerDependencies": {
          "type": "object",
          "description": "Peer dependencies (packages that should be installed alongside)",
          "patternProperties": {
            "^(@[a-z0-9-]+\\/)?[a-z0-9-]+$": {
              "type": "string"
            }
          },
          "additionalProperties": false
        },
        "engines": {
          "type": "object",
          "description": "Required engine versions",
          "properties": {
            "prpm": {
              "type": "string",
              "description": "Required PRPM version"
            },
            "node": {
              "type": "string",
              "description": "Required Node.js version"
            }
          },
          "additionalProperties": false,
          "examples": [
            {
              "prpm": ">=1.0.0",
              "node": ">=18.0.0"
            }
          ]
        },
        "packages": {
          "type": "array",
          "description": "Array of packages to publish from a single manifest (multi-package publishing). Packages inherit top-level fields unless overridden.",
          "items": {
            "$ref": "#"
          },
          "minItems": 1
        },
        "collections": {
          "type": "array",
          "description": "Array of collections to publish. Collections bundle multiple packages together for easier installation.",
          "items": {
            "type": "object",
            "required": ["id", "name", "description", "packages"],
            "properties": {
              "id": {
                "type": "string",
                "description": "Unique collection identifier (kebab-case)",
                "pattern": "^[a-z0-9-]+$",
                "minLength": 3,
                "maxLength": 100,
                "examples": ["nextjs-complete", "fullstack-setup", "react-essentials"]
              },
              "name": {
                "type": "string",
                "description": "Display name of the collection",
                "minLength": 3,
                "maxLength": 100,
                "examples": ["Next.js Complete", "Full Stack Setup"]
              },
              "description": {
                "type": "string",
                "description": "What this collection provides",
                "minLength": 10,
                "maxLength": 500
              },
              "version": {
                "type": "string",
                "description": "Semantic version of the collection",
                "pattern": "^\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$",
                "examples": ["1.0.0", "2.1.0"]
              },
              "category": {
                "type": "string",
                "description": "Collection category",
                "enum": [
                  "development",
                  "testing",
                  "deployment",
                  "data-science",
                  "devops",
                  "design",
                  "documentation",
                  "security",
                  "performance",
                  "general"
                ],
                "examples": ["development", "testing"]
              },
              "tags": {
                "type": "array",
                "description": "Tags for discoverability (kebab-case)",
                "items": {
                  "type": "string",
                  "pattern": "^[a-z0-9-]+$"
                },
                "minItems": 1,
                "maxItems": 10,
                "examples": [
                  ["react", "typescript", "nextjs"],
                  ["python", "data-science", "ml"]
                ]
              },
              "icon": {
                "type": "string",
                "description": "Emoji or icon for the collection",
                "maxLength": 10,
                "examples": ["⚛️", "🚀", "📦"]
              },
              "packages": {
                "type": "array",
                "description": "Array of packages included in this collection",
                "items": {
                  "type": "object",
                  "required": ["packageId"],
                  "properties": {
                    "packageId": {
                      "type": "string",
                      "description": "Package identifier to include",
                      "minLength": 1,
                      "examples": ["typescript-strict", "react-best-practices"]
                    },
                    "version": {
                      "type": "string",
                      "description": "Version range (semver) or 'latest'",
                      "examples": ["^1.0.0", "~2.1.0", "1.0.0", "latest"]
                    },
                    "required": {
                      "type": "boolean",
                      "description": "Whether this package is required (true) or optional (false)",
                      "default": true
                    },
                    "reason": {
                      "type": "string",
                      "description": "Explanation of why this package is included",
                      "maxLength": 200,
                      "examples": ["Enforces strict TypeScript type safety", "React component best practices"]
                    }
                  }
                },
                "minItems": 1
              }
            }
          },
          "minItems": 1
        }
      },
      "additionalProperties": false,
      "examples": [
        {
          "name": "@username/simple-package",
          "version": "1.0.0",
          "description": "A simple package with basic files",
          "format": "claude",
          "subtype": "skill",
          "author": "Your Name",
          "license": "MIT",
          "files": ["skill.md", "README.md"]
        },
        {
          "name": "@company/coding-standards",
          "version": "1.0.0",
          "description": "Team coding standards that must be active in every session",
          "format": "claude",
          "subtype": "skill",
          "author": "Company Team",
          "organization": "my-company",
          "license": "MIT",
          "eager": true,
          "files": [".claude/skills/coding-standards/SKILL.md"]
        },
        {
          "name": "@company/team-package",
          "version": "1.0.0",
          "description": "A package published under organization account",
          "format": "cursor",
          "author": "Team Name",
          "organization": "my-company",
          "license": "MIT",
          "files": [".cursor/rules/guidelines.mdc", "README.md"]
        },
        {
          "name": "@username/cursor-rules",
          "version": "1.0.0",
          "description": "Multiple Cursor rules for different languages",
          "format": "cursor",
          "author": {
            "name": "Your Name",
            "email": "you@example.com"
          },
          "license": "MIT",
          "repository": "https://github.com/username/cursor-rules",
          "tags": ["cursor", "rules", "multi-language"],
          "files": [
            {
              "path": ".cursor/rules/typescript.mdc",
              "format": "cursor",
              "name": "TypeScript Rules",
              "tags": ["typescript", "frontend"]
            },
            {
              "path": ".cursor/rules/python.mdc",
              "format": "cursor",
              "name": "Python Rules",
              "tags": ["python", "backend"]
            }
          ]
        },
        {
          "name": "@community/testing-suite",
          "version": "2.0.0",
          "description": "Complete testing suite with skills and agents",
          "format": "generic",
          "subtype": "collection",
          "author": "Community",
          "license": "MIT",
          "tags": ["testing", "quality"],
          "files": [
            {
              "path": ".claude/skills/tdd.md",
              "format": "claude",
              "subtype": "skill",
              "name": "Test-Driven Development"
            },
            {
              "path": ".claude/agents/test-generator.md",
              "format": "claude",
              "subtype": "agent",
              "name": "Test Generator"
            }
          ]
        },
        {
          "name": "@username/copilot-instructions",
          "version": "1.0.0",
          "description": "GitHub Copilot instructions for API development",
          "format": "copilot",
          "author": "Your Name",
          "license": "MIT",
          "tags": ["copilot", "api", "backend"],
          "files": ["api-guidelines.md"]
        },
        {
          "name": "@username/kiro-steering",
          "version": "1.0.0",
          "description": "Kiro steering file for testing standards",
          "format": "kiro",
          "author": "Your Name",
          "license": "MIT",
          "tags": ["kiro", "testing", "quality"],
          "files": ["testing.md"]
        },
        {
          "name": "@username/windsurf-rules",
          "version": "1.0.0",
          "description": "Windsurf coding rules for React projects",
          "format": "windsurf",
          "author": "Your Name",
          "license": "MIT",
          "tags": ["windsurf", "react", "frontend"],
          "files": [".windsurfrules"]
        },
        {
          "name": "@company/private-package",
          "version": "1.0.0",
          "description": "A private package only accessible to organization members",
          "format": "claude",
          "subtype": "skill",
          "author": "Company Team",
          "organization": "my-company",
          "private": true,
          "license": "Proprietary",
          "files": ["internal-skill.md", "README.md"]
        },
        {
          "name": "@username/multi-package-example",
          "version": "1.0.0",
          "description": "Multi-package manifest example",
          "author": "Your Name",
          "license": "MIT",
          "repository": "https://github.com/username/multi-package",
          "packages": [
            {
              "name": "@username/package-one",
              "version": "1.0.0",
              "description": "First package in the multi-package manifest",
              "format": "claude",
              "subtype": "skill",
              "files": ["package-one/SKILL.md"]
            },
            {
              "name": "@username/package-two",
              "version": "1.0.0",
              "description": "Second package with different settings",
              "format": "cursor",
              "private": true,
              "files": ["package-two/.cursor/rules/main.mdc"]
            }
          ]
        },
        {
          "name": "@username/multi-package-with-collection",
          "version": "1.0.0",
          "description": "Repository with both packages and a collection",
          "author": "Your Name",
          "license": "MIT",
          "packages": [
            {
              "name": "typescript-rules",
              "version": "1.0.0",
              "description": "TypeScript coding standards",
              "format": "cursor",
              "subtype": "rule",
              "tags": ["typescript", "cursor"],
              "files": [".cursor/rules/typescript.mdc"]
            },
            {
              "name": "react-patterns",
              "version": "1.0.0",
              "description": "React best practices",
              "format": "claude",
              "subtype": "skill",
              "tags": ["react", "best-practices"],
              "files": [".claude/skills/react-patterns/SKILL.md"]
            }
          ],
          "collections": [
            {
              "id": "fullstack-setup",
              "name": "Full Stack Setup",
              "description": "Complete full-stack development setup with TypeScript and React",
              "version": "1.0.0",
              "category": "development",
              "tags": ["typescript", "react", "fullstack"],
              "icon": "🚀",
              "packages": [
                {
                  "packageId": "typescript-rules",
                  "version": "^1.0.0",
                  "required": true,
                  "reason": "TypeScript coding standards for the project"
                },
                {
                  "packageId": "react-patterns",
                  "version": "^1.0.0",
                  "required": true,
                  "reason": "React component best practices"
                }
              ]
            }
          ]
        }
      ]
    }
    
  • SKILL.md 34.5 KB
    ---
    name: prpm-json-best-practices
    description: Best practices for structuring prpm.json package manifests with required fields, tags, organization, multi-package management, enhanced file format, eager/lazy activation, and conversion hints
    ---
    
    # PRPM JSON Best Practices
    
    You are an expert at creating and maintaining `prpm.json` package manifests for PRPM (Prompt Package Manager). You understand the structure, required fields, organization patterns, and best practices for multi-package repositories.
    
    ## When to Apply This Skill
    
    **Use when:**
    
    - Creating a new `prpm.json` manifest for publishing packages
    - Maintaining existing `prpm.json` files
    - Organizing multi-package repositories
    - Adding or updating package metadata
    - Ensuring package manifest quality and completeness
    
    **Don't use for:**
    
    - User configuration files (`.prpmrc`) - those are for users
    - Lockfiles (`prpm.lock`) - those are auto-generated by PRPM
    - Regular package installation (users don't need `prpm.json`)
    - Dependencies already tracked in lockfiles
    
    ## Core Purpose
    
    `prpm.json` is **only needed if you're publishing packages**. Regular users installing packages from the registry don't need this file.
    
    Use `prpm.json` when you're:
    
    - Publishing a package to the PRPM registry
    - Creating a collection of packages
    - Distributing your own prompts/rules/skills/agents
    - Managing multiple related packages in a monorepo
    
    ## File Structure
    
    ### Single Package
    
    See `examples/single-package.json` for complete structure.
    
    **Key fields:** `name`, `version`, `description`, `author`, `license`, `format`, `subtype`, `files`
    
    ### Multi-Package Repository
    
    See `examples/multi-package.json` for complete structure.
    
    **Use when:** Publishing multiple related packages from one repo
    **Key difference:** Top-level `packages` array with individual package definitions
    
    ### Collections Repository
    
    See `examples/collections-repository.json` for complete structure.
    
    **Use when:** Bundling existing published packages into curated collections
    **Key points:**
    
    - `collections` array references packages by `packageId` (not files)
    - Each collection has `id`, `name`, `description`, `packages`
    - Packages can be `required: true` (default) or `false` (optional)
    - Use version ranges (`^1.0.0`) or `latest`
    - Add `reason` to explain why package is included
    
    ### Packages + Collections (Combined)
    
    See `examples/packages-with-collections.json` for complete structure.
    
    **Use when:** Publishing packages AND creating collections that bundle them
    **Key points:**
    
    - Define packages in `packages` array with files
    - Define collections in `collections` array referencing those packages
    - Collections can reference both local packages and external ones
    - Publish both individual packages and collection bundles from same repo
    
    ## Required Fields
    
    ### Top-Level (Single Package)
    
    | Field         | Type     | Required | Description                                                                     |
    | ------------- | -------- | -------- | ------------------------------------------------------------------------------- |
    | `name`        | string   | **Yes**  | Package name (kebab-case, unique in registry)                                   |
    | `version`     | string   | **Yes**  | Semver version (e.g., `1.0.0`)                                                  |
    | `description` | string   | **Yes**  | Clear description of what the package does                                      |
    | `author`      | string   | **Yes**  | Author name and optional email                                                  |
    | `license`     | string   | **Yes**  | SPDX license identifier (e.g., `MIT`, `Apache-2.0`)                             |
    | `format`      | string   | **Yes**  | Target format: `claude`, `cursor`, `continue`, `windsurf`, etc.                 |
    | `subtype`     | string   | **Yes**  | Package type: `agent`, `skill`, `rule`, `slash-command`, `prompt`, `collection` |
    | `files`       | string[] | **Yes**  | Array of files to include in package                                            |
    
    ### Optional Top-Level Fields
    
    | Field           | Type     | Description                                                   |
    | --------------- | -------- | ------------------------------------------------------------- |
    | `repository`    | string   | Git repository URL                                            |
    | `organization`  | string   | Organization name (for scoped packages)                       |
    | `homepage`      | string   | Package homepage URL                                          |
    | `documentation` | string   | Documentation URL                                             |
    | `license_text`  | string   | Full text of the license file for proper attribution          |
    | `license_url`   | string   | URL to the license file in the repository                     |
    | `tags`          | string[] | Searchable tags (kebab-case)                                  |
    | `keywords`      | string[] | Additional keywords for search                                |
    | `category`      | string   | Package category                                              |
    | `private`       | boolean  | If `true`, won't be published to public registry              |
    | `dependencies`  | object   | Package dependencies (name: semver)                           |
    | `scripts`       | object   | Lifecycle scripts (multi-package only)                        |
    | `eager`         | boolean  | If `true`, skill/agent loads at session start (not on-demand) |
    
    ### Multi-Package Fields
    
    When using `packages` array:
    
    | Field         | Type     | Required    | Description                                |
    | ------------- | -------- | ----------- | ------------------------------------------ |
    | `name`        | string   | **Yes**     | Unique package name                        |
    | `version`     | string   | **Yes**     | Package version                            |
    | `description` | string   | **Yes**     | Package description                        |
    | `format`      | string   | **Yes**     | Package format                             |
    | `subtype`     | string   | **Yes**     | Package subtype                            |
    | `tags`        | string[] | Recommended | Searchable tags                            |
    | `files`       | string[] | **Yes**     | Files to include                           |
    | `private`     | boolean  | No          | Mark as private                            |
    | `eager`       | boolean  | No          | Load at session start (skills/agents only) |
    
    ### Collection Fields
    
    When using `collections` array:
    
    **Top-level (repository with collections):**
    
    - `name`, `version`, `description`, `author`, `license` - **Required**
    - `repository`, `organization` - Recommended
    - Note: No `format`, `subtype`, or `files` required at top level
    
    **Each collection object:**
    
    | Field         | Type     | Required    | Description                                            |
    | ------------- | -------- | ----------- | ------------------------------------------------------ |
    | `id`          | string   | **Yes**     | Unique collection identifier (kebab-case, 3-100 chars) |
    | `name`        | string   | **Yes**     | Display name (3-100 chars)                             |
    | `description` | string   | **Yes**     | What the collection provides (10-500 chars)            |
    | `packages`    | array    | **Yes**     | Array of packages to include (minimum 1)               |
    | `version`     | string   | Recommended | Semantic version of collection                         |
    | `category`    | string   | Recommended | Collection category (development, testing, etc.)       |
    | `tags`        | string[] | Recommended | Searchable tags (kebab-case, 1-10 items)               |
    | `icon`        | string   | Optional    | Emoji or icon (max 10 chars)                           |
    
    **Each package within collection:**
    
    | Field       | Type    | Required | Description                                   |
    | ----------- | ------- | -------- | --------------------------------------------- |
    | `packageId` | string  | **Yes**  | Package to include                            |
    | `version`   | string  | Optional | Version range (^1.0.0, ~2.1.0, 1.0.0, latest) |
    | `required`  | boolean | Optional | Whether package is required (default: true)   |
    | `reason`    | string  | Optional | Why package is included (max 200 chars)       |
    
    ## Format and Subtype Values
    
    ### Format (Target AI Tool)
    
    | Format      | Description                   |
    | ----------- | ----------------------------- |
    | `claude`    | Claude Code (agents, skills)  |
    | `cursor`    | Cursor IDE (rules, MDC files) |
    | `continue`  | Continue.dev extension        |
    | `windsurf`  | Windsurf IDE                  |
    | `copilot`   | GitHub Copilot                |
    | `kiro`      | Kiro IDE                      |
    | `agents.md` | Agents.md format              |
    | `generic`   | Generic/universal format      |
    | `mcp`       | Model Context Protocol        |
    
    ### Subtype (Package Type)
    
    | Subtype         | Description              | Typical Formats       |
    | --------------- | ------------------------ | --------------------- |
    | `agent`         | Autonomous agents        | `claude`, `agents.md` |
    | `skill`         | Specialized capabilities | `claude`              |
    | `rule`          | IDE rules and guidelines | `cursor`, `windsurf`  |
    | `slash-command` | Slash commands           | `cursor`, `continue`  |
    | `prompt`        | Prompt templates         | `generic`             |
    | `collection`    | Package collections      | Any                   |
    | `chatmode`      | Chat modes               | `kiro`                |
    | `tool`          | MCP tools                | `mcp`                 |
    
    ## Eager vs Lazy Activation
    
    Skills and agents can be configured to load eagerly (at session start) or lazily (on-demand when relevant).
    
    ### When to Use Eager
    
    **Use `eager: true` when:**
    
    - The skill should ALWAYS be active (coding standards, style guides)
    - Critical behavior that must never be skipped
    - Small, foundational skills with minimal token cost
    
    **Keep lazy (default) when:**
    
    - Specialized skills for specific contexts
    - Large skills with significant token overhead
    - Skills that only apply to certain file types
    
    ### Setting Eager in prpm.json
    
    **Package-level:**
    
    ```json
    {
      "name": "code-style-enforcer",
      "version": "1.0.0",
      "format": "claude",
      "subtype": "skill",
      "eager": true,
      "files": [".claude/skills/code-style/SKILL.md"]
    }
    ```
    
    **File-level (enhanced files format):**
    
    ```json
    {
      "files": [
        {
          "path": ".claude/skills/critical-skill/SKILL.md",
          "format": "claude",
          "subtype": "skill",
          "eager": true
        },
        {
          "path": ".claude/skills/optional-skill/SKILL.md",
          "format": "claude",
          "subtype": "skill",
          "eager": false
        }
      ]
    }
    ```
    
    ### Precedence
    
    When installing, the final eager setting is determined by:
    
    1. CLI flag (`--eager`/`--lazy`) - highest priority
    2. File-level `eager` setting (enhanced files)
    3. Package-level `eager` setting
    4. Default: lazy (false)
    
    ### Applicable Subtypes
    
    | Subtype         | Supports Eager |
    | --------------- | -------------- |
    | `skill`         | Yes            |
    | `agent`         | Yes            |
    | `rule`          | No             |
    | `slash-command` | No             |
    | `hook`          | No             |
    
    Eager loading only affects progressive disclosure formats (agents.md, gemini.md, claude.md, aider).
    
    ## Tags Best Practices
    
    ### Tag Structure
    
    - Use **kebab-case** for all tags
    - Be **specific** and **searchable**
    - Include 3-8 tags per package
    - Combine technology, domain, and purpose tags
    
    ### Tag Categories
    
    **Technology Tags:**
    
    - Languages: `typescript`, `python`, `javascript`, `rust`
    - Frameworks: `react`, `nextjs`, `fastify`, `django`
    - Tools: `aws`, `docker`, `kubernetes`, `postgresql`
    
    **Domain Tags:**
    
    - `deployment`, `testing`, `ci-cd`, `database`
    - `infrastructure`, `cloud`, `monitoring`
    - `documentation`, `code-review`, `security`
    
    **Purpose Tags:**
    
    - `troubleshooting`, `debugging`, `best-practices`
    - `automation`, `quality-assurance`, `performance`
    - `architecture`, `design-patterns`
    
    **Meta Tags:**
    
    - `meta` - For packages about creating packages
    - `prpm-internal` - For internal/private packages
    - `prpm-development` - For PRPM development itself
    
    ### Tag Examples
    
    **Good Tags:**
    
    ```json
    {
      "tags": ["typescript", "type-safety", "code-quality", "best-practices", "static-analysis"]
    }
    ```
    
    **Poor Tags:**
    
    ```json
    {
      "tags": [
        "code", // Too generic
        "stuff", // Meaningless
        "TypeScript", // Wrong case
        "type_safety" // Wrong format (use kebab-case)
      ]
    }
    ```
    
    ## Organization Best Practices
    
    ### Multi-Package Organization
    
    **Order packages by:**
    
    1. **Privacy** - Private packages first
    2. **Format** - Group by format (claude, cursor, etc.)
    3. **Subtype** - Group by subtype (agent, skill, rule)
    
    **Example organization:**
    
    ```json
    {
      "packages": [
        // Private > Claude > Agents
        { "name": "internal-agent", "private": true, "format": "claude", "subtype": "agent" },
    
        // Private > Claude > Skills
        { "name": "internal-skill", "private": true, "format": "claude", "subtype": "skill" },
    
        // Private > Cursor > Rules
        { "name": "internal-rule", "private": true, "format": "cursor", "subtype": "rule" },
    
        // Public > Claude > Skills
        { "name": "public-skill", "format": "claude", "subtype": "skill" },
    
        // Public > Cursor > Rules
        { "name": "public-rule", "format": "cursor", "subtype": "rule" }
      ]
    }
    ```
    
    ### Naming Conventions
    
    **Package Names:**
    
    - Use **kebab-case**: `my-awesome-skill`
    - Be **descriptive**: `typescript-type-safety` not `ts-types`
    - Avoid duplicates across formats: use suffixes if needed
      - `format-conversion-agent` (Claude agent)
      - `format-conversion` (Cursor rule)
    
    **File Paths:**
    
    - Use **full paths from project root** (where prpm.json lives)
    - Agents: `.claude/agents/name.md`
    - Skills: `.claude/skills/name/SKILL.md`
    - Rules: `.cursor/rules/name.mdc`
    - Commands: `.claude/commands/category/name.md`
    
    ## Version Management
    
    ### Semver Guidelines
    
    Follow semantic versioning:
    
    - **Major (1.0.0 → 2.0.0)**: Breaking changes
    - **Minor (1.0.0 → 1.1.0)**: New features, backward compatible
    - **Patch (1.0.0 → 1.0.1)**: Bug fixes, backward compatible
    
    ### Version Bumping
    
    When to bump versions:
    
    - **Patch**: Bug fixes, typo corrections, minor improvements
    - **Minor**: New sections, additional examples, new features
    - **Major**: Complete rewrites, breaking changes, renamed fields
    
    ### Keep Versions in Sync
    
    For multi-package repos, keep related packages in sync:
    
    ```json
    {
      "packages": [
        { "name": "pkg-one", "version": "1.2.0" },
        { "name": "pkg-two", "version": "1.2.0" },
        { "name": "pkg-three", "version": "1.2.0" }
      ]
    }
    ```
    
    ## File Management
    
    ### Files Array
    
    **CRITICAL: File paths must be full paths from project root (where prpm.json lives).**
    
    **Required:**
    
    - List all files to include in the package
    - Use **full paths from project root** - not relative to destination directories
    - Paths should start with `.claude/`, `.cursor/`, etc.
    - Include documentation files
    
    **Why Full Paths?**
    File paths in `prpm.json` are used for:
    
    1. **Tarball creation** - Reads files directly from these paths
    2. **Snippet extraction** - Shows file preview before install
    3. **Installation** - CLI derives destination from format/subtype
    
    **Examples:**
    
    Claude agent (single file):
    
    ```json
    {
      "format": "claude",
      "subtype": "agent",
      "files": [".claude/agents/my-agent.md"]
    }
    ```
    
    Claude skill (multiple files):
    
    ```json
    {
      "format": "claude",
      "subtype": "skill",
      "files": [
        ".claude/skills/my-skill/SKILL.md",
        ".claude/skills/my-skill/EXAMPLES.md",
        ".claude/skills/my-skill/README.md"
      ]
    }
    ```
    
    Cursor rule:
    
    ```json
    {
      "format": "cursor",
      "subtype": "rule",
      "files": [".cursor/rules/my-rule.mdc"]
    }
    ```
    
    Slash command:
    
    ```json
    {
      "format": "claude",
      "subtype": "slash-command",
      "files": [".claude/commands/category/my-command.md"]
    }
    ```
    
    ### Enhanced File Format
    
    **Advanced:** Files can be objects with metadata instead of simple strings. Useful for packages with multiple files targeting different formats or needing per-file metadata.
    
    **Enhanced file object structure:**
    
    ```json
    {
      "files": [
        {
          "path": ".cursor/rules/typescript.mdc",
          "format": "cursor",
          "subtype": "rule",
          "name": "TypeScript Rules",
          "description": "TypeScript coding standards and best practices",
          "tags": ["typescript", "frontend"]
        },
        {
          "path": ".cursor/rules/python.mdc",
          "format": "cursor",
          "subtype": "rule",
          "name": "Python Rules",
          "description": "Python best practices for backend development",
          "tags": ["python", "backend"]
        }
      ]
    }
    ```
    
    **When to use enhanced format:**
    
    - Multi-file packages with different formats/subtypes per file
    - Need per-file descriptions or tags
    - Want to provide display names for individual files
    - Building collection packages with mixed content types
    
    **Enhanced file fields:**
    
    | Field         | Required | Description                                     |
    | ------------- | -------- | ----------------------------------------------- |
    | `path`        | **Yes**  | Relative path to file from project root         |
    | `format`      | **Yes**  | File's target format (`cursor`, `claude`, etc.) |
    | `subtype`     | No       | File's subtype (`rule`, `skill`, `agent`, etc.) |
    | `name`        | No       | Display name for this file                      |
    | `description` | No       | Description of what this file does              |
    | `tags`        | No       | File-specific tags (array of strings)           |
    
    **Note:** Cannot mix simple strings and objects in the same `files` array. Use all strings OR all objects, not both.
    
    **Common Mistake:**
    
    ```json
    {
      // ❌ WRONG - Relative paths without directory prefix
      "files": ["agents/my-agent.md"]  // Will fail to find file
    
      // ✅ CORRECT - Full path from project root
      "files": [".claude/agents/my-agent.md"]
    }
    ```
    
    ### File Verification
    
    Always verify files exist:
    
    ```bash
    # Check all files in prpm.json exist
    for file in $(cat prpm.json | jq -r '.packages[].files[]'); do
      if [ ! -f "$file" ]; then
        echo "Missing: $file"
      fi
    done
    ```
    
    ## Duplicate Detection
    
    ### Check for Duplicate Names
    
    Run this check before committing:
    
    ```bash
    # Check for duplicate package names
    cat prpm.json | jq -r '.packages[].name' | sort | uniq -d
    ```
    
    If output is empty, no duplicates exist. If names appear, you have duplicates to resolve.
    
    ### Resolving Duplicates
    
    **Bad:**
    
    ```json
    {
      "packages": [
        { "name": "typescript-safety", "format": "claude" },
        { "name": "typescript-safety", "format": "cursor" }
      ]
    }
    ```
    
    **Good:**
    
    ```json
    {
      "packages": [
        { "name": "typescript-safety", "format": "claude", "subtype": "skill" },
        { "name": "typescript-safety-rule", "format": "cursor", "subtype": "rule" }
      ]
    }
    ```
    
    ## Conversion Hints (Advanced)
    
    **Purpose:** Help improve quality when converting packages to other formats. The `conversion` field provides format-specific hints for cross-format transformations.
    
    **Note:** This is an advanced feature primarily used by format conversion tools. Most packages don't need this.
    
    **Structure:**
    
    ```json
    {
      "name": "my-package",
      "version": "1.0.0",
      "format": "claude",
      "conversion": {
        "cursor": {
          "alwaysApply": false,
          "priority": "high",
          "globs": ["**/*.ts", "**/*.tsx"]
        },
        "kiro": {
          "inclusion": "fileMatch",
          "fileMatchPattern": "**/*.ts",
          "domain": "typescript",
          "tools": ["fs_read", "fs_write"],
          "mcpServers": {
            "database": {
              "command": "mcp-server-postgres",
              "args": [],
              "env": {
                "DATABASE_URL": "${DATABASE_URL}"
              }
            }
          }
        },
        "copilot": {
          "applyTo": ["src/**", "lib/**"],
          "excludeAgent": "code-review"
        }
      }
    }
    ```
    
    **Supported conversion hints:**
    
    ### Cursor Hints
    
    ```json
    {
      "conversion": {
        "cursor": {
          "alwaysApply": boolean,      // Whether rule should always apply
          "priority": "high|medium|low", // Rule priority level
          "globs": ["**/*.ts"]         // File patterns to auto-attach
        }
      }
    }
    ```
    
    ### Claude Hints
    
    ```json
    {
      "conversion": {
        "claude": {
          "model": "sonnet|opus|haiku|inherit", // Preferred model
          "tools": ["Read", "Write"], // Allowed tools
          "subagentType": "format-conversion" // Subagent type if agent
        }
      }
    }
    ```
    
    ### Kiro Hints
    
    ```json
    {
      "conversion": {
        "kiro": {
          "inclusion": "always|fileMatch|manual", // When to include
          "fileMatchPattern": "**/*.ts", // Pattern for fileMatch mode
          "domain": "typescript", // Domain category
          "tools": ["fs_read", "fs_write"], // Available tools
          "mcpServers": {
            // MCP server configs
            "database": {
              "command": "mcp-server-postgres",
              "args": [],
              "env": { "DATABASE_URL": "${DATABASE_URL}" }
            }
          }
        }
      }
    }
    ```
    
    ### Copilot Hints
    
    ```json
    {
      "conversion": {
        "copilot": {
          "applyTo": "src/**", // Path patterns
          "excludeAgent": "code-review|coding-agent" // Agent to exclude
        }
      }
    }
    ```
    
    ### Continue Hints
    
    ```json
    {
      "conversion": {
        "continue": {
          "alwaysApply": boolean,           // Always apply rule
          "globs": ["**/*.ts"],             // File patterns
          "regex": ["import.*from"]         // Regex patterns
        }
      }
    }
    ```
    
    ### Windsurf Hints
    
    ```json
    {
      "conversion": {
        "windsurf": {
          "characterLimit": 12000 // Warn if exceeding limit
        }
      }
    }
    ```
    
    ### Agents.md Hints
    
    ```json
    {
      "conversion": {
        "agentsMd": {
          "project": "my-project", // Project name
          "scope": "backend" // Scope/domain
        }
      }
    }
    ```
    
    **When to use conversion hints:**
    
    - Publishing cross-format packages that need specific settings per format
    - Format conversion tools need guidance on how to transform content
    - Package behavior should change based on target format
    - Want to preserve format-specific metadata during conversions
    
    ## Common Patterns
    
    ### Private Internal Packages
    
    ```json
    {
      "name": "internal-tool",
      "version": "1.0.0",
      "description": "Internal development tool",
      "private": true,
      "format": "claude",
      "subtype": "skill",
      "tags": ["prpm-internal", "development"],
      "files": [".claude/skills/internal-tool/SKILL.md"]
    }
    ```
    
    ### Meta Packages (Creating Other Packages)
    
    ```json
    {
      "name": "creating-skills",
      "version": "1.0.0",
      "description": "Guide for creating effective Claude Code skills",
      "format": "claude",
      "subtype": "skill",
      "tags": ["meta", "claude-code", "skills", "documentation", "best-practices"],
      "files": [".claude/skills/creating-skills/SKILL.md"]
    }
    ```
    
    ### Cross-Format Packages
    
    When you have the same content for multiple formats:
    
    ```json
    {
      "packages": [
        {
          "name": "format-conversion-agent",
          "format": "claude",
          "subtype": "agent",
          "description": "Agent for converting between AI prompt formats",
          "files": [".claude/agents/format-conversion.md"]
        },
        {
          "name": "format-conversion",
          "format": "cursor",
          "subtype": "rule",
          "description": "Rule for converting between AI prompt formats",
          "files": [".cursor/rules/format-conversion.mdc"]
        }
      ]
    }
    ```
    
    ### Collections in prpm.json
    
    Collections CAN be defined in prpm.json alongside packages using the `collections` array. Collections bundle multiple packages together for easier installation.
    
    **Example with both packages and collections:**
    
    ```json
    {
      "name": "my-prompts-repo",
      "author": "Your Name",
      "license": "MIT",
      "packages": [
        {
          "name": "typescript-rules",
          "version": "1.0.0",
          "description": "TypeScript best practices",
          "format": "cursor",
          "subtype": "rule",
          "tags": ["typescript"],
          "files": [".cursor/rules/typescript.mdc"]
        }
      ],
      "collections": [
        {
          "id": "my-dev-setup",
          "name": "My Development Setup",
          "description": "Complete development setup with TypeScript and React",
          "version": "1.0.0",
          "category": "development",
          "tags": ["typescript", "react"],
          "packages": [
            {
              "packageId": "typescript-strict",
              "version": "^1.0.0",
              "required": true,
              "reason": "Enforces strict TypeScript type safety"
            },
            {
              "packageId": "react-best-practices",
              "version": "^2.0.0",
              "required": true
            }
          ]
        }
      ]
    }
    ```
    
    For more details on creating collections, see the PRPM documentation at https://docs.prpm.dev or run `prpm help collections`.
    
    **Summary:** `prpm.json` can contain both packages (skills, agents, rules, slash-commands, etc.) and collections.
    
    ## Lifecycle Scripts
    
    **IMPORTANT:** The `scripts` field only applies to **multi-package manifests** (prpm.json with a `packages` array). It does NOT work in single-package manifests.
    
    Use the `scripts` field to run commands automatically during package operations, particularly for building TypeScript hooks before publishing.
    
    ### When to Use Scripts
    
    **Primary use case: Building TypeScript Hooks**
    
    If your packages include Claude Code hooks written in TypeScript, you MUST build them to JavaScript before publishing:
    
    ```json
    {
      "name": "my-packages",
      "license": "MIT",
      "scripts": {
        "prepublishOnly": "cd packages/hooks && npm run build"
      },
      "packages": [
        {
          "name": "my-hook",
          "version": "1.0.0",
          "format": "claude",
          "subtype": "hook",
          "files": [
            ".claude/hooks/my-hook/hook.ts",
            ".claude/hooks/my-hook/hook.json",
            ".claude/hooks/my-hook/dist/hook.js"
          ]
        }
      ]
    }
    ```
    
    ### Available Script Types
    
    | Script           | When it Runs                      | Use Case                                       |
    | ---------------- | --------------------------------- | ---------------------------------------------- |
    | `prepublishOnly` | Before `prpm publish` only        | **Recommended** - Build hooks, compile assets  |
    | `prepublish`     | Before publish AND on npm install | **Not recommended** - causes unexpected builds |
    
    **Always use `prepublishOnly` instead of `prepublish`** to avoid running builds when users install your packages.
    
    ### prepublishOnly Examples
    
    **Single hook:**
    
    ```json
    {
      "scripts": {
        "prepublishOnly": "cd .claude/hooks/my-hook && npm run build"
      }
    }
    ```
    
    **Multiple hooks:**
    
    ```json
    {
      "scripts": {
        "prepublishOnly": "cd .claude/hooks/hook-one && npm run build && cd ../hook-two && npm run build"
      }
    }
    ```
    
    **With tests:**
    
    ```json
    {
      "scripts": {
        "prepublishOnly": "npm test && cd packages/hooks && npm run build"
      }
    }
    ```
    
    ### What Happens During Publishing
    
    When you run `prpm publish`:
    
    1. PRPM checks for `scripts.prepublishOnly` in your prpm.json
    2. If found, runs the script from the directory containing prpm.json
    3. If script succeeds (exit code 0), publishing continues
    4. If script fails (non-zero exit code), publishing is aborted
    
    **Script execution details:**
    
    - Working directory: Same directory as prpm.json
    - Timeout: 5 minutes (300,000ms) default
    - Environment: Inherits your shell's environment variables
    - Output: Shown in real-time
    
    ### Best Practices for Scripts
    
    **DO:**
    
    - ✅ Use `prepublishOnly` for building hooks
    - ✅ Chain commands with `&&` for dependencies: `npm test && npm run build`
    - ✅ Keep scripts fast (under 1 minute if possible)
    - ✅ Test scripts locally before publishing
    
    **DON'T:**
    
    - ❌ Use `prepublish` (runs on install too)
    - ❌ Forget to build hooks before publishing
    - ❌ Use scripts in single-package manifests (not supported)
    - ❌ Put long-running operations in scripts
    
    ### Common Patterns
    
    **Hooks in packages/ directory:**
    
    ```json
    {
      "scripts": {
        "prepublishOnly": "cd packages/hooks && npm run build"
      }
    }
    ```
    
    **Hooks in .claude/ directory:**
    
    ```json
    {
      "scripts": {
        "prepublishOnly": "cd .claude/hooks/my-hook && npm run build"
      }
    }
    ```
    
    **Build multiple components:**
    
    ```json
    {
      "scripts": {
        "prepublishOnly": "npm run build:hooks && npm run build:assets"
      }
    }
    ```
    
    ### Debugging Script Failures
    
    If your prepublishOnly script fails:
    
    1. **Check the output** - Error messages show what went wrong
    2. **Run manually** - Test the exact command in your terminal
    3. **Verify working directory** - Scripts run from prpm.json location
    4. **Check dependencies** - Ensure npm packages are installed
    
    **Example debugging:**
    
    ```bash
    # Test your prepublishOnly script manually
    cd /path/to/prpm.json/directory
    cd packages/hooks && npm run build
    
    # If it works manually but fails in PRPM, check:
    # - Working directory assumptions
    # - Environment variables
    # - Installed dependencies
    ```
    
    ### Why This Matters
    
    **Without prepublishOnly:**
    
    - You might forget to build hooks before publishing
    - Published packages contain stale/outdated JavaScript
    - Users install broken hooks
    - Manual builds are error-prone
    
    **With prepublishOnly:**
    
    - Hooks automatically build before every publish
    - JavaScript always matches TypeScript source
    - Prevents publishing broken code
    - Consistent, reliable publishing workflow
    
    ## Validation Checklist
    
    Before publishing, verify:
    
    **Required Fields:**
    
    - [ ] All packages have `name`, `version`, `description`
    - [ ] All packages have `format` and `subtype`
    - [ ] All packages have `files` array
    - [ ] Top-level has `author` and `license`
    
    **File Verification:**
    
    - [ ] All files in `files` arrays exist
    - [ ] File paths are relative to repo root
    - [ ] No missing or broken file references
    
    **No Duplicates:**
    
    - [ ] No duplicate package names
    - [ ] Package names are unique across entire manifest
    
    **Tags:**
    
    - [ ] Tags use kebab-case
    - [ ] 3-8 relevant tags per package
    - [ ] Tags include technology, domain, and purpose
    
    **Organization:**
    
    - [ ] Private packages listed first
    - [ ] Packages grouped by format and subtype
    - [ ] Consistent versioning across related packages
    
    ## Lockfile Management
    
    ### Understanding prpm.lock
    
    The `prpm.lock` file is **auto-generated** and tracks installed packages. It serves as the source of truth for what's installed in your project.
    
    **IMPORTANT:** Do NOT add packages to `prpm.json` if they already exist in `prpm.lock`:
    
    - `prpm.lock` tracks **installed dependencies** (packages you use)
    - `prpm.json` defines **published packages** (packages you create and share)
    
    ### When to Use prpm.json vs prpm.lock
    
    **Use `prpm.json` when:**
    
    - You're creating a package to publish to the registry
    - You want to define metadata for YOUR packages
    - You're setting up a multi-package repository
    
    **Use `prpm.lock` (auto-generated) when:**
    
    - You install packages with `prpm install`
    - You want to track which packages are installed
    - You want reproducible installations across environments
    
    ### Common Mistake: Duplicating Dependencies
    
    **❌ WRONG - Don't add installed packages to prpm.json:**
    
    ```json
    // prpm.json
    {
      "name": "my-project",
      "packages": [
        {
          "name": "typescript-safety", // ❌ This is an INSTALLED package
          "version": "1.0.0",
          "format": "cursor",
          "subtype": "rule",
          "files": [".cursor/rules/typescript-safety.mdc"]
        }
      ]
    }
    ```
    
    ```json
    // prpm.lock (auto-generated)
    {
      "packages": {
        "@prpm/typescript-safety": {
          // ✅ Already tracked here
          "version": "1.0.0",
          "format": "cursor",
          "subtype": "rule"
        }
      }
    }
    ```
    
    **✅ CORRECT - prpm.json only for YOUR packages:**
    
    ```json
    // prpm.json - Only YOUR packages you're publishing
    {
      "name": "my-project",
      "packages": [
        {
          "name": "my-custom-rule", // ✅ This is YOUR package
          "version": "1.0.0",
          "format": "cursor",
          "subtype": "rule",
          "files": [".cursor/rules/my-custom-rule.mdc"]
        }
      ]
    }
    ```
    
    ```json
    // prpm.lock - Installed dependencies (auto-generated)
    {
      "packages": {
        "@prpm/typescript-safety": {
          // ✅ Installed from registry
          "version": "1.0.0",
          "format": "cursor",
          "subtype": "rule"
        }
      }
    }
    ```
    
    ### Key Principles
    
    1. **Lockfile is Auto-Generated** - Never manually edit `prpm.lock`
    2. **Separation of Concerns**:
       - `prpm.json` = What you PUBLISH
       - `prpm.lock` = What you INSTALL
    3. **Check Lockfile First** - Before adding to `prpm.json`, check if it's already in `prpm.lock`
    4. **Trust the Lockfile** - It's the authoritative record of installed packages
    
    ### Workflow Example
    
    ```bash
    # Install a package (updates prpm.lock automatically)
    prpm install @prpm/typescript-safety
    
    # This creates/updates prpm.lock - DO NOT add to prpm.json!
    
    # Only create prpm.json entries for packages YOU create:
    # 1. Create your custom rule/skill/agent
    # 2. Add entry to prpm.json
    # 3. Publish with: prpm publish
    ```
    
    ## Publishing Workflow
    
    ### 1. Validate Manifest
    
    ```bash
    # Validate JSON syntax
    cat prpm.json | jq . > /dev/null
    
    # Check for duplicates
    cat prpm.json | jq -r '.packages[].name' | sort | uniq -d
    
    # Verify files exist
    # (see File Verification section)
    ```
    
    ### 2. Bump Versions
    
    Update version numbers for changed packages.
    
    ### 3. Test Locally
    
    ```bash
    # Test package installation
    prpm install . --dry-run
    ```
    
    ### 4. Publish
    
    ```bash
    # Publish all packages
    prpm publish
    
    # Or publish specific package
    prpm publish --package my-skill
    ```
    
    ## Common Mistakes to Avoid
    
    ### ❌ Missing Required Fields
    
    ```json
    {
      "name": "my-skill"
      // Missing: version, description, format, subtype, files
    }
    ```
    
    ### ❌ Wrong Tag Format
    
    ```json
    {
      "tags": ["TypeScript", "Code_Quality", "bestPractices"]
      // Should be: ["typescript", "code-quality", "best-practices"]
    }
    ```
    
    ### ❌ Duplicate Names
    
    ```json
    {
      "packages": [
        { "name": "my-skill", "format": "claude" },
        { "name": "my-skill", "format": "cursor" }
        // Second should be: "my-skill-rule" or similar
      ]
    }
    ```
    
    ### ❌ Missing Files
    
    ```json
    {
      "files": [".claude/skills/my-skill/SKILL.md"]
      // But .claude/skills/my-skill/SKILL.md doesn't exist in the repo
    }
    ```
    
    ### ❌ Absolute Paths
    
    ```json
    {
      "files": ["/Users/me/project/.claude/skills/my-skill/SKILL.md"]
      // Should be: ".claude/skills/my-skill/SKILL.md" (relative to project root)
    }
    ```
    
    ### ❌ Missing Directory Prefix
    
    ```json
    {
      "files": ["agents/my-agent.md"]
      // Should be: ".claude/agents/my-agent.md" (include .claude/ prefix)
    }
    ```
    
    ## Remember
    
    - `prpm.json` is **only for publishing YOUR packages/collections**, not for installed dependencies
    - **Never add packages from `prpm.lock` to `prpm.json`** - they serve different purposes
    - `prpm.lock` tracks what you INSTALL, `prpm.json` defines what you PUBLISH
    - Use `collections` array to bundle existing packages (references by packageId)
    - Use `packages` array to define packages with files
    - Can combine both `packages` and `collections` in same repo
    - Always validate before committing
    - Keep versions in sync for related packages
    - Use consistent, searchable tags
    - Verify all file paths exist
    - Check for duplicate names
    - Follow semver for version management
    
    **Goal:** Create maintainable, well-organized package manifests and curated collections that are easy to publish and discover in the PRPM registry.
    

Comments (0)

Sign in to join the conversation.

No comments yet.

Reviews (0)

No reviews yet.

Related