A VS Code extension that generates Conventional Commits messages from your staged changes by shelling out to the Claude Code CLI running on your own machine.
No API keys to configure, no extension settings to authenticate — if claude works in your terminal, this works in VS Code.
The extension adds a sparkle (✨) button to the Source Control title bar. When you click it:
- Find the repo. It talks to VS Code's built-in
vscode.gitextension via its public API to enumerate open repositories. If you have more than one, it asks which to target. - Read the staged diff. It spawns
git diff --stagedin the repo root and captures stdout. If nothing is staged, it tells you and stops. - Read recent history for style. It runs
git log -10 --format=%sto grab the last ten commit subjects. These are fed to Claude as a style reference so the generated message matches your repo's voice (lowercase vs Title Case, scope conventions, etc.). - Build a prompt. A fixed prompt template instructs Claude to produce a Conventional Commits message:
<type>(<scope>): <subject>, imperative mood, ≤72-char subject, optional WHY body. The staged diff is appended at the bottom (truncated tomaxDiffBytesif huge, so large refactors don't blow the prompt window). AnyextraInstructionsyou've configured are inserted before the diff. - Invoke the CLI. It spawns
claude -p --output-format textwith the prompt piped to stdin. On Windows,claudeis typically a.cmdshim, so the spawn usesshell: truethere; on macOS/Linux it spawns directly. - Clean the output. Models occasionally wrap output in
```fences or prependCommit message:despite the prompt. A smallstripWrappingpass removes those without being aggressive enough to chew real content. - Drop it into the commit box. The cleaned message is written to
repo.inputBox.value. You review, edit if needed, and commit normally — the extension never commits for you.
Errors at any step (CLI not found, non-zero exit, empty response) surface as VS Code notifications.
- It doesn't read unstaged changes. Stage what you want described.
- It doesn't call any Anthropic API directly. Everything goes through your local
claudebinary, so whatever auth/quotas/model that CLI is set up with is what gets used. - It doesn't commit. The generated text is placed in the input box only.
- It doesn't store or transmit your diff anywhere except to the local CLI process.
Requires Node 18+, VS Code 1.85+, and the code CLI on PATH (Ctrl+Shift+P → "Shell Command: Install 'code' command in PATH").
npm run install:extThe scripts/install.ps1 helper installs npm deps if missing, compiles TypeScript, packages a .vsix into dist/, and installs it into VS Code via code --install-extension. Reload the window afterwards.
npm install
npm run compile
npx @vscode/vsce package
code --install-extension claude-commit-0.1.0.vsixPress F5 in VS Code to launch an Extension Development Host with the extension loaded — no install/reload cycle needed.
- Open a Git repository in VS Code.
- Stage the changes you want to describe (Source Control panel →
+next to each file). - Click the ✨ sparkle in the Source Control title bar, or run Claude Commit: Generate commit message from the Command Palette.
- Wait a few seconds (a progress indicator appears in the SCM panel). The generated message lands in the commit input.
- Edit if you like, then commit normally.
Open Settings → search "Claude Commit":
| Setting | Default | Description |
|---|---|---|
claudeCommit.cliPath |
claude |
Path to the Claude Code CLI. Set this if claude isn't on the PATH VS Code sees (e.g. C:\Users\you\AppData\Roaming\npm\claude.cmd). |
claudeCommit.maxDiffBytes |
60000 |
Truncate the staged diff above this many bytes. Prevents huge refactors from blowing the model's prompt window. |
claudeCommit.extraInstructions |
"" |
Free-form text appended to the prompt. Use for repo-specific conventions, e.g. "Prefix subjects with the JIRA ticket from the branch name." |
"Could not run 'claude'."
The CLI isn't on the PATH VS Code inherited. Either add it to PATH and restart VS Code, or set claudeCommit.cliPath to the absolute path of the binary/shim.
"No staged changes." Stage something first. The extension intentionally ignores unstaged work.
"Claude returned an empty response." Usually a transient CLI issue or a diff that confused the model. Try again, or shrink the diff (stage fewer files).
The message has the right idea but the wrong style.
Add a couple more commits in your preferred style, or set claudeCommit.extraInstructions to spell out the convention.
Multi-root workspace picks the wrong repo. When more than one repository is open, the extension prompts you to choose. Pick the right one from the Quick Pick.
src/extension.ts # activate(), command registration, all logic
scripts/install.ps1 # build + package + install helper
package.json # extension manifest (commands, menus, settings)
.vscodeignore # files excluded from the packaged .vsix
The whole extension is a single file (~200 lines). It registers one command (claudeCommit.generate), contributes one SCM-title menu item, and exposes three settings. That's it.
MIT. See LICENSE.