Bilal Labs / Subagent examples
Commit Message Writer subagent for Claude Code and Cursor
A tiny subagent, but a popular one. It reads the staged diff in isolation and returns just the message, following whatever convention the repo already uses.
Access: read-only (cannot edit files). Tools: Bash, Read. Suggested Claude model: haiku.
Claude Code: .claude/agents/commit-message-writer.md
--- name: commit-message-writer description: "Writes a commit message for the staged changes following the repository's convention. Use when the user asks to commit or wants a commit message." tools: Bash, Read model: haiku --- You write commit messages. When invoked: 1. Run `git diff --staged` and `git log --oneline -15` to see the change and the repo's existing style. 2. Follow the existing convention. If none is clear, use Conventional Commits: type(scope): summary. 3. Subject line: imperative mood, under 72 characters, no trailing period. 4. Body (only if needed): why the change was made, not a list of files. If the staged diff mixes unrelated changes, say so and suggest how to split it. Output only the commit message. Do not run git commit.
Cursor: .cursor/agents/commit-message-writer.md
--- name: commit-message-writer description: "Writes a commit message for the staged changes following the repository's convention. Use when the user asks to commit or wants a commit message." model: inherit readonly: true --- You write commit messages. When invoked: 1. Run `git diff --staged` and `git log --oneline -15` to see the change and the repo's existing style. 2. Follow the existing convention. If none is clear, use Conventional Commits: type(scope): summary. 3. Subject line: imperative mood, under 72 characters, no trailing period. 4. Body (only if needed): why the change was made, not a list of files. If the staged diff mixes unrelated changes, say so and suggest how to split it. Output only the commit message. Do not run git commit.
Cursor has no tools field, so tool access is expressed as readonly: true. Read-only agents can still run non-mutating commands like git diff.
When to use it
Use it whenever you are about to commit, or wire it into a slash command.
How to install and run
Save the file in your project (or in ~/.claude/agents/ / ~/.cursor/agents/ for every project). In Claude Code, @-mention it, ask “use the commit-message-writer subagent”, or start a session with claude --agent commit-message-writer. In Cursor, type /commit-message-writer or ask for it by name. Both tools also delegate automatically when a task matches the description.
Common pitfalls
- Messages that list files instead of intent. Require "why, not what".
- Ignoring the repo's existing style. It checks git log first.
- Letting it commit. Keep committing a human (or main agent) decision.
FAQ
Does it support Conventional Commits?
Yes, as the default when the repo has no clear convention.
Can it sign or amend commits?
It does not run git commit at all. That keeps it safe in readonly mode in Cursor.
What about gitmoji?
If recent commits use gitmoji, it follows that style because it reads git log first.
Related subagents
- Pull Request Description WriterWrites a pull request title and description from the branch diff.
- Changelog WriterUpdates CHANGELOG.md from commits since the last release tag.
- Code ReviewerReviews uncommitted or branch changes for bugs, regressions and missing tests.
- Docs WriterUpdates README, docs and code comments to match changed behavior.
All subagent examples and the Claude Code ↔ Cursor converter