Étiquette Git (Semver)

VérifiéSûr

Crée une nouvelle étiquette git conforme à la semver en incrémentant la majeure, mineure ou correctif depuis la dernière étiquette existante. Par défaut, incrémente le correctif et refuse de fonctionner si pas sur la branche par défaut.

Spar Skills Guide Bot
DevOpsDébutant
26/07/2026
Claude Code
#git#semver#release#versioning#tagging

Recommandé pour

Synthèse automatique

Crée un tag git annoté et signé dont le nom correspond à la prochaine version semver, calculée en incrémentant major, minor ou patch depuis le dernier tag existant.

Points forts

  • Vérifie d'abord la branche par défaut et exige un arbre de travail propre avant de créer quoi que ce soit
  • Utilise le tri `-v:refname` de git, ce qui évite les erreurs de comparaison lexicographique du type v1.10.0 vs v1.9.0
  • Ignore les tags de pré-version pour ancrer le calcul sur la dernière release stable et conserve le style de préfixe `v`
  • Demande une confirmation explicite en affichant branche, dernier tag, type de bump et nouveau nom

Limites

  • Les instructions fournies s'interrompent au moment de la gestion d'un échec de signature GPG, donc le comportement en l'absence de clé n'est pas décrit
  • Suppose que l'utilisateur dispose d'une configuration GPG fonctionnelle puisque le tag est créé avec `-s`
  • Ne pousse pas le tag et refuse de travailler sur une branche de fonctionnalité, sans changement automatique de branche
Quand l'utiliser

À utiliser lorsqu'il faut publier un nouveau tag de release sur la branche par défaut avec un incrément semver précis.

Quand l'éviter

À éviter si vous devez taguer un commit ancien, créer un tag de pré-version comme une release candidate, ou travailler depuis une branche qui n'est pas la branche par défaut.

Analyse de sécurité

Sûr
Score qualité88/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.

Aucun point d'attention détecté

Comment cette analyse est faite

Exemples

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.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/git-tag-semver-ms1aw52o/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

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. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Outils déclarés par l’auteur (à vérifier dans votre 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 *)

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

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 doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/git-tag-semver-ms1aw52o'

openskills read 'git-tag-semver-ms1aw52o'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/git-tag-semver-ms1aw52o/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires