Git Tag (Semver)

VerifiedSafe

Create a new semver-compliant git tag by bumping major, minor, or patch from the latest existing tag. Defaults to a patch bump and refuses to run unless on the default branch.

Sby Skills Guide Bot
DevOpsBeginner
7/26/2026
Claude Code
#git#semver#release#versioning#tagging

Recommended for

Automated summary

Creates an annotated, signed git tag named after the next semver version, computed by bumping major, minor, or patch from the latest existing tag.

Strengths

  • Checks the default branch and requires a clean working tree before touching anything
  • Relies on git's `-v:refname` version sort, so v1.10.0 correctly ranks above v1.9.0
  • Skips pre-release tags to anchor the bump on the last stable release and preserves the existing `v` prefix style
  • Shows branch, latest tag, bump type, and new tag name and waits for explicit confirmation

Limitations

  • The provided instructions cut off at the GPG signing-failure branch, so behavior without a signing key is unspecified
  • Assumes a working GPG setup because the tag is always created with `-s`
  • Does not push the tag and aborts on feature branches rather than switching branches for you
When to use it

Use it when you need to cut a new release tag on the default branch with a specific semver increment.

When not to use it

Avoid it when you need to tag an older commit, produce a pre-release such as a release candidate, or tag from a branch other than the default one.

Security analysis

Safe
Quality score88/100

The skill only uses read-only git commands (tag, describe, for-each-ref, rev-parse, symbolic-ref, remote, status, branch, log, show-ref) plus git fetch and git tag creation. It explicitly excludes git push and never deletes or force-moves tags, aborts on existing tags, and refuses to auto-switch branches. No destructive, exfiltration, or obfuscated behavior is present.

No concerns found

How this analysis is made

Examples

Patch release
/git-tag
Minor bump
/git-tag minor
Major version
Create the next major version tag for this repo on main

name: git-tag description: Create a new semver-compliant git tag by bumping major, minor, or patch from the latest existing tag. Defaults to a patch bump and refuses to run unless on the default branch. argument-hint: "[major|minor|patch]" allowed-tools: Read, Glob, Grep, Bash(git tag *), Bash(git describe *), Bash(git for-each-ref *), Bash(git rev-parse *), Bash(git symbolic-ref *), Bash(git remote *), Bash(git fetch *), Bash(git status *), Bash(git branch *), Bash(git log *), Bash(git show-ref *)

git-tag

Create a new git tag whose name is the next semver version after the latest existing tag.

When to use

  • When the user asks to create a release tag, version tag, or git tag
  • When the user wants to bump the major / minor / patch version
  • When the user runs /git-tag

Argument

The argument selects which component to increment. Only major, minor, or patch are accepted. If the argument is omitted, default to patch. Anything else must be rejected with a clear error message — never silently fall back.

Instructions

  1. Verify the working tree is on the default branch. This is a hard requirement: tags published from feature branches confuse downstream consumers, so abort early if it is not satisfied.

    • Determine the default branch with git symbolic-ref refs/remotes/origin/HEAD (typically resolves to origin/main or origin/master). If origin/HEAD is not set, fall back to git remote show origin and parse the HEAD branch line.
    • Compare against git rev-parse --abbrev-ref HEAD. If they differ, stop and tell the user which branch they are on and which one they need to switch to. Do not switch branches automatically — the user may have uncommitted work.
  2. Make sure the working tree is clean and up to date.

    • Run git status --porcelain. If it returns any output, abort and ask the user to commit or stash first. Tagging on top of a dirty tree creates a tag that does not match what gets pushed.
    • Run git fetch --tags origin so the latest-tag lookup sees tags created by other contributors.
  3. Find the latest semver tag.

    • Use git for-each-ref --sort=-v:refname --format='%(refname:short)' 'refs/tags/v*' 'refs/tags/[0-9]*' to list tags sorted by version order. -v:refname is git's built-in semver-aware sort, which handles v1.10.0 > v1.9.0 correctly (lexicographic sort would get this wrong).
    • Take the first entry that matches strict semver: ^v?(\d+)\.(\d+)\.(\d+)$. Pre-release / build-metadata tags (e.g. v1.2.3-rc.1, v1.2.3+build.4) are skipped for bump base selection — bumping from a pre-release is ambiguous, so we anchor to the last stable release.
    • If no semver tag exists, treat the previous version as v0.0.0 so a patch bump produces v0.0.1, minor produces v0.1.0, and major produces v1.0.0. Tell the user this is the first tag.
  4. Compute the next version. Apply the standard semver bump rules — when a higher component increments, the lower components reset to zero.

    • major: X.Y.Z → (X+1).0.0
    • minor: X.Y.Z → X.(Y+1).0
    • patch: X.Y.Z → X.Y.(Z+1)
    • Preserve the v prefix style of the latest tag. If the latest tag is v1.2.3, the new tag is vX.Y.Z; if it is 1.2.3, the new tag is X.Y.Z. When there is no prior tag, default to the v-prefixed form because it is the more common convention.
  5. Confirm with the user before creating the tag. Show: the current branch, the latest tag, the bump type, and the new tag name. Wait for confirmation. This is the last reversible point — once a tag is pushed it is hard to retract cleanly, so a single confirmation prompt here is worth the friction.

  6. Create an annotated, signed tag.

    • Run git tag -s -a <new-tag> -m "Release <new-tag>". -a makes it an annotated tag (carries author + date + message, which is what release tooling expects), and -s GPG-signs it so consumers can verify provenance.
    • If signing fails because the user has no GPG key configured, report the error verbatim and stop. Do not silently fall back to an unsigned tag — the user explicitly opted into signed releases by using this skill, and a downgrade would be surprising.
  7. Do not push automatically. Print the exact command the user can run to publish it (git push origin <new-tag>) and let them decide. Pushing is irreversible-ish (other clones will fetch it within seconds) and should be an explicit human decision.

Important notes

  • git push is intentionally not in allowed-tools. The user runs the push themselves so they get one final chance to review.
  • Strict semver only: reject pre-release suffixes (-rc.1, -beta) and build metadata (+sha.abc) in the input validation. They are fine to exist as tags in the repo (we just skip past them when finding the bump base), but this skill does not produce them — keeping the surface small avoids the hairy edge cases around pre-release ordering.
  • The "default branch" check uses the remote's HEAD, not a hardcoded main. Some repos still use master, some use develop, and a few use something custom. Reading from origin/HEAD keeps this skill portable.
  • Never delete or move existing tags. If the computed tag already exists (e.g. someone else tagged concurrently between fetch and tag), abort and report it — silently re-pointing a tag would rewrite release history.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/git-tag-semver-ms1aw52o/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/git-tag-semver-ms1aw52o' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/git-tag-semver-ms1aw52o/download' --output '.skill-downloads/git-tag-semver-ms1aw52o/SKILL.md.part' && mv '.skill-downloads/git-tag-semver-ms1aw52o/SKILL.md.part' '.skill-downloads/git-tag-semver-ms1aw52o/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Tools declared by the author (check availability in your agent): Read, Glob, Grep, Bash(git tag *), Bash(git describe *), Bash(git for-each-ref *), Bash(git rev-parse *), Bash(git symbolic-ref *), Bash(git remote *), Bash(git fetch *), Bash(git status *), Bash(git branch *), Bash(git log *), Bash(git show-ref *)

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/git-tag-semver-ms1aw52o/SKILL.md' && test -s '.skill-downloads/git-tag-semver-ms1aw52o/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/git-tag' && cp -R '.skill-downloads/git-tag-semver-ms1aw52o' '.claude/skills/git-tag'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/git-tag-semver-ms1aw52o'

openskills read 'git-tag-semver-ms1aw52o'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/git-tag-semver-ms1aw52o/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills