rdd-split-commits-by-diff
Use when the user asks to split existing changes into multiple commits. Triggers: "split commits", "separar commits", "commits separados", "commits por assunto", "organizar commits". Always use this skill when the working tree has mixed changes that should be committed in logical groups.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-04
- Stars
- ★ 4
- Forks
- 1
01 前言 Front Matter
- name
- rdd-split-commits-by-diff
- description
- Use when the user asks to split existing changes into multiple commits. Triggers: "split commits", "separar commits", "commits separados", "commits por assunto", "organizar commits". Always use this skill when the working tree has mixed changes that should be committed in logical groups.
03 SKILL.md 正文
Split Commits by Diff
Use this skill to turn a mixed working tree into clean, scoped commits.
Lê (upstream)
- Estado do working tree do repo alvo:
git statusegit diff(incluigit diff --cached). - Histórico recente de commits do repo alvo, para alinhar o estilo das mensagens.
Gera (downstream)
- Plano de commits agrupados por assunto (intenção), apresentado antes de tocar no index.
- Commits atômicos no repo alvo — staging por paths explícitos (
git add <file>/git add -p) e mensagens Conventional Commits no padrão do repo.
Nunca edita
- Conteúdo dos arquivos — atua apenas no index/staging e nas mensagens de commit.
git add -A/git add .— staging sempre por paths explícitos.- Push sem pedido explícito do operador (assim como reescrita de histórico e comandos destrutivos).
Modo de erro
- Conflitos/unmerged paths ou working tree com conversas em andamento → ABORTA sem commitar e reporta ao operador.
- Se não houver mudanças reais → informa "nada a commitar" e encerra (nunca cria commit vazio).
Outcomes
- Produce a commit plan before touching the index.
- Keep each commit focused on one intent (feature, fix, refactor, docs, test, chore).
- Preserve user changes while avoiding accidental staging.
- Create clear commit messages that explain why each commit exists.
Safety Rules
- Never run destructive git commands (
reset --hard,checkout --, force push) unless the user explicitly asks. - Never rewrite history (
commit --amend, rebase) unless the user explicitly asks. - Never commit secrets or credential-like files (
.env, key files, token dumps). - If pre-commit hooks modify files, include those modifications in a new commit unless the user asks otherwise.
- If there are no real changes, do not create an empty commit.
Workflow
1) Inspect the repository state
Run these first:
git status --short
git diff
git diff --cached
git log -n 12 --pretty=format:"%h %s"
Understand:
- Which files are changed and whether they are staged or unstaged.
- Whether the changes represent one concern or multiple concerns.
- The repository's commit message style.
2) Build a commit grouping plan
Create a grouping proposal before staging:
- Group by intent, not only by file path.
- Keep dependent changes together when splitting would break tests/build.
- Prefer 2-6 commits for a medium mixed diff. Avoid over-splitting tiny edits.
For each proposed group, define:
- Group name (short)
- Files/hunks included
- Rationale (why this grouping is coherent)
- Commit message draft
If one hunk belongs to a different intent than the rest of the file, use patch staging.
3) Stage only the intended changes for one group
Default staging strategy:
- Full-file stage when file is single-intent:
git add <file> - Hunk-level stage when file is mixed-intent:
git add -p <file>
If interactive hunk selection is unavailable in the runtime, use this fallback:
- Stage full file.
- Unstage unintended hunks or file parts with
git restore --stagedfor specific files. - Iterate until
git diff --cachedmatches the current group exactly.
4) Commit the current group
Commit with a concise message aligned to repo style.
Message guidance:
- First line: short imperative summary.
- Optional body: 1-2 lines explaining why.
- Prefer semantic prefixes only if repository already uses them.
Example styles:
fix(auth): avoid duplicate refresh token writesrefactor(blog): extract locale normalization helperdocs: clarify cache invalidation workflow
5) Validate and continue
After each commit:
git show --stat --oneline -1
git status --short
Then repeat staging and commit for the next group until complete.
6) Final verification
At the end, run:
git log --oneline -n <number_of_new_commits>
git status
Report:
- Number of commits created
- Commit subjects in order
- Remaining uncommitted files (if any)
Decision Heuristics
When splitting is ambiguous, prioritize in this order:
- Keep the repository buildable/testable after each commit.
- Keep one conceptual change per commit.
- Keep reviewer readability high.
- Minimize risky partial staging.
Do not force perfect atomicity if it causes fragile or misleading commits.
Communication Contract
When invoked, communicate in this sequence:
- Briefly summarize current diff shape.
- Show proposed commit groups.
- Execute staging + commit per group.
- Report final commit list and remaining state.
Be decisive. Only ask for user input when there are multiple equally valid split strategies that materially change history.
04 同仓库更多 Skills
rdd-wiki-lint
Audita integridade dos artefatos RDD: contradições entre seções, artefatos órfãos, referências cruzadas quebradas, links internos inválidos e drift de estrutura. Complementa rdd-validate (que valida a DAG de RNs → downstreams) e rdd-decision-audit (que valida DECISIONS.md) com foco em integridade documental dos artefatos individualmente. Use quando o usuário pedir "lint dos documentos", "verificar integridade dos artefatos", "wiki lint", "contradições nos docs" ou "validar estrutura".
rdd-vps-troubleshoot
Diagnóstico guiado por sintoma para VPS da organização já configurada — container unhealthy / healthcheck expirando, GHCR denied/unauthorized no pull, git "could not read Username for 'https://github.com'", GitHub Actions (appleboy/ssh-action) falhando SSH (handshake failed, ParsePrivateKey), services systemd duplicados do cloudflared em activating (auto-restart), requisições caindo no servidor errado (tunnel compartilhado), porta ocupada, logs (journalctl / docker logs), conectividade (curl local vs público, ss, nc) e banco vazio / migrations não aplicadas. Base de conhecimento: runbook.md nesta pasta (sintomas genéricos de deploy em VPS; lições de produção da organização no pack `rules/<pack-da-organizacao>.md` — IMP-105). Modo guiado — sugere comandos com explicação; o operador executa na VPS. Use quando o usuário reportar "container unhealthy", "deploy falhou", "ssh action erro", "ghcr denied", "tunnel não responde", "banco vazio", "sem tabelas", "service duplicado", "vps com problema" ou pedir troubleshooting de deploy.
rdd-vps-setup
Wizard guiado de setup de VPS nova (OS do perfil — ex.: Amazon Linux) para hospedar uma API — atualização do sistema, Docker + Compose + buildx, permissões de arquivos, autenticação no registry do perfil (ex.: ghcr.io), git via SSH (deploy keys), chave SSH dedicada do GitHub Actions (appleboy/ssh-action), tunnel Cloudflare EXCLUSIVO por servidor + route DNS (domínio do perfil), tunnels como serviço systemd (autostart), logging do cloudflared com rotação, pipeline completo de deploy (push main → build → registry → ssh-action → deploy.sh) e backup automatizado (RClone + cronie + canal de alerta do perfil). Base de conhecimento validada: pack da organização em `rules/<pack-da-organizacao>.md` §infra-vps-setup (IMP-105). Modo guiado — sugere comandos com explicação; o operador executa na VPS. Use quando o usuário pedir "setup de VPS", "configurar VPS nova", "preparar servidor para deploy", "tunnel cloudflare", "ghcr", "deploy key", "backup rclone", "docker compose na vps" ou "pipeline de deploy na VPS".
rdd-validate
Percorre o grafo de documentos do projeto e valida integridade: RN sem downstream esperado, ID quebrado, CR aprovado sem reflexo. Gera relatório VALIDATION_REPORT.md. Suporta flag --fix para auto-correção. Use quando o usuário pedir "validar integridade", "checar a DAG", "validar referências cruzadas" ou "validação do módulo".
rdd-ui-spec
Gera UI_SPEC.md a partir das RNs em REQUIREMENTS.md. Descreve telas, componentes, fluxos de navegação, validações de frontend e regras de exibição condicional. Use quando o usuário pedir "especificação de UI", "spec de telas", "layout de formulários" ou "fluxo de navegação".
rdd-ui-capture
Captura evidência visual em runtime do sistema legado para migração (golden master de UI) via MCP Playwright — screenshots por rota/estado, requisições de rede observadas e erros de console, gravados em reverse/ui/ com manifesto reverse/UI_CAPTURE.md e candidatas visuais na fila reverse/CANDIDATES.md. Complemento runtime da engenharia reversa estática (IMP-144). Use quando o usuário pedir "captura visual", "golden master de UI", "screenshots do legado", "captura de UI" ou "ui capture".