Git Rules
Clean commits, PRs, and issues for a React Native / Expo codebase.Recon (Always Run First)
Before planning anything, gather full context:- 2–4 user-facing bullets (what the user would notice)
- 1–3 technical bullets (architecture, perf, cleanup)
Branch Naming
Format
Examples
Rename Branch If Scope Changes
Commit Conventions
Format
Types
| Type | Use For |
|---|---|
feat | New feature |
fix | Bug fix |
refactor | Code restructuring (no behavior change) |
perf | Performance improvement |
test | Adding or updating tests |
docs | Documentation changes |
style | Code formatting, missing semicolons, etc. |
build | Build system or external dependencies |
ci | CI configuration and scripts |
chore | Maintenance tasks |
Scope
Derive from diff paths first, then feature intent. Pick one primary scope per commit.Known Scopes
Known Scopes
| Scope | Covers |
|---|---|
ui | components/ui/*, general visual/layout |
app | app/* top-level, offline shell, launch |
camera | QR scanning, camera permissions |
nfc | NFC payment flow, NFC rollback |
mint | Mint info, trust sheets, mint selection |
npc | NPC plugin, NPC mint store |
wallet | Wallet operations, transaction history |
receive | Receive flow, token redeem |
rebalance | Rebalance operations |
transactions | Transaction screens, details |
keyring | P2PK key management |
keys | Key derivation, NIP-06, NUT-13 |
profile | Multi-profile, profile switch |
settings | Settings pages, preferences |
home | Dashboard widgets |
explore | Explore tab, wallet health |
map | Map flow, BTC Map |
lists | Virtualized feeds |
popup | Toast/sheet system |
theme | Theme engine |
providers | providers/*, NDK, ThemeProvider |
store | stores/*, Zustand stores |
hooks | hooks/* |
blocks | components/blocks/* |
tx | Transaction timeline |
widget | iOS/Android widget |
repo | Repo-level docs |
tooling | Lint, knip, prettier, quality gate |
ci | GitHub Actions, CI |
patches | patches/* |
metro | metro.config.* |
rules | .cursor/rules/* docs |
readme | README changes |
Creating New Scopes
Creating New Scopes
Create new scopes freely when the change doesn’t fit an existing one.Derive from the most specific directory or feature name — don’t force-fit into the table above.New scopes are cheap; vague scopes are expensive.
Commit Message Examples
When to Commit
Commit if any are true:- ✅ UI or user behavior changed
- ✅ Non-trivial fix, perf improvement, or refactor
- ✅ New files added or risky logic touched (payments, keys, storage, networking)
- ✅ Config, tooling, patches, or lockfile changed
Staging
Stage precisely — usegit add -p for mixed files. Plan 2–6 commits for non-trivial work.
Validation Gate
npm run pretty then re-check.
If any other check fails, fix and git commit --amend.
Secret Scanning (Non-Negotiable)
Before staging ANY file, scan diffs for secrets. Refuse to commit if found:- Passwords, API keys, tokens, session cookies
- Mnemonics (12–24 words),
xprv, WIF, raw private keys - Nostr secrets (
nsec1...), hex private keys .envcontents, credential files
If Found
Pull Requests
Push and open PR when work is ready for review:PR Rules
- Title = final conventional commit subject (this becomes the squash-merge message)
- Body is the commit message body — concise, scannable, no filler
- Use
gh pr editto update if scope changes after opening - Link related issues:
Closes #NorRelated: #N
PR Template
GitHub Issues (Rare — Unresolved Bugs Only)
File an issue only when:- A bug was investigated but couldn’t be fixed in the current session
- The root cause is identified but the fix is out of scope or risky
- A flaky behavior needs tracking for future debugging
Issue Rules
- Title is a conventional commit subject (so it reads well in lists)
- Body captures agent context — the investigation is the value
- Label if
ghlabels are available:bug,investigation,help-wanted - Never file issues for feature requests or tasks — only unresolved bugs from the current session
Issue Template
Quick Reference
| Action | Command |
|---|---|
| New branch | git checkout -b type/scope-desc |
| Stage hunks | git add -p |
| Commit | git commit -m "type(scope): subject" |
| Amend | git commit --amend |
| Push | git push -u origin $(git branch --show-current) |
| Force push (rewrite) | git push --force-with-lease |
| Open PR | gh pr create --title "..." --body "..." |
| Update PR | gh pr edit --title "..." --body "..." |
| File issue | gh issue create --title "..." --body "..." |
| View PR status | gh pr status |
Complete Workflow Example
Make changes
Write code following contributing guidelines.