Skip to content

feat(skills): Add contextual-commit skill for structured commit reasoning#1281

Merged
yamadashy merged 2 commits intomainfrom
feat/contextual-commit-skills
Mar 21, 2026
Merged

feat(skills): Add contextual-commit skill for structured commit reasoning#1281
yamadashy merged 2 commits intomainfrom
feat/contextual-commit-skills

Conversation

@yamadashy
Copy link
Owner

@yamadashy yamadashy commented Mar 21, 2026

Add a Claude Code skill that extends Conventional Commits with structured action lines in the commit body, preserving the reasoning behind code changes.

What it does

The contextual-commit skill adds 5 action line types to commit bodies:

  • intent(scope) — what the user wanted and why
  • decision(scope) — chosen approach when alternatives existed
  • rejected(scope) — what was considered and discarded, with reasons
  • constraint(scope) — hard limits discovered during implementation
  • learned(scope) — discoveries that save future time

Subject lines remain standard Conventional Commits — no tooling breakage.

Why

Diffs preserve WHAT changed. The reasoning — why this approach, what was rejected, what constraints were discovered — evaporates when a session ends. This skill captures that context directly in git history, accessible to future sessions and other agents.

Checklist

  • Run npm run test
  • Run npm run lint

🤖 Generated with Claude Code


Open with Devin

…ning

Add a Claude Code skill that extends Conventional Commits with structured
action lines (intent, decision, rejected, constraint, learned) in the
commit body. This preserves the WHY behind code changes — intent,
alternatives considered, constraints discovered — that diffs alone cannot
show.

intent(skills): capture development reasoning in commits so future sessions
  don't lose context about why code was written
decision(skills): action-line format in commit body over separate metadata
  files — works with all git workflows (merge, squash, rebase, cherry-pick)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 21, 2026

⚡ Performance Benchmark

Latest commit:0e7601f
Status:✅ Benchmark complete!
Ubuntu:2.57s (±0.05s) → 2.56s (±0.09s) · -0.00s (-0.1%)
macOS:1.35s (±0.10s) → 1.32s (±0.04s) · -0.03s (-2.4%)
Windows:2.99s (±0.03s) → 3.01s (±0.02s) · +0.03s (+0.9%)
Details
  • Packing the repomix repository with node bin/repomix.cjs
  • Warmup: 2 runs (discarded)
  • Measurement: 10 runs / 20 on macOS (median ± IQR)
  • Workflow run

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new skill that significantly enhances the utility of Git commit messages. By integrating structured reasoning directly into the commit body, it ensures that the full context of code changes, including intentions, decisions, and constraints, is permanently recorded. This approach improves the long-term maintainability and understandability of the codebase by making the 'why' behind every change readily accessible to current and future developers.

Highlights

  • New Skill: Contextual Commits: Introduced a new contextual-commit skill designed to enhance Git commit messages by capturing the reasoning behind code changes.
  • Structured Commit Body: Extended Conventional Commits by adding structured action lines to the commit body, preserving the 'why' alongside the 'what'.
  • Five Action Line Types: Defined five specific action line types: intent, decision, rejected, constraint, and learned, each serving to document different aspects of the development process.
  • Preservation of Reasoning: Aimed to prevent the loss of critical development context, such as alternatives considered, constraints encountered, and lessons learned, by embedding them directly into the commit history.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

📝 Walkthrough

Walkthrough

Introduced a new "contextual-commit" skill specification and updated commit body guidelines to enforce its use. The skill defines structured action-line formats for commit bodies, replacing previous unstructured context requirements, while maintaining Conventional Commits compliance for commit subjects.

Changes

Cohort / File(s) Summary
Commit Guidelines Update
.agents/rules/base.md
Updated commit body requirements to reference the new contextual-commit skill instead of previous context/conversation guidelines.
Contextual-Commit Skill Definition
.claude/skills/contextual-commit/SKILL.md
New skill specification document defining structured action-line formats (intent, decision, rejected, constraint, learned) for commit bodies, pre-commit workflow rules, and compatibility guidance across git workflows.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a new skill for structured commit reasoning with contextual information.
Description check ✅ Passed The description is comprehensive, explaining the skill's purpose, the five action line types, rationale, and includes the completed checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/contextual-commit-skills

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

…ines

intent(claude-md): avoid duplicating commit body rules between CLAUDE.md and the skill file
decision(claude-md): single reference to skill file over inline duplication

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 21, 2026

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0e7601f
Status: ✅  Deploy successful!
Preview URL: https://c404e285.repomix.pages.dev
Branch Preview URL: https://feat-contextual-commit-skill.repomix.pages.dev

View logs

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new contextual-commit skill for an AI agent, documented in a new SKILL.md file. The skill aims to capture the reasoning behind code changes by extending conventional commits with structured action lines. The documentation is comprehensive and well-structured. I have one suggestion to improve the consistency of the rules for the agent, specifically regarding how to handle changes for which it lacks conversation context. My feedback aims to prevent the agent from generating low-value commit messages that repeat information already present in the diff.

@claude
Copy link
Contributor

claude bot commented Mar 21, 2026

PR Review: feat(skills): Add contextual-commit skill

Overall: Well-written skill that fills a real gap - preserving dev reasoning in git history. LGTM with minor suggestions.

Feedback:

  1. CLAUDE.md conflict - CLAUDE.md already has commit body guidelines with different formatting expectations. Consider updating CLAUDE.md to reference this skill or adding a note about how they relate.

  2. Squash merge claim (L180) - 'All commit bodies concatenated' isn't guaranteed - depends on GitHub repo config. Add a qualifier.

  3. Mixed-scope commits - Examples show single-domain commits. Guidance on action-line scopes when commits cross boundaries would help.

  4. Extra blank line at L93 - Minor formatting cleanup.

Strengths: Action type taxonomy is well-chosen. 'When You Lack Conversation Context' section prevents hallucinated context. Rule 8 keeps it pragmatic. Pre-commit checklist is practical.

Premortem: Adoption friction with non-Claude contributors (not a blocker). Verbosity creep risk despite Rule 3. No risk to existing tooling - good design.

Generated with Claude Code

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.agents/rules/base.md (1)

64-79: Align subject-line wording rules with the new skill to avoid conflicting instructions.

Now that commit-body rules are delegated to contextual-commit, consider consolidating/clarifying subject-line constraints here (e.g., capitalization expectations) so assistants don’t get mixed signals across rule sources.

Based on learnings: Consult and adhere to the project-specific rules documented in .agents/rules/base.md during development and review.

Also applies to: 82-82

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.agents/rules/base.md around lines 64 - 79, Update the subject-line rules in
the commit guidance to remove conflicts with the new contextual-commit skill:
clarify that the assistant must follow the existing format `type(scope):
Description` and explicitly state the capitalization rule for the subject (e.g.,
"Description" must start with a capital letter and use present tense), and note
that commit-body rules are handled by contextual-commit so only subject-line
constraints belong here; update the bullets that currently state "The assistant
shall always include a scope" and "The assistant shall write description in
clear, concise present tense starting with a capital letter" to be the
authoritative subject-line rules and add a short note referencing that
commit-body conventions are delegated to contextual-commit to avoid mixed
signals.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.claude/skills/contextual-commit/SKILL.md:
- Around line 24-29: Add explicit language identifiers to all fenced code blocks
in the SKILL.md commit examples so markdownlint MD040 is satisfied: locate each
triple-backtick block containing the example commit templates (e.g., the block
starting with "type(scope): subject line (standard conventional commit)", the
block with "fix(button): correct alignment on mobile viewport", the blocks for
"feat(notifications): …", "refactor(payments): …", and "refactor(auth): …") and
change the opening fence to include a language token such as ```text (or
```diff/```bash if more appropriate) for each block; ensure every fenced block
in the file has a language tag.

---

Nitpick comments:
In @.agents/rules/base.md:
- Around line 64-79: Update the subject-line rules in the commit guidance to
remove conflicts with the new contextual-commit skill: clarify that the
assistant must follow the existing format `type(scope): Description` and
explicitly state the capitalization rule for the subject (e.g., "Description"
must start with a capital letter and use present tense), and note that
commit-body rules are handled by contextual-commit so only subject-line
constraints belong here; update the bullets that currently state "The assistant
shall always include a scope" and "The assistant shall write description in
clear, concise present tense starting with a capital letter" to be the
authoritative subject-line rules and add a short note referencing that
commit-body conventions are delegated to contextual-commit to avoid mixed
signals.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7dc0819a-6ba2-4db8-9f49-7b6b169b482f

📥 Commits

Reviewing files that changed from the base of the PR and between 356df2f and 0e7601f.

📒 Files selected for processing (2)
  • .agents/rules/base.md
  • .claude/skills/contextual-commit/SKILL.md

@claude
Copy link
Contributor

claude bot commented Mar 21, 2026

Code Review — contextual-commit skill

Overall: This is a well-written, thoughtful addition. The SKILL.md is clearly structured, the examples are excellent, and the "When You Lack Conversation Context" section is the most valuable part — it directly addresses the biggest risk of AI-generated commit metadata (fabrication). A few observations below.

Positives

  • The five action types (intent, decision, rejected, constraint, learned) are well-chosen and cover the reasoning gap without over-engineering.
  • The "When You Lack Conversation Context" section is critical and well-articulated — explicitly listing what CAN vs CANNOT be inferred from diffs prevents hallucinated commit context.
  • Rule 8 ("Don't invent action lines for trivial commits") and Rule 9 ("Don't fabricate context") are exactly right.
  • Splitting the skill definition (SKILL.md) from the reference in base.md keeps things modular.

Suggestions

1. Consider adding guidance on action line ordering

The examples consistently follow intent → decision → rejected → constraint → learned ordering, but this convention isn't explicitly stated. Adding a brief note like "Action lines should follow the order: intent, decision, rejected, constraint, learned" would help agents produce consistent output.

2. Squash merge behavior deserves a caveat

The "Git Workflows" section states:

Squash merges: All commit bodies concatenated into the squash commit body. The result is a chronological trail of typed, scoped action lines.

This is only true if the hosting platform preserves all commit bodies during squash. GitHub's default squash merge behavior concatenates commit messages, but many teams configure it to use only the PR description. Worth noting that the concatenation behavior depends on the platform/repo settings, so teams using squash merges should verify their configuration preserves commit bodies.

3. The blank line between subject and body isn't explicitly required

The format spec shows:

type(scope): subject line

action-type(scope): description

Git requires a blank line between subject and body for proper git log --oneline behavior. While the examples show it correctly, the "Commit Format" section should explicitly state this requirement (e.g., "A blank line separates the subject from the body, as required by git convention").

4. Minor: action line scope vs subject line scope could use clarification

The subject line scope follows Conventional Commits (e.g., feat(auth)), while action line scopes are described as "human-readable concept labels" that can differ (e.g., decision(oauth-library)). This is fine and intentional, but a brief note explicitly acknowledging that action line scopes are independent from the subject line scope would prevent confusion.

Potential Issues / Premortem

  • Adoption friction: Since this skill is documentation-only (no tooling enforcement), its effectiveness depends entirely on the AI agent following the instructions. There's no validation that action lines are well-formed. This is acceptable for v1 but worth noting.
  • Commit message length: Complex changes with many action lines could produce very long commit bodies. Some git tooling truncates commit messages. Not a blocker, but the "Be concise but complete" rule could mention keeping the total body reasonable.
  • No breaking changes: The PR only adds a new file and modifies a documentation reference — zero risk of runtime breakage.

Verdict

Clean, well-scoped PR. The documentation quality is high and the approach is sound. The changes to base.md correctly replace the previous vague guidelines with a concrete reference to the new skill. No blocking issues.


🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Mar 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.18%. Comparing base (356df2f) to head (0e7601f).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1281   +/-   ##
=======================================
  Coverage   87.18%   87.18%           
=======================================
  Files         115      115           
  Lines        4324     4324           
  Branches     1002     1002           
=======================================
  Hits         3770     3770           
  Misses        554      554           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yamadashy yamadashy merged commit 642434d into main Mar 21, 2026
66 checks passed
@yamadashy yamadashy deleted the feat/contextual-commit-skills branch March 21, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant