Claude Skills Guide

Claude Code for Git Tagging Workflow Tutorial Guide

Git tagging is essential for marking specific commits as important milestones—releases, versions, or significant changes. When combined with Claude Code, you can create powerful skills that automate tagging workflows, enforce naming conventions, and integrate seamlessly with CI/CD pipelines. This guide walks you through building a Git tagging skill for Claude Code.

Why Automate Git Tagging?

Manual Git tagging is error-prone and inconsistent. Different team members may use different tag formats (v1.0.0 vs 1.0.0 vs release-1.0.0), forget to annotate tags, or miss pushing tags to remote repositories. A Claude Code skill can:

Building Your First Git Tagging Skill

Let’s create a skill that handles semantic versioning tags with ease.

Skill Structure

Create a new file git-tagging-skill.md in your skills directory:

---
name: git-tagging
description: Manage Git tags with semantic versioning and automated workflows
tools: [bash, read_file, write_file]
version: 1.0.0
---

# Git Tagging Workflow

This skill helps you create, manage, and deploy Git tags following semantic versioning.

## Available Commands

- **Create version tag**: Creates an annotated tag for the specified version
- **List tags**: Shows all tags in the repository
- **Delete tag**: Removes a local or remote tag
- **Push tags**: Pushes all tags to remote repository

## Tag Naming Convention

All tags must follow semantic versioning (MAJOR.MINOR.PATCH):
- MAJOR: Incompatible API changes
- MINOR: New functionality (backward compatible)
- PATCH: Bug fixes

Use annotated tags for releases with messages.

This basic skill structure provides the foundation. Now let’s add the actual automation logic.

Implementing Tag Creation

The core of a tagging skill is the version management. Here’s how to implement smart tag creation:

Version Increment Logic

Add this to your skill for automatic version bumping:

import re
from pathlib import Path

def get_latest_tag():
    """Get the most recent tag from Git"""
    import subprocess
    result = subprocess.run(
        ['git', 'describe', '--tags', '--abbrev=0'],
        capture_output=True, text=True
    )
    if result.returncode == 0:
        return result.stdout.strip()
    return None

def parse_version(version_str):
    """Parse semantic version string into components"""
    match = re.match(r'v?(\d+)\.(\d+)\.(\d+)', version_str)
    if match:
        return tuple(map(int, match.groups()))
    return (0, 0, 0)

def bump_version(current, bump_type='patch'):
    """Increment version based on bump type"""
    major, minor, patch = parse_version(current or '0.0.0')
    
    if bump_type == 'major':
        return f'v{major + 1}.0.0'
    elif bump_type == 'minor':
        return f'v{major}.{minor + 1}.0'
    else:  # patch
        return f'v{major}.{minor}.{patch + 1}'

This version management can be invoked from your skill to automatically determine the next version based on the last tag.

Creating Annotated Tags

Annotated tags store metadata and are preferred for releases. Here’s the implementation:

# Create an annotated tag with message
git tag -a {{version}} -m "Release {{version}}: {{description}}"

# Verify the tag
git show {{version}}

# Push tag to remote
git push origin {{version}}

Replace {{version}} and {{description}} with actual values when invoking.

Advanced Tagging Workflows

Pre-Release Tags

For beta, alpha, or RC releases, implement pre-release handling:

# Create pre-release tag
git tag -a v1.0.0-beta.1 -m "Beta release v1.0.0-beta.1"

# Create RC tag
git tag -a v2.0.0-rc.1 -m "Release candidate v2.0.0-rc.1"

# List only pre-release tags
git tag --list '*-*'

Changelog Generation

Generate changelogs between tags automatically:

# Generate changelog between two tags
git log --pretty=format:"- %s (%h)" {{previous_tag}}..{{current_tag}}

# Or use GitHub's changelog format
git log {{previous_tag}}..{{current_tag}} --pretty=format:"* %s by @%an" --since="{{date}}"

Signing Tags

For production releases, GPG-signed tags provide verification:

# Create signed tag
git tag -s v1.0.0 -m "Signed release v1.0.0"

# Verify signed tag
git tag -v v1.0.0

Configure your GPG key globally:

git config --global user.signingkey YOUR_KEY_ID
git config --global tag.forceSignAnnotated true

Integrating with CI/CD

Git tags trigger deployments in most CI/CD systems. Here’s how to leverage that:

GitHub Actions Trigger

on:
  push:
    tags:
      - 'v*.*.*'

This automatically runs your workflow when any semantic version tag is pushed.

Deployment Pipeline Example

# Check if this is a production release
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
  echo "Deploying production release..."
  # Add deployment commands
fi

Best Practices for Tagging Skills

  1. Always use annotated tags - They store dates, messages, and can be signed
  2. Prefix tags with ‘v’ - Follow the common convention (v1.0.0)
  3. Never delete tags from shared remotes - This causes synchronization issues
  4. Use pre-release tags - Test in staging before production releases
  5. Document your versioning strategy - Include it in your skill’s README

Error Handling

Your skill should handle common tagging errors gracefully:

Conclusion

A well-designed Claude Code skill for Git tagging transforms a manual, error-prone process into a streamlined workflow. By enforcing conventions, automating version increments, and integrating with CI/CD pipelines, you ensure consistent releases and reduce deployment friction.

Start with the basic skill structure, add version management logic, and progressively enhance with changelog generation, signing, and CI/CD integration as your needs evolve.