
Version Management
- 12 installs
- Updated November 18, 2025
- wesley1600/claudecodeframework
Helps with ai & agent building tasks.
About
version-management is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- version-management
- AI & Agent Building
- AI-coding skill
Version Management by the numbers
- 12 all-time installs (skills.sh)
- Ranked #11,618 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Jul 27, 2026 (Skillselion catalog sync)
npx skills add https://github.com/wesley1600/claudecodeframework --skill version-managementAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 12 |
|---|---|
| Last updated | November 18, 2025 |
| Repository | wesley1600/claudecodeframework ↗ |
What it does
Helps with ai & agent building tasks.
Files
Version Management Skill
A comprehensive version management system for skills, prompts, and documents in Claude Code. This skill provides professional version control capabilities including tagging releases, maintaining changelogs, and rolling back to previous versions when needed.
Overview
This skill enables you to:
- Tag releases with semantic versioning (v1.0.0, v1.1.0, etc.)
- Store changelogs documenting changes between versions
- Roll back to previous versions if new instructions cause errors
- Track changes to SKILL.md, scripts, and resource files
- Compare versions to understand what changed
- Archive versions for long-term storage
Core Concepts
Version Format
Uses semantic versioning: MAJOR.MINOR.PATCH
- MAJOR: Breaking changes or complete rewrites
- MINOR: New features, backward compatible
- PATCH: Bug fixes, minor improvements
Storage Structure
skills/<skill-name>/
├── SKILL.md # Current version
├── .versions/ # Version history
│ ├── v1.0.0/
│ │ ├── SKILL.md
│ │ ├── scripts/
│ │ └── metadata.json
│ ├── v1.1.0/
│ │ ├── SKILL.md
│ │ ├── scripts/
│ │ └── metadata.json
│ └── CHANGELOG.md # Complete change history
└── scripts/ # Current scriptsMetadata Format
Each version stores metadata in metadata.json:
{
"version": "1.0.0",
"timestamp": "2025-11-18T12:00:00Z",
"author": "Claude <noreply@anthropic.com>",
"commit": "abc123...",
"description": "Initial release with core functionality",
"changes": [
"Added version tagging",
"Implemented rollback mechanism",
"Created changelog template"
],
"files_tracked": [
"SKILL.md",
"scripts/version_manager.sh"
]
}Workflow
1. Initialize Version Management for a Skill
Input:
- Skill name or path
- Initial version number (default: 0.1.0)
Actions: 1. Check if skill exists 2. Create .versions/ directory 3. Create initial version snapshot 4. Initialize CHANGELOG.md 5. Create metadata.json
Output:
- Confirmation message with version number
- Location of version storage
2. Create New Version/Tag
Input:
- Skill name
- Version number or bump type (major/minor/patch)
- Description of changes
- Optional: List of specific changes
Actions: 1. Validate version number format 2. Check if version already exists 3. Create version directory 4. Copy current SKILL.md and scripts 5. Generate metadata.json 6. Update CHANGELOG.md 7. Create git tag (if in git repo) 8. Commit changes
Output:
- Version tag created:
v1.2.0 - Changelog entry added
- Files tracked: [list]
3. List All Versions
Input:
- Skill name
- Optional: Filter by date range or version pattern
Actions: 1. Read .versions/ directory 2. Parse metadata.json for each version 3. Sort by version number or date 4. Format output table
Output:
Version History for 'session-start-hook':
v1.2.0 | 2025-11-18 12:00 | Added validation for linters
v1.1.0 | 2025-11-15 10:30 | Improved error handling
v1.0.0 | 2025-11-10 09:00 | Initial release4. Show Version Details
Input:
- Skill name
- Version number
Actions: 1. Locate version directory 2. Read metadata.json 3. Display comprehensive information 4. Show file changes from previous version
Output:
Version: v1.2.0
Date: 2025-11-18 12:00:00Z
Author: Claude <noreply@anthropic.com>
Commit: abc123def456
Description:
Added validation for linters and improved test coverage
Changes:
- Added lint validation step
- Improved error messages
- Updated documentation
Files Modified:
- SKILL.md (+45 lines, -12 lines)
- scripts/validator.sh (new file)5. Compare Two Versions
Input:
- Skill name
- Version A (e.g., v1.0.0)
- Version B (e.g., v1.2.0)
- Optional: Specific file to compare
Actions: 1. Load both versions 2. Perform diff on SKILL.md and scripts 3. Highlight changes 4. Show metadata differences
Output:
- Unified diff format
- Summary of changes
- Changelog entries between versions
6. Roll Back to Previous Version
Input:
- Skill name
- Target version number
- Optional: Create backup of current version
Actions: 1. CRITICAL: Create backup of current state 2. Verify target version exists 3. Confirm rollback with user 4. Copy files from target version to current 5. Update metadata 6. Log rollback in CHANGELOG 7. Create git commit
Output:
- Rollback successful:
v1.2.0→v1.0.0 - Backup created at:
.versions/backup-2025-11-18-120000/ - Changes reverted: [list]
Safety Checks:
- Always create backup before rollback
- Require explicit confirmation
- Verify file integrity
- Test rolled-back version if possible
7. Update Changelog
Input:
- Skill name
- Version number
- Change entries
- Optional: Category (Added/Changed/Fixed/Removed)
Actions: 1. Read current CHANGELOG.md 2. Add new entries under version heading 3. Format according to Keep a Changelog standard 4. Update timestamp 5. Save changes
Output:
- Changelog updated for version
v1.2.0 - 3 entries added under "Added" category
8. Export Version Archive
Input:
- Skill name
- Version number or "all"
- Output format (tar.gz/zip)
- Destination path
Actions: 1. Collect version files 2. Include metadata and changelog 3. Create archive 4. Verify integrity 5. Generate checksum
Output:
- Archive created:
session-start-hook-v1.2.0.tar.gz - Size: 45 KB
- SHA256: abc123...
- Location:
/path/to/archive
Change Detection
The skill automatically tracks changes to:
Monitored Files
- SKILL.md: Main skill definition
- scripts/: All executable scripts
- templates/: Template files
- resources/: Additional resources
Change Types Detected
- Content changes: Line additions/deletions
- New files: Files added to skill directory
- Deleted files: Files removed
- Renamed files: File moves/renames
- Permission changes: Executable bit changes
Detection Method
# Compare against previous version
git diff v1.0.0..v1.1.0 -- skills/skill-name/
# Track specific files
git log --follow -- skills/skill-name/SKILL.mdError Recovery
Common Issues and Solutions
Issue: Rollback fails due to corrupted version Solution: 1. Check .versions/ directory for intact versions 2. Use next-most-recent stable version 3. Restore from git history if available
Issue: Version tag already exists Solution: 1. List existing versions 2. Increment version number 3. Or use --force flag to overwrite (dangerous)
Issue: Changelog merge conflict Solution: 1. Export current changelog 2. Restore from version history 3. Manually merge entries 4. Validate format
Integration with Git
Git Tag Creation
# Create annotated tag
git tag -a v1.2.0 -m "Version 1.2.0: Added validation"
# Push tag to remote
git push origin v1.2.0Branch-Based Versioning
- Development:
claude/version-mgmt-<session-id> - Releases: Tagged commits on main branch
- Hotfixes: Patch version bumps
Commit Messages
feat(version-mgmt): Add rollback capability
- Implement version rollback with safety checks
- Add backup creation before rollback
- Update changelog automatically
Version: v1.2.0
Skill: version-managementBest Practices
When to Create Versions
Always version when:
- Making breaking changes to skill behavior
- Adding new major features
- Before deploying to production
- After significant testing/validation
- Completing a milestone
Consider versioning when:
- Fixing bugs
- Improving documentation
- Refactoring code
- Updating dependencies
Skip versioning for:
- Typo fixes
- Comment updates
- Formatting changes
Version Numbering Guidelines
Bump MAJOR (1.0.0 → 2.0.0):
- Incompatible API changes
- Complete skill rewrite
- Breaking changes to workflow
Bump MINOR (1.0.0 → 1.1.0):
- New features added
- New workflow steps
- Backward-compatible enhancements
Bump PATCH (1.0.0 → 1.0.1):
- Bug fixes
- Documentation improvements
- Minor tweaks
Changelog Writing
Follow Keep a Changelog format:
## [1.2.0] - 2025-11-18
### Added
- New rollback safety checks
- Automatic backup creation
- Version comparison feature
### Changed
- Improved error messages in validator
- Updated documentation structure
### Fixed
- Rollback file permission issues
- Changelog formatting errors
### Removed
- Deprecated legacy backup formatExample Usage Scenarios
Scenario 1: Version a New Skill
User: I've created a new skill called 'code-reviewer'. Please version it.
Claude: I'll initialize version management for the 'code-reviewer' skill.
1. Creating version structure
2. Taking initial snapshot as v0.1.0
3. Initializing CHANGELOG.md
4. Creating metadata
✓ Version v0.1.0 created for 'code-reviewer'
✓ Tracking: SKILL.md, scripts/reviewer.sh
✓ Changelog initialized
Next steps:
- Make improvements to your skill
- When ready, create v1.0.0 for first stable releaseScenario 2: Create Release After Updates
User: I've updated the code-reviewer skill. Tag it as v1.0.0.
Claude: I'll create version v1.0.0 for 'code-reviewer'.
Detected changes:
- SKILL.md: +67 lines, -23 lines
- scripts/reviewer.sh: +145 lines (new)
- scripts/analyzer.py: +89 lines (new)
Please provide a description of changes:
User: Added Python code analysis and improved markdown documentation
Claude: Creating version v1.0.0...
✓ Version snapshot created
✓ Metadata saved
✓ Changelog updated
✓ Git tag created: v1.0.0
Version v1.0.0 Summary:
- Description: Added Python code analysis and improved markdown documentation
- Files tracked: 3
- Total changes: +301 lines, -23 lines
- Date: 2025-11-18 12:30:00ZScenario 3: Rollback After Error
User: The new version v1.1.0 is causing errors. Roll back to v1.0.0.
Claude: I'll initiate rollback from v1.1.0 to v1.0.0 for 'code-reviewer'.
⚠️ WARNING: This will replace current files with v1.0.0
Rollback plan:
1. Create backup of current state
2. Restore files from v1.0.0
3. Update metadata
4. Log rollback in changelog
5. Create git commit
Proceed with rollback? (yes/no)
User: yes
Claude: Executing rollback...
✓ Backup created: .versions/backup-2025-11-18-123000/
✓ Files restored from v1.0.0
✓ SKILL.md restored
✓ scripts/ restored
✓ Metadata updated
✓ Changelog entry added
✓ Git commit created
Rollback successful!
Current version: v1.0.0
Backup location: .versions/backup-2025-11-18-123000/
You can now fix the issues and create v1.1.1.Scenario 4: Compare Versions
User: Show me what changed between v1.0.0 and v1.2.0
Claude: Comparing versions v1.0.0 and v1.2.0 for 'code-reviewer'...
Version Metadata:
v1.0.0 (2025-11-18) → v1.2.0 (2025-11-20)
Changelog Entries:
[1.1.0] - 2025-11-19
Added: Error recovery mechanisms
Fixed: File permission handling
[1.2.0] - 2025-11-20
Added: Version comparison feature
Changed: Improved validation logic
File Changes:
SKILL.md:
+89 lines, -34 lines
scripts/reviewer.sh:
+45 lines, -12 lines
scripts/comparator.sh:
+156 lines (new file)
Total: +290 lines, -46 lines across 3 filesSecurity Considerations
File Integrity
- SHA256 checksums for version archives
- Verify file integrity before rollback
- Detect tampering in version history
Permissions
- Preserve file permissions in versions
- Restore correct permissions on rollback
- Validate script execution permissions
Backup Safety
- Always create backup before destructive operations
- Store backups with timestamp
- Automatic cleanup of old backups (optional)
Performance Optimization
Large Skills
- Incremental backups (store diffs instead of full copies)
- Compression for version archives
- Lazy loading of version metadata
Storage Management
- Configurable retention policy
- Auto-archive old versions
- Cleanup of orphaned versions
Validation & Testing
Before finalizing a version:
1. Syntax validation: Verify YAML frontmatter 2. File integrity: Check all tracked files exist 3. Metadata completeness: Ensure all required fields 4. Changelog format: Validate Keep a Changelog format 5. Git consistency: Verify git tags match version numbers 6. Rollback test: Verify rollback to previous version works
Troubleshooting
Version Not Found
# List all versions
ls -la skills/<skill-name>/.versions/
# Check git tags
git tag -l "v*"Corrupted Metadata
# Regenerate from git history
git log --follow -- skills/<skill-name>/SKILL.mdRollback Failed
# Restore from backup
cp -r .versions/backup-*/ ./Summary
The version-management skill provides professional version control for Claude Code skills, enabling:
- Safe experimentation with rollback capability
- Professional changelog maintenance
- Clear version history
- Error recovery mechanisms
- Integration with git workflows
Use this skill whenever you need to:
- Track changes to skills over time
- Create stable releases
- Document evolution of prompts
- Recover from problematic changes
- Archive skill versions
Related Commands
git tag: View git tagsgit diff: Compare versionsgit log: View commit historygit checkout: Switch versions (use with caution)
References
Changelog
All notable changes to this skill will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[0.1.0] - 2025-11-18
Added
- Initial version of skill
- Version management initialized
{
"version": "0.1.0",
"timestamp": "2025-11-18T02:07:14Z",
"author": "Claude <noreply@anthropic.com>",
"commit": "e4642846a8532fbc622880d67c5f3d10e7481e31",
"description": "Initial version",
"files_tracked": ["SKILL.md","scripts/","templates/"]
}
#!/bin/bash
# version_manager.sh
# Version management script for Claude Code skills
# Handles version creation, tagging, rollback, and changelog management
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
VERSION_DIR=".versions"
CHANGELOG_FILE="CHANGELOG.md"
METADATA_FILE="metadata.json"
# Helper functions
log_info() {
echo -e "${BLUE}ℹ${NC} $1"
}
log_success() {
echo -e "${GREEN}✓${NC} $1"
}
log_warning() {
echo -e "${YELLOW}⚠${NC} $1"
}
log_error() {
echo -e "${RED}✗${NC} $1" >&2
}
# Validate semantic version format
validate_version() {
local version="$1"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
log_error "Invalid version format: $version"
log_error "Expected format: MAJOR.MINOR.PATCH (e.g., 1.2.3)"
return 1
fi
return 0
}
# Parse version components
parse_version() {
local version="$1"
echo "$version" | sed -E 's/^v?([0-9]+)\.([0-9]+)\.([0-9]+)$/\1 \2 \3/'
}
# Bump version number
bump_version() {
local current="$1"
local bump_type="$2"
read -r major minor patch <<< "$(parse_version "$current")"
case "$bump_type" in
major)
echo "$((major + 1)).0.0"
;;
minor)
echo "${major}.$((minor + 1)).0"
;;
patch)
echo "${major}.${minor}.$((patch + 1))"
;;
*)
log_error "Invalid bump type: $bump_type"
log_error "Expected: major, minor, or patch"
return 1
;;
esac
}
# Initialize version management for a skill
init_version_management() {
local skill_path="$1"
local initial_version="${2:-0.1.0}"
log_info "Initializing version management for skill at: $skill_path"
# Validate skill path
if [[ ! -d "$skill_path" ]]; then
log_error "Skill directory not found: $skill_path"
return 1
fi
if [[ ! -f "$skill_path/SKILL.md" ]]; then
log_error "SKILL.md not found in: $skill_path"
return 1
fi
# Validate initial version
validate_version "$initial_version" || return 1
# Create version directory
local version_root="$skill_path/$VERSION_DIR"
mkdir -p "$version_root"
# Initialize changelog if it doesn't exist
if [[ ! -f "$version_root/$CHANGELOG_FILE" ]]; then
cat > "$version_root/$CHANGELOG_FILE" <<EOF
# Changelog
All notable changes to this skill will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [$initial_version] - $(date -u +"%Y-%m-%d")
### Added
- Initial version of skill
- Version management initialized
EOF
log_success "Created $CHANGELOG_FILE"
fi
# Create initial version
create_version "$skill_path" "$initial_version" "Initial version"
log_success "Version management initialized"
log_info "Version directory: $version_root"
log_info "Initial version: v$initial_version"
}
# Create a new version snapshot
create_version() {
local skill_path="$1"
local version="$2"
local description="${3:-No description provided}"
validate_version "$version" || return 1
local version_root="$skill_path/$VERSION_DIR"
local version_dir="$version_root/v$version"
# Check if version already exists
if [[ -d "$version_dir" ]]; then
log_error "Version v$version already exists"
log_info "Use a different version number or delete the existing version"
return 1
fi
log_info "Creating version v$version..."
# Create version directory
mkdir -p "$version_dir"
# Copy current files
cp "$skill_path/SKILL.md" "$version_dir/"
# Copy scripts directory if it exists
if [[ -d "$skill_path/scripts" ]]; then
cp -r "$skill_path/scripts" "$version_dir/"
log_success "Copied scripts directory"
fi
# Copy templates directory if it exists
if [[ -d "$skill_path/templates" ]]; then
cp -r "$skill_path/templates" "$version_dir/"
log_success "Copied templates directory"
fi
# Copy resources directory if it exists
if [[ -d "$skill_path/resources" ]]; then
cp -r "$skill_path/resources" "$version_dir/"
log_success "Copied resources directory"
fi
# Get git commit hash if in a git repo
local commit_hash="unknown"
if git rev-parse --git-dir > /dev/null 2>&1; then
commit_hash=$(git rev-parse HEAD 2>/dev/null || echo "unknown")
fi
# Get author from git config or use default
local author="Claude <noreply@anthropic.com>"
if git config user.name > /dev/null 2>&1; then
local git_name=$(git config user.name)
local git_email=$(git config user.email)
author="$git_name <$git_email>"
fi
# Create metadata file
local tracked_files=("SKILL.md")
[[ -d "$skill_path/scripts" ]] && tracked_files+=("scripts/")
[[ -d "$skill_path/templates" ]] && tracked_files+=("templates/")
[[ -d "$skill_path/resources" ]] && tracked_files+=("resources/")
# Build files array for JSON
local files_json="["
for file in "${tracked_files[@]}"; do
files_json+="\"$file\","
done
files_json="${files_json%,}]" # Remove trailing comma
cat > "$version_dir/$METADATA_FILE" <<EOF
{
"version": "$version",
"timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"author": "$author",
"commit": "$commit_hash",
"description": "$description",
"files_tracked": $files_json
}
EOF
log_success "Created metadata file"
log_success "Version v$version created successfully"
log_info "Location: $version_dir"
log_info "Files tracked: ${tracked_files[*]}"
# Create git tag if in a git repo
if git rev-parse --git-dir > /dev/null 2>&1; then
if git tag -a "v$version" -m "$description" 2>/dev/null; then
log_success "Created git tag: v$version"
else
log_warning "Git tag v$version already exists or could not be created"
fi
fi
}
# List all versions
list_versions() {
local skill_path="$1"
local version_root="$skill_path/$VERSION_DIR"
if [[ ! -d "$version_root" ]]; then
log_error "Version management not initialized for this skill"
log_info "Run: init_version_management \"$skill_path\""
return 1
fi
echo ""
echo "Version History for skill at: $skill_path"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
printf "%-10s | %-20s | %s\n" "VERSION" "DATE" "DESCRIPTION"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Find all version directories and sort
for version_dir in "$version_root"/v*/; do
if [[ -f "$version_dir/$METADATA_FILE" ]]; then
local version=$(jq -r '.version' "$version_dir/$METADATA_FILE")
local timestamp=$(jq -r '.timestamp' "$version_dir/$METADATA_FILE")
local description=$(jq -r '.description' "$version_dir/$METADATA_FILE")
# Format timestamp
local date_formatted=$(date -d "$timestamp" "+%Y-%m-%d %H:%M" 2>/dev/null || echo "$timestamp")
# Truncate description if too long
if [[ ${#description} -gt 50 ]]; then
description="${description:0:47}..."
fi
printf "%-10s | %-20s | %s\n" "v$version" "$date_formatted" "$description"
fi
done | sort -V
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
}
# Show version details
show_version() {
local skill_path="$1"
local version="$2"
# Remove 'v' prefix if present
version="${version#v}"
local version_dir="$skill_path/$VERSION_DIR/v$version"
if [[ ! -d "$version_dir" ]]; then
log_error "Version v$version not found"
return 1
fi
if [[ ! -f "$version_dir/$METADATA_FILE" ]]; then
log_error "Metadata file not found for version v$version"
return 1
fi
echo ""
echo "Version Details: v$version"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Parse and display metadata
local metadata=$(cat "$version_dir/$METADATA_FILE")
echo "Version: $(echo "$metadata" | jq -r '.version')"
echo "Date: $(echo "$metadata" | jq -r '.timestamp')"
echo "Author: $(echo "$metadata" | jq -r '.author')"
echo "Commit: $(echo "$metadata" | jq -r '.commit')"
echo ""
echo "Description:"
echo " $(echo "$metadata" | jq -r '.description')"
echo ""
echo "Files Tracked:"
echo "$metadata" | jq -r '.files_tracked[]' | sed 's/^/ - /'
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
}
# Rollback to a previous version
rollback_version() {
local skill_path="$1"
local target_version="$2"
local create_backup="${3:-yes}"
# Remove 'v' prefix if present
target_version="${target_version#v}"
local version_dir="$skill_path/$VERSION_DIR/v$target_version"
if [[ ! -d "$version_dir" ]]; then
log_error "Target version v$target_version not found"
return 1
fi
log_warning "ROLLBACK OPERATION"
log_warning "This will replace current files with version v$target_version"
echo ""
# Create backup if requested
if [[ "$create_backup" == "yes" ]]; then
local backup_dir="$skill_path/$VERSION_DIR/backup-$(date -u +"%Y%m%d-%H%M%S")"
mkdir -p "$backup_dir"
log_info "Creating backup of current state..."
cp "$skill_path/SKILL.md" "$backup_dir/" 2>/dev/null || true
[[ -d "$skill_path/scripts" ]] && cp -r "$skill_path/scripts" "$backup_dir/" 2>/dev/null || true
[[ -d "$skill_path/templates" ]] && cp -r "$skill_path/templates" "$backup_dir/" 2>/dev/null || true
[[ -d "$skill_path/resources" ]] && cp -r "$skill_path/resources" "$backup_dir/" 2>/dev/null || true
log_success "Backup created at: $backup_dir"
fi
log_info "Restoring files from v$target_version..."
# Restore files
cp "$version_dir/SKILL.md" "$skill_path/"
log_success "Restored SKILL.md"
# Restore scripts
if [[ -d "$version_dir/scripts" ]]; then
rm -rf "$skill_path/scripts"
cp -r "$version_dir/scripts" "$skill_path/"
log_success "Restored scripts/"
fi
# Restore templates
if [[ -d "$version_dir/templates" ]]; then
rm -rf "$skill_path/templates"
cp -r "$version_dir/templates" "$skill_path/"
log_success "Restored templates/"
fi
# Restore resources
if [[ -d "$version_dir/resources" ]]; then
rm -rf "$skill_path/resources"
cp -r "$version_dir/resources" "$skill_path/"
log_success "Restored resources/"
fi
log_success "Rollback to v$target_version completed successfully"
if [[ "$create_backup" == "yes" ]]; then
log_info "Previous state backed up to: $backup_dir"
fi
}
# Main command dispatcher
main() {
local command="${1:-help}"
case "$command" in
init)
if [[ $# -lt 2 ]]; then
log_error "Usage: $0 init <skill_path> [initial_version]"
return 1
fi
init_version_management "${2}" "${3:-0.1.0}"
;;
create)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 create <skill_path> <version> [description]"
return 1
fi
create_version "${2}" "${3}" "${4:-No description provided}"
;;
list)
if [[ $# -lt 2 ]]; then
log_error "Usage: $0 list <skill_path>"
return 1
fi
list_versions "${2}"
;;
show)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 show <skill_path> <version>"
return 1
fi
show_version "${2}" "${3}"
;;
rollback)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 rollback <skill_path> <version> [create_backup]"
return 1
fi
rollback_version "${2}" "${3}" "${4:-yes}"
;;
bump)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 bump <current_version> <major|minor|patch>"
return 1
fi
bump_version "${2}" "${3}"
;;
help|--help|-h)
cat <<EOF
Version Manager - Claude Code Skill Version Management
USAGE:
$0 <command> [arguments]
COMMANDS:
init <skill_path> [version] Initialize version management (default: 0.1.0)
create <skill_path> <version> [desc] Create new version snapshot
list <skill_path> List all versions
show <skill_path> <version> Show version details
rollback <skill_path> <version> Rollback to previous version
bump <version> <major|minor|patch> Calculate next version number
help Show this help message
EXAMPLES:
$0 init ./skills/my-skill 0.1.0
$0 create ./skills/my-skill 1.0.0 "Initial release"
$0 list ./skills/my-skill
$0 show ./skills/my-skill 1.0.0
$0 rollback ./skills/my-skill 1.0.0
$0 bump 1.0.0 minor
EOF
;;
*)
log_error "Unknown command: $command"
log_info "Run '$0 help' for usage information"
return 1
;;
esac
}
# Run main if script is executed directly
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi
Changelog
All notable changes to this skill will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
Added
- Features that have been added but not yet released
Changed
- Changes to existing functionality
Deprecated
- Features that will be removed in upcoming releases
Removed
- Features that have been removed
Fixed
- Bug fixes
Security
- Security improvements or vulnerability fixes
---
[1.0.0] - YYYY-MM-DD
Added
- Initial release
- Core functionality implementation
- Basic documentation
Changed
- N/A (initial release)
Fixed
- N/A (initial release)
---
Template Instructions
When adding a new version, follow this format:
## [X.Y.Z] - YYYY-MM-DD
### Added
- New feature A
- New feature B
### Changed
- Modified behavior of feature C
- Updated documentation for D
### Deprecated
- Feature E will be removed in version X+1.0.0
### Removed
- Removed deprecated feature F
### Fixed
- Fixed bug in feature G (#issue-number)
- Corrected typo in documentation
### Security
- Fixed security vulnerability in feature H (CVE-YYYY-XXXXX)Version Numbering Guide
Given a version number MAJOR.MINOR.PATCH, increment the:
1. MAJOR version when you make incompatible API changes 2. MINOR version when you add functionality in a backward compatible manner 3. PATCH version when you make backward compatible bug fixes
Categories Guide
- Added: New features
- Changed: Changes in existing functionality
- Deprecated: Soon-to-be removed features
- Removed: Now removed features
- Fixed: Bug fixes
- Security: Vulnerability fixes
Best Practices
1. Keep entries concise: One line per change when possible 2. Use present tense: "Add feature" not "Added feature" 3. Link to issues: Reference issue/PR numbers when applicable 4. Group related changes: Keep related items together 5. Date format: Use ISO 8601 (YYYY-MM-DD) 6. Keep unreleased section: Always maintain an [Unreleased] section 7. Add comparison links: Link version tags for easy diff viewing
Example with Links
## [1.2.0] - 2025-11-18
### Added
- New rollback safety checks ([#123](https://github.com/org/repo/pull/123))
- Automatic backup creation before destructive operations
### Changed
- Improved error messages in validator ([#124](https://github.com/org/repo/pull/124))
- Updated documentation structure
### Fixed
- Rollback file permission issues ([#125](https://github.com/org/repo/issues/125))
- Changelog formatting errors
[1.2.0]: https://github.com/org/repo/compare/v1.1.0...v1.2.0Comparison Links
Add at the bottom of the file:
[Unreleased]: https://github.com/org/repo/compare/v1.2.0...HEAD
[1.2.0]: https://github.com/org/repo/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/org/repo/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/org/repo/releases/tag/v1.0.0Version Management Skill
Professional version control for Claude Code skills, prompts, and documents.
Quick Start
1. Initialize Version Management
cd ~/.claude/skills/your-skill-name
../../version-management/scripts/version_manager.sh init . 0.1.0This creates:
.versions/directory for version storageCHANGELOG.mdfor tracking changes- Initial version snapshot at
v0.1.0
2. Create a New Version
After making changes to your skill:
../../version-management/scripts/version_manager.sh create . 1.0.0 "Initial stable release"3. List All Versions
../../version-management/scripts/version_manager.sh list .Output:
Version History for skill at: .
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
VERSION | DATE | DESCRIPTION
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
v0.1.0 | 2025-11-18 10:00 | Initial version
v1.0.0 | 2025-11-18 12:00 | Initial stable release
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━4. Show Version Details
../../version-management/scripts/version_manager.sh show . 1.0.05. Rollback to Previous Version
If something goes wrong:
../../version-management/scripts/version_manager.sh rollback . 1.0.0This will:
- Create a backup of current state
- Restore all files from version
v1.0.0 - Update metadata
6. Calculate Next Version
# Bump from 1.0.0 to 1.1.0 (minor)
../../version-management/scripts/version_manager.sh bump 1.0.0 minor
# Bump from 1.0.0 to 2.0.0 (major)
../../version-management/scripts/version_manager.sh bump 1.0.0 major
# Bump from 1.0.0 to 1.0.1 (patch)
../../version-management/scripts/version_manager.sh bump 1.0.0 patchInstallation
For Individual Skills
1. Copy the version-management skill to your Claude skills directory:
cp -r skills/version-management ~/.claude/skills/2. Initialize version management for any existing skill:
cd ~/.claude/skills/your-skill
../version-management/scripts/version_manager.sh init . 0.1.0For Project-Based Skills
If you're developing skills in a git repository:
# Clone or copy the version-management skill
cd your-project/skills
git clone <repo-url> version-management
# or
cp -r /path/to/version-management .Directory Structure
After initialization, your skill will have:
your-skill/
├── SKILL.md # Current version
├── scripts/ # Current scripts
├── templates/ # Current templates
└── .versions/ # Version history
├── CHANGELOG.md # Change log
├── v0.1.0/ # Version 0.1.0
│ ├── SKILL.md
│ ├── scripts/
│ ├── templates/
│ └── metadata.json
├── v1.0.0/ # Version 1.0.0
│ ├── SKILL.md
│ ├── scripts/
│ ├── templates/
│ └── metadata.json
└── backup-20251118-120000/ # Rollback backup
├── SKILL.md
└── scripts/Usage Examples
Example 1: Version a New Skill
# Create new skill
mkdir ~/.claude/skills/code-reviewer
cd ~/.claude/skills/code-reviewer
# Create SKILL.md
cat > SKILL.md <<EOF
---
name: code-reviewer
description: Reviews code for quality and best practices
---
# Code Reviewer Skill
...
EOF
# Initialize version management
../version-management/scripts/version_manager.sh init . 0.1.0
# Work on the skill...
# When ready for release:
../version-management/scripts/version_manager.sh create . 1.0.0 "Initial stable release"Example 2: Update Existing Skill
cd ~/.claude/skills/your-skill
# Make changes to SKILL.md
vim SKILL.md
# Create new version
../version-management/scripts/version_manager.sh create . 1.1.0 "Added new features"
# Update changelog manually
vim .versions/CHANGELOG.mdExample 3: Recover from Bad Update
cd ~/.claude/skills/your-skill
# Oh no, v1.1.0 has bugs!
# List versions to see what's available
../version-management/scripts/version_manager.sh list .
# Rollback to last stable version
../version-management/scripts/version_manager.sh rollback . 1.0.0
# Fix issues, then create patch version
../version-management/scripts/version_manager.sh create . 1.0.1 "Fixed bugs from v1.1.0"Example 4: Compare Versions
# Show details of two versions
../version-management/scripts/version_manager.sh show . 1.0.0
../version-management/scripts/version_manager.sh show . 1.1.0
# Use diff to compare SKILL.md
diff .versions/v1.0.0/SKILL.md .versions/v1.1.0/SKILL.md
# Or use git if in a repo
git diff v1.0.0..v1.1.0 -- .Workflow Integration
With Git
The version manager integrates with git:
# Create version (automatically creates git tag)
./version_manager.sh create . 1.0.0 "Release version 1.0.0"
# List git tags
git tag -l "v*"
# Push tags to remote
git push origin --tags
# Checkout specific version
git checkout v1.0.0With Claude Code Hooks
You can automate versioning in Claude Code hooks:
{
"hooks": {
"SessionStart": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "~/.claude/skills/version-management/scripts/check_versions.sh"
}
]
}
]
}
}Changelog Maintenance
Manual Updates
Edit .versions/CHANGELOG.md:
## [1.1.0] - 2025-11-18
### Added
- New validation features
- Improved error handling
### Changed
- Updated documentation
### Fixed
- Bug in rollback mechanismAutomated Updates
The version manager automatically:
- Creates initial changelog
- Adds version headers
- Includes timestamps
You should manually:
- Add detailed change entries
- Categorize changes (Added/Changed/Fixed)
- Add links to issues/PRs
Best Practices
When to Version
✅ Do version when:
- Adding major features
- Making breaking changes
- Before deploying to production
- After significant testing
- Completing milestones
❌ Don't version for:
- Typo fixes
- Comment updates
- Whitespace changes
Version Numbering
- Patch (1.0.0 → 1.0.1): Bug fixes, typos
- Minor (1.0.0 → 1.1.0): New features, backward compatible
- Major (1.0.0 → 2.0.0): Breaking changes
Changelog Writing
- Be concise: One line per change
- Be specific: "Fix rollback permission bug" not "Fix bug"
- Link issues: Reference GitHub issues/PRs
- Use categories: Added/Changed/Fixed/Removed
- Date consistently: Use ISO 8601 (YYYY-MM-DD)
Troubleshooting
Version Already Exists
# Error: Version v1.0.0 already exists
# Solution: Use different version number
./version_manager.sh create . 1.0.1 "Patch release"Missing jq Command
# Error: jq: command not found
# Solution: Install jq
apt-get install jq # Debian/Ubuntu
brew install jq # macOSRollback Failed
# Check backup directory
ls .versions/backup-*/
# Manually restore
cp .versions/backup-20251118-120000/SKILL.md .Git Tag Conflicts
# Error: tag 'v1.0.0' already exists
# Solution: Delete and recreate tag
git tag -d v1.0.0
./version_manager.sh create . 1.0.0 "Recreate tag"Advanced Usage
Batch Version Creation
# Version multiple skills
for skill in ~/.claude/skills/*/; do
cd "$skill"
../version-management/scripts/version_manager.sh create . 1.0.0 "Batch release"
doneExport Version Archive
# Create tarball of specific version
tar -czf skill-v1.0.0.tar.gz .versions/v1.0.0/
# Create zip archive
zip -r skill-v1.0.0.zip .versions/v1.0.0/Version Comparison Script
#!/bin/bash
# compare_versions.sh
v1="$1"
v2="$2"
echo "Comparing $v1 to $v2:"
diff -u ".versions/$v1/SKILL.md" ".versions/$v2/SKILL.md"API Reference
Commands
| Command | Description | Example |
|---|---|---|
init | Initialize version management | init . 0.1.0 |
create | Create new version | create . 1.0.0 "Description" |
list | List all versions | list . |
show | Show version details | show . 1.0.0 |
rollback | Rollback to version | rollback . 1.0.0 |
bump | Calculate next version | bump 1.0.0 minor |
help | Show help | help |
Exit Codes
0: Success1: General error2: Invalid arguments3: Version not found4: Validation failed
Dependencies
Required:
bash(4.0+)jq(for JSON parsing)git(optional, for git integration)
Optional:
diff(for version comparison)tar/zip(for archiving)
Contributing
To improve this skill:
1. Make your changes 2. Test thoroughly 3. Update documentation 4. Create new version 5. Update changelog
# After making changes
./scripts/version_manager.sh create . 1.1.0 "Your improvements"License
This skill is part of the Claude Code framework.
Support
For issues or questions:
- Check the troubleshooting section
- Review SKILL.md for detailed documentation
- Consult Claude Code documentation
- Open an issue in the repository
Version History
See .versions/CHANGELOG.md for complete version history.
#!/bin/bash
# version_manager.sh
# Version management script for Claude Code skills
# Handles version creation, tagging, rollback, and changelog management
set -euo pipefail
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
VERSION_DIR=".versions"
CHANGELOG_FILE="CHANGELOG.md"
METADATA_FILE="metadata.json"
# Helper functions
log_info() {
echo -e "${BLUE}ℹ${NC} $1"
}
log_success() {
echo -e "${GREEN}✓${NC} $1"
}
log_warning() {
echo -e "${YELLOW}⚠${NC} $1"
}
log_error() {
echo -e "${RED}✗${NC} $1" >&2
}
# Validate semantic version format
validate_version() {
local version="$1"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
log_error "Invalid version format: $version"
log_error "Expected format: MAJOR.MINOR.PATCH (e.g., 1.2.3)"
return 1
fi
return 0
}
# Parse version components
parse_version() {
local version="$1"
echo "$version" | sed -E 's/^v?([0-9]+)\.([0-9]+)\.([0-9]+)$/\1 \2 \3/'
}
# Bump version number
bump_version() {
local current="$1"
local bump_type="$2"
read -r major minor patch <<< "$(parse_version "$current")"
case "$bump_type" in
major)
echo "$((major + 1)).0.0"
;;
minor)
echo "${major}.$((minor + 1)).0"
;;
patch)
echo "${major}.${minor}.$((patch + 1))"
;;
*)
log_error "Invalid bump type: $bump_type"
log_error "Expected: major, minor, or patch"
return 1
;;
esac
}
# Initialize version management for a skill
init_version_management() {
local skill_path="$1"
local initial_version="${2:-0.1.0}"
log_info "Initializing version management for skill at: $skill_path"
# Validate skill path
if [[ ! -d "$skill_path" ]]; then
log_error "Skill directory not found: $skill_path"
return 1
fi
if [[ ! -f "$skill_path/SKILL.md" ]]; then
log_error "SKILL.md not found in: $skill_path"
return 1
fi
# Validate initial version
validate_version "$initial_version" || return 1
# Create version directory
local version_root="$skill_path/$VERSION_DIR"
mkdir -p "$version_root"
# Initialize changelog if it doesn't exist
if [[ ! -f "$version_root/$CHANGELOG_FILE" ]]; then
cat > "$version_root/$CHANGELOG_FILE" <<EOF
# Changelog
All notable changes to this skill will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [$initial_version] - $(date -u +"%Y-%m-%d")
### Added
- Initial version of skill
- Version management initialized
EOF
log_success "Created $CHANGELOG_FILE"
fi
# Create initial version
create_version "$skill_path" "$initial_version" "Initial version"
log_success "Version management initialized"
log_info "Version directory: $version_root"
log_info "Initial version: v$initial_version"
}
# Create a new version snapshot
create_version() {
local skill_path="$1"
local version="$2"
local description="${3:-No description provided}"
validate_version "$version" || return 1
local version_root="$skill_path/$VERSION_DIR"
local version_dir="$version_root/v$version"
# Check if version already exists
if [[ -d "$version_dir" ]]; then
log_error "Version v$version already exists"
log_info "Use a different version number or delete the existing version"
return 1
fi
log_info "Creating version v$version..."
# Create version directory
mkdir -p "$version_dir"
# Copy current files
cp "$skill_path/SKILL.md" "$version_dir/"
# Copy scripts directory if it exists
if [[ -d "$skill_path/scripts" ]]; then
cp -r "$skill_path/scripts" "$version_dir/"
log_success "Copied scripts directory"
fi
# Copy templates directory if it exists
if [[ -d "$skill_path/templates" ]]; then
cp -r "$skill_path/templates" "$version_dir/"
log_success "Copied templates directory"
fi
# Copy resources directory if it exists
if [[ -d "$skill_path/resources" ]]; then
cp -r "$skill_path/resources" "$version_dir/"
log_success "Copied resources directory"
fi
# Get git commit hash if in a git repo
local commit_hash="unknown"
if git rev-parse --git-dir > /dev/null 2>&1; then
commit_hash=$(git rev-parse HEAD 2>/dev/null || echo "unknown")
fi
# Get author from git config or use default
local author="Claude <noreply@anthropic.com>"
if git config user.name > /dev/null 2>&1; then
local git_name=$(git config user.name)
local git_email=$(git config user.email)
author="$git_name <$git_email>"
fi
# Create metadata file
local tracked_files=("SKILL.md")
[[ -d "$skill_path/scripts" ]] && tracked_files+=("scripts/")
[[ -d "$skill_path/templates" ]] && tracked_files+=("templates/")
[[ -d "$skill_path/resources" ]] && tracked_files+=("resources/")
# Build files array for JSON
local files_json="["
for file in "${tracked_files[@]}"; do
files_json+="\"$file\","
done
files_json="${files_json%,}]" # Remove trailing comma
cat > "$version_dir/$METADATA_FILE" <<EOF
{
"version": "$version",
"timestamp": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
"author": "$author",
"commit": "$commit_hash",
"description": "$description",
"files_tracked": $files_json
}
EOF
log_success "Created metadata file"
log_success "Version v$version created successfully"
log_info "Location: $version_dir"
log_info "Files tracked: ${tracked_files[*]}"
# Create git tag if in a git repo
if git rev-parse --git-dir > /dev/null 2>&1; then
if git tag -a "v$version" -m "$description" 2>/dev/null; then
log_success "Created git tag: v$version"
else
log_warning "Git tag v$version already exists or could not be created"
fi
fi
}
# List all versions
list_versions() {
local skill_path="$1"
local version_root="$skill_path/$VERSION_DIR"
if [[ ! -d "$version_root" ]]; then
log_error "Version management not initialized for this skill"
log_info "Run: init_version_management \"$skill_path\""
return 1
fi
echo ""
echo "Version History for skill at: $skill_path"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
printf "%-10s | %-20s | %s\n" "VERSION" "DATE" "DESCRIPTION"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Find all version directories and sort
for version_dir in "$version_root"/v*/; do
if [[ -f "$version_dir/$METADATA_FILE" ]]; then
local version=$(jq -r '.version' "$version_dir/$METADATA_FILE")
local timestamp=$(jq -r '.timestamp' "$version_dir/$METADATA_FILE")
local description=$(jq -r '.description' "$version_dir/$METADATA_FILE")
# Format timestamp
local date_formatted=$(date -d "$timestamp" "+%Y-%m-%d %H:%M" 2>/dev/null || echo "$timestamp")
# Truncate description if too long
if [[ ${#description} -gt 50 ]]; then
description="${description:0:47}..."
fi
printf "%-10s | %-20s | %s\n" "v$version" "$date_formatted" "$description"
fi
done | sort -V
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
}
# Show version details
show_version() {
local skill_path="$1"
local version="$2"
# Remove 'v' prefix if present
version="${version#v}"
local version_dir="$skill_path/$VERSION_DIR/v$version"
if [[ ! -d "$version_dir" ]]; then
log_error "Version v$version not found"
return 1
fi
if [[ ! -f "$version_dir/$METADATA_FILE" ]]; then
log_error "Metadata file not found for version v$version"
return 1
fi
echo ""
echo "Version Details: v$version"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Parse and display metadata
local metadata=$(cat "$version_dir/$METADATA_FILE")
echo "Version: $(echo "$metadata" | jq -r '.version')"
echo "Date: $(echo "$metadata" | jq -r '.timestamp')"
echo "Author: $(echo "$metadata" | jq -r '.author')"
echo "Commit: $(echo "$metadata" | jq -r '.commit')"
echo ""
echo "Description:"
echo " $(echo "$metadata" | jq -r '.description')"
echo ""
echo "Files Tracked:"
echo "$metadata" | jq -r '.files_tracked[]' | sed 's/^/ - /'
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
}
# Rollback to a previous version
rollback_version() {
local skill_path="$1"
local target_version="$2"
local create_backup="${3:-yes}"
# Remove 'v' prefix if present
target_version="${target_version#v}"
local version_dir="$skill_path/$VERSION_DIR/v$target_version"
if [[ ! -d "$version_dir" ]]; then
log_error "Target version v$target_version not found"
return 1
fi
log_warning "ROLLBACK OPERATION"
log_warning "This will replace current files with version v$target_version"
echo ""
# Create backup if requested
if [[ "$create_backup" == "yes" ]]; then
local backup_dir="$skill_path/$VERSION_DIR/backup-$(date -u +"%Y%m%d-%H%M%S")"
mkdir -p "$backup_dir"
log_info "Creating backup of current state..."
cp "$skill_path/SKILL.md" "$backup_dir/" 2>/dev/null || true
[[ -d "$skill_path/scripts" ]] && cp -r "$skill_path/scripts" "$backup_dir/" 2>/dev/null || true
[[ -d "$skill_path/templates" ]] && cp -r "$skill_path/templates" "$backup_dir/" 2>/dev/null || true
[[ -d "$skill_path/resources" ]] && cp -r "$skill_path/resources" "$backup_dir/" 2>/dev/null || true
log_success "Backup created at: $backup_dir"
fi
log_info "Restoring files from v$target_version..."
# Restore files
cp "$version_dir/SKILL.md" "$skill_path/"
log_success "Restored SKILL.md"
# Restore scripts
if [[ -d "$version_dir/scripts" ]]; then
rm -rf "$skill_path/scripts"
cp -r "$version_dir/scripts" "$skill_path/"
log_success "Restored scripts/"
fi
# Restore templates
if [[ -d "$version_dir/templates" ]]; then
rm -rf "$skill_path/templates"
cp -r "$version_dir/templates" "$skill_path/"
log_success "Restored templates/"
fi
# Restore resources
if [[ -d "$version_dir/resources" ]]; then
rm -rf "$skill_path/resources"
cp -r "$version_dir/resources" "$skill_path/"
log_success "Restored resources/"
fi
log_success "Rollback to v$target_version completed successfully"
if [[ "$create_backup" == "yes" ]]; then
log_info "Previous state backed up to: $backup_dir"
fi
}
# Main command dispatcher
main() {
local command="${1:-help}"
case "$command" in
init)
if [[ $# -lt 2 ]]; then
log_error "Usage: $0 init <skill_path> [initial_version]"
return 1
fi
init_version_management "${2}" "${3:-0.1.0}"
;;
create)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 create <skill_path> <version> [description]"
return 1
fi
create_version "${2}" "${3}" "${4:-No description provided}"
;;
list)
if [[ $# -lt 2 ]]; then
log_error "Usage: $0 list <skill_path>"
return 1
fi
list_versions "${2}"
;;
show)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 show <skill_path> <version>"
return 1
fi
show_version "${2}" "${3}"
;;
rollback)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 rollback <skill_path> <version> [create_backup]"
return 1
fi
rollback_version "${2}" "${3}" "${4:-yes}"
;;
bump)
if [[ $# -lt 3 ]]; then
log_error "Usage: $0 bump <current_version> <major|minor|patch>"
return 1
fi
bump_version "${2}" "${3}"
;;
help|--help|-h)
cat <<EOF
Version Manager - Claude Code Skill Version Management
USAGE:
$0 <command> [arguments]
COMMANDS:
init <skill_path> [version] Initialize version management (default: 0.1.0)
create <skill_path> <version> [desc] Create new version snapshot
list <skill_path> List all versions
show <skill_path> <version> Show version details
rollback <skill_path> <version> Rollback to previous version
bump <version> <major|minor|patch> Calculate next version number
help Show this help message
EXAMPLES:
$0 init ./skills/my-skill 0.1.0
$0 create ./skills/my-skill 1.0.0 "Initial release"
$0 list ./skills/my-skill
$0 show ./skills/my-skill 1.0.0
$0 rollback ./skills/my-skill 1.0.0
$0 bump 1.0.0 minor
EOF
;;
*)
log_error "Unknown command: $command"
log_info "Run '$0 help' for usage information"
return 1
;;
esac
}
# Run main if script is executed directly
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
main "$@"
fi
Changelog
All notable changes to this skill will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
Added
- Features that have been added but not yet released
Changed
- Changes to existing functionality
Deprecated
- Features that will be removed in upcoming releases
Removed
- Features that have been removed
Fixed
- Bug fixes
Security
- Security improvements or vulnerability fixes
---
[1.0.0] - YYYY-MM-DD
Added
- Initial release
- Core functionality implementation
- Basic documentation
Changed
- N/A (initial release)
Fixed
- N/A (initial release)
---
Template Instructions
When adding a new version, follow this format:
## [X.Y.Z] - YYYY-MM-DD
### Added
- New feature A
- New feature B
### Changed
- Modified behavior of feature C
- Updated documentation for D
### Deprecated
- Feature E will be removed in version X+1.0.0
### Removed
- Removed deprecated feature F
### Fixed
- Fixed bug in feature G (#issue-number)
- Corrected typo in documentation
### Security
- Fixed security vulnerability in feature H (CVE-YYYY-XXXXX)Version Numbering Guide
Given a version number MAJOR.MINOR.PATCH, increment the:
1. MAJOR version when you make incompatible API changes 2. MINOR version when you add functionality in a backward compatible manner 3. PATCH version when you make backward compatible bug fixes
Categories Guide
- Added: New features
- Changed: Changes in existing functionality
- Deprecated: Soon-to-be removed features
- Removed: Now removed features
- Fixed: Bug fixes
- Security: Vulnerability fixes
Best Practices
1. Keep entries concise: One line per change when possible 2. Use present tense: "Add feature" not "Added feature" 3. Link to issues: Reference issue/PR numbers when applicable 4. Group related changes: Keep related items together 5. Date format: Use ISO 8601 (YYYY-MM-DD) 6. Keep unreleased section: Always maintain an [Unreleased] section 7. Add comparison links: Link version tags for easy diff viewing
Example with Links
## [1.2.0] - 2025-11-18
### Added
- New rollback safety checks ([#123](https://github.com/org/repo/pull/123))
- Automatic backup creation before destructive operations
### Changed
- Improved error messages in validator ([#124](https://github.com/org/repo/pull/124))
- Updated documentation structure
### Fixed
- Rollback file permission issues ([#125](https://github.com/org/repo/issues/125))
- Changelog formatting errors
[1.2.0]: https://github.com/org/repo/compare/v1.1.0...v1.2.0Comparison Links
Add at the bottom of the file:
[Unreleased]: https://github.com/org/repo/compare/v1.2.0...HEAD
[1.2.0]: https://github.com/org/repo/compare/v1.1.0...v1.2.0
[1.1.0]: https://github.com/org/repo/compare/v1.0.0...v1.1.0
[1.0.0]: https://github.com/org/repo/releases/tag/v1.0.0