---
name: crear-rama-git-convenciones
description: Automatiza la creación de ramas Git siguiendo convenciones estandarizadas de nomenclatura (feat, fix, chore, etc.), detectando el contexto del trabajo y eligiendo la base correcta sin intervención manual.
argument-hint: '[optional description of the work]'
license: Apache-2.0
metadata:
  id: d6b07c74
  slug: crear-rama-git-convenciones
  titulo: "Crear Rama Git con Convenciones de Nomenclatura"
  servicio: Web
  categoria_recurso: Automatizacion
  tipo: automatizacion
  nivel: basico
  idioma: es
  idioma_original: en
  acceso: gratis
  precio_eur: 0
  plataformas: [git, bash, cli]
  dependencias: [git]
  licencia: { spdx: Apache-2.0, redistribuible: true, uso_comercial: true }
  fuente:
    repo: getsentry/skills
    url: https://github.com/getsentry/skills/tree/main/skills/create-branch
    commit: b39c7c4
    autor: getsentry
    nombre_original: create-branch
    duplicados_en: []
  seguridad: { veredicto: seguro, riesgo: bajo, escaneado: "2026-06-14", motor: "grep-estatico+auditor-llm" }
  ficha:
    que_hace: "Crea una rama Git con nombre estandarizado clasificando el tipo de cambio (feat, fix, ref, chore, etc.) a partir del contexto del diff o una descripción proporcionada."
    como_lo_hace: "Inspecciona el diff y estado del repositorio, clasifica el tipo de trabajo, genera un nombre kebab-case y ejecuta git checkout -b de forma no interactiva."
  content_hash: "d6b07c7466e4a7269eb575bd1812c1fb07c73e9d2f16f61904ac181664f573fe"
  version: 1.0.0
---

# Create Branch

Create a git branch following Sentry naming conventions.
Keep this workflow non-interactive unless the user explicitly asks to choose the name manually.

## Workflow

1. Resolve the work description:
   - If `$ARGUMENTS` is present, use it
   - Otherwise inspect:
     ```bash
     git diff
     git diff --cached
     git status --short
     ```
   - If there are local changes, derive a short description from the diff
   - If there are no local changes, use a generic description like `repo-maintenance`, `tooling-update`, or `work-in-progress`

2. Classify the branch type:

| Type | Use when |
|------|----------|
| `feat` | New functionality |
| `fix` | Broken behavior now works |
| `ref` | Behavior stays the same, structure changes |
| `chore` | Maintenance of existing tooling/config |
| `perf` | Same behavior, faster |
| `style` | Visual or formatting only |
| `docs` | Documentation only |
| `test` | Tests only |
| `ci` | CI/CD config |
| `build` | Build system |
| `meta` | Repo metadata |
| `license` | License changes |

   When unsure: use `feat` for new things, `ref` for restructuring, `chore` for maintenance.

3. Generate `<type>/<short-description>`.
   Keep `<short-description>` kebab-case, ASCII-only, and ideally 3 to 6 words.

4. Choose the base without prompting:
   ```bash
   git branch --show-current
   git remote | grep -qx origin && echo origin || git remote | head -1
   git symbolic-ref refs/remotes/<remote>/HEAD 2>/dev/null | sed 's|refs/remotes/<remote>/||' | tr -d '[:space:]'
   ```
   - If default branch detection fails, fall back to `main`, then `master`, then the current branch
   - If on a detached HEAD, branch from the current commit
   - If already on a non-default branch, branch from the current branch
   - Only switch to the default branch when the user explicitly asks

5. Avoid collisions by appending `-2`, `-3`, and so on until the name is unused locally and remotely.

6. Create the branch:
   ```bash
   git checkout -b <branch-name>
   ```
   Report the final branch name, but do not stop for confirmation.

## References

- [Sentry Branch Naming](https://develop.sentry.dev/sdk/getting-started/standards/code-submission/#branch-naming)
