Repo conventions (general)
Two layers: universal rules that apply to every repo, and per-repo conventions that differ.
Per-repo specifics live in the repo itself (AGENTS.md / CLAUDE.md / CONTRIBUTING.md / .claude/skills/)
and are auto-loaded when working there — do NOT duplicate them in shared skills.
0. Pre-push checklist (MANDATORY — every repo)
Run BEFORE every push. Skipping these caused real incidents (wrong commit attribution, whole-file diffs, CI rejection).
- Verify git author identity BEFORE committing. GitHub attributes commits by email only; a wrong email links your commit to a different account and pollutes PR participants (unfixable once merged).
- Check:
git config user.name/git config user.email - Email MUST be
<numeric-id>+<username>@users.noreply.github.com— get the id viagh api user -q .id. Never guess (e.g.example@users.noreply...≠12345678+example_user@users.noreply.github.com). - Fix before pushing:
git commit --amend --author="Real Name <id+username@users.noreply.github.com>" --no-edit
- Check:
- Run pre-commit on changed files (if
.pre-commit-config.yamlexists):pre-commit run --files <files...>. Hooks must pass; if one auto-fixes, re-add and re-commit. - Conventional commit + conventional PR title. Squash-merge makes the PR title the commit on main; CI often validates it against
(feat|fix|docs|chore|ci|...)(scope)?: .... - Line endings. Repo files may be CRLF while pastes write LF → whole-file diffs. Check:
diff <(git show HEAD:path | tr -d '\r') <(tr -d '\r' < path). Fix with repo-native endings or.gitattributes(doesn't retroactively fix existing blobs). - Force-push etiquette. NEVER force-push without explicit user approval. Prefer
--force-with-leaseover--force. Force-pushing an OPEN PR fixes attribution; a merged PR is frozen.
1. Find the repo's OWN conventions FIRST
Never assume a repo follows another repo's flow. Before committing/pushing/opening a PR in a repo:
- Read
AGENTS.md/CLAUDE.md/CONTRIBUTING.mdat the repo root - Read its project skills:
.claude/skills/(e.g. ship-feature, repo-gotchas) and.agents/skills/ - If conventions files are missing → flag it and offer to create them; do NOT silently apply defaults from memory
- Fallbacks when docs are silent: branch from the default branch; conventional PR title; check whether CI is path-scoped (some repos only test a subdirectory)
2. Global rules (all repos)
- gh OAuth device flow preferred over PATs for interactive auth (PATs only for CI secrets).
- Approval prompts often time out → prefer approval-free git ops (regular push, new commit, merge over rebase, no force-push/remote deletes).
- Re-check
gh prstate before assuming — PRs get merged fast.