git-reconciler
Git Reconciler
Skill para sincronizar tu branch de trabajo con main/master de forma segura, detectando conflictos antes de mergear.
Proceso
Paso 1: Verificar estado actual
git status
git branch --show-current
git status --porcelain
IMPORTANTE: Si hay cambios sin commitear, preguntar al usuario:
- Queres hacer commit primero?
- Queres hacer stash?
- Queres descartar cambios?
Paso 2: Identificar branch principal
# Detectar si es main o master (local, sin network call)
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'
Si falla (HEAD no seteado):
git branch -r | grep -E "origin/(main|master)$" | head -1 | sed 's/.*origin\///'
Paso 3: Fetch de cambios remotos
git fetch origin main # o master segun detectado
Paso 4: Analizar divergencia
# Commits en main que no estan en tu branch
git log HEAD..origin/main --oneline
# Commits en tu branch que no estan en main
git log origin/main..HEAD --oneline
# Ver cuanto divergieron
git rev-list --left-right --count origin/main...HEAD
El output de rev-list es: <commits_en_main> <commits_en_branch>
Interpretar:
0 0= Sincronizados, no hay nada que hacer5 0= Main tiene 5 commits nuevos, tu branch esta atras0 3= Tu branch tiene 3 commits, main no tiene nuevos (solo push needed)5 3= Divergencia: main tiene 5 nuevos, tu branch tiene 3
Paso 5: Detectar conflictos potenciales
# Archivos modificados en main desde que divergieron
git diff --name-only HEAD...origin/main
# Archivos modificados en tu branch
git diff --name-only origin/main...HEAD
Comparar las listas. Si hay archivos en comun, hay riesgo de conflicto.
Para verificar conflictos sin mergear (Git 2.38+):
git merge-tree --write-tree HEAD origin/main
Exit code no-cero indica conflictos. Alternativa legacy:
git merge-tree $(git merge-base HEAD origin/main) HEAD origin/main
Si el output contiene <<<<<< o >>>>>>, habra conflictos.
Paso 6: Sugerir estrategia
Presentar al usuario:
Opcion A: Merge (recomendado para branches compartidos)
git merge origin/main
- Preserva historial completo
- Crea commit de merge
- Mas seguro para branches con colaboradores
Opcion B: Rebase (recomendado para branches personales)
git rebase origin/main
- Historial lineal
- Reescribe commits (requiere force push si ya pusheaste)
- Mejor para branches limpios antes de PR
Pregunta:
Estrategia recomendada: [merge/rebase] porque [razon].
Cual preferis? [merge/rebase]
Paso 7: Ejecutar sincronizacion
Si eligio MERGE:
git merge origin/main
Si eligio REBASE:
git rebase origin/main
Paso 8: Manejar conflictos (si ocurren)
Si hay conflictos, listarlos:
git diff --name-only --diff-filter=U
Mostrar al usuario:
Hay conflictos en los siguientes archivos:
- <archivo1>
- <archivo2>
Opciones:
1. Resolver conflictos manualmente (te guio archivo por archivo)
2. Abortar merge: git merge --abort
3. Abortar rebase: git rebase --abort
Para cada archivo con conflicto:
git diff <archivo>
Paso 9: Verificar resultado
git status
git log --oneline -5
Soporte para Worktrees
Si el usuario trabaja con worktrees (patron .worktrees/):
Detectar si estamos en worktree
git rev-parse --is-inside-work-tree
git worktree list
Consideraciones especiales para worktrees
- El main/master suele estar en el repo principal, no en el worktree
- Fetch desde el worktree funciona igual
- Rebase puede ser problematico si el worktree comparte objetos
Flujo para worktree:
pwd # Verificar que estamos en .worktrees/<branch>
git fetch origin main
git merge origin/main
Para ejemplos detallados, leer references/examples.md.
Para tabla de comandos rapida, leer references/quick-ref.md.
More from testacode/llm-toolkit
claude-md-writer
Escribe y mejora archivos CLAUDE.md siguiendo best practices de Anthropic. Este skill se activa cuando el usuario dice "crear CLAUDE.md", "mejorar CLAUDE.md", "actualizar CLAUDE.md", "revisar CLAUDE.md", "escribir instrucciones del proyecto", "create CLAUDE.md", "improve CLAUDE.md", "review CLAUDE.md", "write project instructions", "optimize docs for Claude", "auditar CLAUDE.md", "audit CLAUDE.md", "limpiar CLAUDE.md", "dead weight", o configura un nuevo repositorio.
53doc-writer
Este skill se usa para crear documentos tecnicos organizados en /docs (specs, planes de implementacion, ADRs, documentacion de referencia). Se activa cuando el usuario dice "crear documento", "escribir spec", "documentar esto", "creame una spec", "escribime documentacion", "hacer documentacion", "write a spec", "create documentation", "write an ADR", o quiere agregar documentacion tecnica al proyecto.
44llms-txt-generator
This skill generates llms.txt documentation optimized for AI/LLM consumption. It should be used when the user says "crear llms.txt", "generate llms.txt", "documentar para AI", "document for AI", "crear documentacion para LLMs", "generate docs for LLMs", "make repo readable for Claude", or wants to create structured machine-readable documentation following the llms.txt standard.
40doc-organizer
Este skill se usa cuando el usuario pide "organizar docs", "ordenar documentacion", "mover documentos a carpetas", "categorizar archivos md", "reorganizar documentacion", o cuando hay archivos .md sueltos en docs/ que necesitan ser movidos a subcarpetas tematicas. Organiza y categoriza documentos tecnicos en la estructura correcta del proyecto.
28feature-planner
Planifica features con entrevista estructurada y crea tareas. Este skill se activa cuando el usuario dice "quiero agregar", "planificar feature", "nueva funcionalidad", "implementar esto", "crear plan", "planificar antes de codear", "disenar feature", "como deberia implementar esto", "pensar la arquitectura", o quiere alinear antes de escribir codigo.
27nextjs-project-starter
Creates Next.js projects with a configurable stack (Mantine, Supabase, Zustand, Zod). This skill should be used when the user says "create a Next.js project", "new web project", "bootstrap fullstack app", "start new app", "crear proyecto Next.js", "nuevo proyecto web", "empezar app fullstack", or wants to scaffold a new personal project from scratch.
25