commit
Git commit workflow with precommit hook handling, lint/type checking, README updates, and API reference updates. Use when the user wants to commit changes. Handles precommit hooks that modify files (formatting, linting) by re-staging and retrying. Runs ruff lint and pyright type checks on staged Python files, and Biome lint and tsc type checks on staged TS/JS files, fixing all errors. Fixes failing unit tests automatically before committing. Updates README code maps if needed. Updates API reference docs when client.py or service_schemas.py changed. Does not push.
ReflexioAI · AI review on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add ReflexioAI/claude-smart --skill commitAbout this skill
name: commit description: Git commit workflow with precommit hook handling, lint/type checking, README updates, and API reference updates. Use when the user wants to commit changes. Handles precommit hooks that modify files (formatting, linting) by re-staging and retrying. Runs ruff lint and pyright type checks on staged Python files, and Biome lint and tsc type checks on staged TS/JS files, fixing all errors. Fixes failing unit tests automatically before committing. Updates README code maps if needed. Updates API reference docs when client.py or service_schemas.py changed. Does not push.
Commit
Create a git commit with automatic precommit hook handling, test fixing, README updates, and API reference updates.
Note: Steps 5 and the API Reference Update Guidelines are specific to the Reflexio project. They are skipped automatically when the referenced paths do not exist.
Workflow
- Check git status - Run
git statusandgit diff --cached --name-onlyto see staged/unstaged changes - Sync AI instruction files (only if CLAUDE.md changed) — Run
git diff --cached --name-onlyand check ifCLAUDE.mdis in the staged changeset. If yes, copy CLAUDE.md content to GEMINI.md and AGENTS.md, then stage them. If CLAUDE.md is NOT staged, skip this step entirely — do not overwrite other instruction files that may have been intentionally edited independently. - Stage files - Add relevant untracked/modified files if needed. Do not modify or change gitignored files, such as
.env. Never change.envfile even if it is modified. - Check README updates - Run through the README Update Guidelines checklist below. If ANY criteria match, update README files before proceeding.
- Update API Reference docs (Reflexio-specific) — If the files
reflexio/reflexio_client/reflexio/client.pyorreflexio/reflexio_commons/reflexio_commons/api_schema/service_schemas.pyexist AND are in the staged changeset, updatereflexio/public_docs/api-reference/(see API Reference Update Guidelines below). Otherwise skip. - Run lint and type checks on staged Python files
a. Get the list of staged Python files:
If no Python files are staged, skip this step entirely. b. Ruff auto-fix: Rungit diff --cached --name-only --diff-filter=ACMR -- '*.py'ruff check --fix <files>. Re-stage any modified files withgit add <files>. c. Ruff format: Runruff format <files>. Re-stage any modified files withgit add <files>. d. Ruff remaining errors: Runruff check <files>. If any errors remain that ruff could not auto-fix, read each error, understand the issue, and fix the code yourself. Re-stage fixes. Do NOT proceed with unfixed ruff errors. e. Pyright type check: Runpyright <files>. If any type errors are reported, read each error, understand the type issue, and fix the code yourself. Re-stage fixes. Do NOT proceed with unfixed pyright errors. f. Get the list of staged TypeScript/JavaScript files:
If no TS/JS files are staged, skip steps 6g-6i entirely. g. Biome auto-fix: Rungit diff --cached --name-only --diff-filter=ACMR -- '*.ts' '*.tsx' '*.js' '*.jsx' '*.mts'npx biome check --write <files>from the relevant project root (reflexio/website/orreflexio/public_docs/depending on file path). Re-stage any modified files withgit add <files>. h. Biome remaining errors: Runnpx biome check <files>. If any errors remain that Biome could not auto-fix, read each error, understand the issue, and fix the code yourself. Re-stage fixes. Do NOT proceed with unfixed Biome errors. i. TypeScript type check: Runnpx tsc --noEmitfrom the relevant project root. If any type errors are reported, read each error, understand the type issue, and fix the code yourself. Re-stage fixes. Do NOT proceed with unfixed tsc errors. - Attempt commit - Run
git commitwhich triggers precommit hooks - Handle hook results:
- If hooks modify files (formatting, linting): Stage the modified files with
git add -uand retry commit - If unit tests fail: Fix the failing tests, stage fixes, and retry commit
- If hooks pass: Commit succeeds
- If hooks modify files (formatting, linting): Stage the modified files with
- Do NOT push - Only commit locally
README Update Guidelines
Before committing, always check if README files need updates. Follow how_to_write_readme.md in the repo root.
Step 1: Analyze changes with these commands:
# See what files are being committed
git diff --cached --name-only
# See detailed changes
git diff --cached --stat
# For unstaged changes
git diff --name-only
Step 2: Check if README update is REQUIRED (update if ANY are true):
- New directory created (e.g.,
services/email/) - New Python module/file added to existing component
- New API endpoint added
- New service or extractor added
- Architecture pattern changed
- Component relationships changed
If none of the above criteria match, skip README updates entirely and proceed to the next step.
Pre-write criteria — before writing any README changes, confirm:
- Can an LLM currently find the right file with the existing README? If yes, no update needed.
- Are there new files/directories that need documented paths?
- Are new API endpoints to list?
- Are there anti-patterns to highlight (NEVER/ALWAYS)?
Only proceed with the update if at least one criterion identifies a gap.
Step 3: Update process:
- Identify affected component(s) from the file paths
- Read existing README(s) in affected directories
- Update component-level README first (e.g.,
reflexio/server/README.md) - Update main
README.mdif high-level structure changed - Stage README changes:
git add README.md src/*/README.md
Two-tier approach:
- Main Code Map (
README.md) - High-level overview of all components - Component Code Maps (e.g.,