Agent skill
commit
Analyzes repository state, proposes commit messages following Conventional Commits, and applies commits after user approval. Use when asked to "commit", "commit changes", "save my work", "create a commit", or "stage and commit".
Install this agent skill to your Project
npx add-skill https://github.com/jiyeol-lee/dotfiles/tree/main/.opencode/skills/commit
SKILL.md
Workflow
- Preflight
- Use
tool__git--statusto check repository state (staged, unstaged, untracked files) - If no changes exist, report and stop
- Use
- Analyze changes
- Use
tool__git--retrieve-current-branch-diffto view all changes compared to the base branch - Categorize changes by type (feature, fix, refactor, docs, test, chore, etc.)
- Use
- Propose staging
- If there are unstaged changes, ask the user which files to stage
- List each file with its change type:
Files to stage: - [M] src/file1.ts (modified) - [A] src/file2.ts (new file) - [D] src/file3.ts (deleted)
- Draft commit message
- Use Conventional Commits format (see below)
- Include body if changes are complex (wrapped at 72 chars)
- Include footer for breaking changes or issue references
- Always use lowercase unless proper nouns
- Ask for approval: Present the draft and ask "Do you approve this commit? (yes/no/edit)"
- Commit (only after explicit approval)
- Use
tool__git--stage-fileswith the list of files - Use
tool__git--commitwith the commit message - Handle pre-commit hooks (see below)
- After successful commit, offer to push (requires explicit approval)
- Report the commit SHA and summary
- Use
Conventional Commits Format
<type>(<scope>): <description>
[optional body wrapped at 72 chars]
[optional footer(s)]
Use standard types: feat, fix, docs, style, refactor, perf, test, chore.
Breaking changes — append ! after type/scope:
feat(api)!: change response format from XML to JSON
BREAKING CHANGE: API responses are now JSON. Clients using XML
parsing must migrate to JSON parsing.
Example: Full Commit Workflow
> tool__git--status
Staged: (none)
Unstaged: src/auth.ts (modified), src/auth.test.ts (modified)
Untracked: src/middleware/rateLimit.ts
> tool__git--retrieve-current-branch-diff
src/auth.ts: Added JWT token refresh logic
src/auth.test.ts: Added tests for token refresh
src/middleware/rateLimit.ts: New rate limiting middleware
> Propose staging:
Files to stage:
- [M] src/auth.ts (modified)
- [M] src/auth.test.ts (modified)
- [A] src/middleware/rateLimit.ts (new file)
Suggested split into 2 commits:
1. feat(auth): add JWT token refresh logic
- src/auth.ts, src/auth.test.ts
2. feat(middleware): add rate limiting middleware
- src/middleware/rateLimit.ts
Do you approve this commit plan? (yes/no/edit)
> User: yes
> tool__git--stage-files ["src/auth.ts", "src/auth.test.ts"]
> tool__git--commit "feat(auth): add JWT token refresh logic"
✓ Commit abc1234
> tool__git--stage-files ["src/middleware/rateLimit.ts"]
> tool__git--commit "feat(middleware): add rate limiting middleware"
✓ Commit def5678
Would you like to push? (yes/no)
Pre-Commit Hook Handling
This is a common failure mode — follow these steps exactly:
- First attempt: Make initial commit
- If failed with modified files (hook auto-formatted code): Stage the modified files and retry once
- If retry still fails: Report the hook error to user — do NOT keep retrying
Constraints
- NEVER create empty commits
- NEVER commit without explicit user approval
- NEVER push without explicit user approval
- NEVER use
--no-verifyto skip pre-commit hooks - NEVER amend commits that have been pushed to remote
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
pull-request
Analyzes branch diffs, drafts PR titles and bodies following Conventional Commits, and creates or updates pull requests via GitHub CLI. Use when user asks to "create a PR", "open a pull request", "update PR description", "draft a PR", or "submit changes for review".
review
Performs code review analysis across Quality, Regression, Documentation, and Performance focus areas with severity-classified findings. Use when user asks to "review code", "review this PR", "check code quality", "review changes", or "do a code review".
check
Verifies code quality through linting, type-checking, formatting, and testing. Use when asked to "run checks", "validate code", "lint this", "check for errors", "run tests", or "verify code quality" before or after changes.
task-breakdown
Decomposes complex goals into atomic, dependency-aware work items with execution plans. Use when asked to "break down this task", "create a task plan", "decompose this goal", "split this work", "plan the implementation", "what are the steps", or "create an execution plan".
code
Implements features, fixes bugs, refactors code, and writes unit and integration tests. Use when asked to "implement", "fix a bug", "refactor", "add a feature", "write tests", "add test coverage", or "update code".
grill-me
Conducts thorough interviews to deeply understand user needs, requirements, and context before any implementation begins. Use when requirements are unclear, assumptions need validation, edge cases need exploration, when the user says "grill me", "ask me questions", "help me think through this", or when the underlying problem isn't fully understood.
Didn't find tool you were looking for?