# Commit

> Stage, commit, push, open a PR, and merge to main. Use ONLY on explicit commit intent — user says "commit", "ship it", "push this", "open a PR", "merge to main", "let's commit this", or prefixes with `/commit`. Do NOT auto-invoke on vague end-of-task phrases ("we're done", "wrap up") — those require explicit confirmation first. Runs the standard commit-PR-merge cycle; never force-pushes or skips hooks.

- Skill: `ipea/commit-3` (Agent Skill)
- Install (CLI): `npx skillmds@latest add ipea/commit-3`
- Raw SKILL.md: https://api.skillmd.com/api/skills/ipea/commit-3/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Productivity
- Author: ipea (https://skillmd.com/u/ipea)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/ipea/commit-3

---


# Commit, PR, and Merge

Stage changes, walk the pre-commit checklist, commit with a descriptive message, create a PR, and
merge to main.

## Step 0: Pre-commit checklist

**There is no numeric score and no automated gate in this repo** — no `quality_score.py`, no
`.githooks/pre-commit` (Python is not installed on this machine). This step is the review. Walk it
and report each line.

Skip the whole step when no file under `R/` or `_targets.R` changed — a docs-only commit needs
only the session-log line.

```bash
Rscript -e "targets::tar_validate()"

grep -rnE "['\"][A-Za-z]:[/\\\\]|['\"]~/" R/ _targets.R      # absolute paths
grep -rnE "(^|[^A-Za-z._])[TF]([^A-Za-z0-9._]|$)" R/         # T / F literals
grep -rn "library(\|require(" R/                             # library() in R/
```

```
[ ] tar_validate() exits clean                                    BLOCKING
[ ] No absolute paths in R/ or _targets.R                         BLOCKING
[ ] Invariants INV-1 … INV-9 hold for what changed                BLOCKING
[ ] format = "file" targets still return the paths they wrote     BLOCKING
[ ] No T / F literals; explicit na.rm=; no == on doubles          warn
[ ] Output schema unchanged, or CLAUDE.md updated to match        BLOCKING
[ ] Domain constants unchanged, or the change was approved        BLOCKING
[ ] Session log for today exists in quality_reports/session_logs/ warn
```

For a change of any substance, spawn the **verifier** agent (`Task`, `subagent_type=verifier`) to
run these checks in a fresh context and report PASS / FAIL / NOT VERIFIED per line.

**On a BLOCKING failure:** halt and report. The user may override in words ("commit anyway",
"skip the checklist") with a reason — record the reason in the commit body.

**Never run `tar_make()` as part of this skill.** If a check needs a pipeline run, report it as
`NOT VERIFIED` and let the user decide.

## Step 0b: Documentation parity

If the change touched `selecionar_colunas()`, `schema_cnefe`, the folder-naming logic, or any
domain constant, confirm `CLAUDE.md` was updated in the same commit (INV-1). Apply
[`summary-parity.md`](../../rules/summary-parity.md) to any summary paragraph you edit — re-read
the body, don't patch the flagged phrase.

## Step 1: Check current state

```bash
git status
git diff --stat
git log --oneline -5
```

## Step 2: Create a branch

```bash
git checkout -b <short-descriptive-branch-name>
```

Always a new branch — never commit directly to `main`.

## Step 3: Stage files

Add specific files. **Never `git add -A`**, and never `git add -f`.

```bash
git add <file1> <file2> ...
```

Do not stage `.claude/settings.local.json`, anything under `data/` (address microdata — see
[`confidential-data.md`](../../rules/confidential-data.md)), or any file containing secrets.

## Step 4: Commit

If `$ARGUMENTS` is provided, use it verbatim. Otherwise write a message that explains *why*, not
just *what*. Commit messages in this repo are written in Portuguese, matching the existing log.

```bash
git commit -m "$(cat <<'EOF'
<commit message here>

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: <session url>
EOF
)"
```

## Step 5: Push and create PR

```bash
git push -u origin <branch-name>
gh pr create --title "<short title>" --body "$(cat <<'EOF'
## Summary
<1-3 bullet points>

## Test plan
<what was verified, and what was NOT>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<session url>
EOF
)"
```

## Step 6: Merge and clean up

```bash
gh pr merge <pr-number> --merge --delete-branch
git checkout main
git pull
```

## Step 7: Report

Report the PR URL, what was merged, and — explicitly — what the checklist could not verify.

## Important

- **Never skip Step 0.** If the user overrides, record the reason in the commit body.
- Never force-push; never `--no-verify`.
- Use `--merge` unless asked otherwise.
- This is a public repository (`ipeaGIT/padronizacao_cnefe`). Nothing under `data/` and no address
  microdata may ever be staged.

