Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

Commit Analysis

FreeNo executable scriptsNot checked

This skill should be used when the user asks to "analyze commits", "identify fix patterns", "detect code issues from commits", "git commit analysis", "parse…

shfcby shfc★ 16 GitHub stars

About this skill

Commit Analysis for Problem Pattern Detection

This skill provides techniques for analyzing git commits to identify bug fix patterns, extract root causes, and detect similar issues in code changes.

Purpose

Commit analysis transforms raw git history into actionable insights by:

  • Identifying which commits represent bug fixes vs. features
  • Extracting problem patterns from fix commits
  • Understanding root causes from code changes
  • Detecting similar patterns in new code changes
  • Building knowledge bases from historical fixes

Commit Identification Strategy

Two-Stage Filtering

Use a two-stage approach to identify fix-related commits:

Stage 1: Shell-based filtering

  • Fast, deterministic filtering using commit message patterns
  • Excludes obvious non-fix commits (feat, docs, chore, style, refactor, test, build, ci, perf)
  • Includes commits with fix-related keywords if configured

Stage 2: AI analysis

  • Analyze commit messages and diffs to confirm actual fixes
  • Distinguish between bug fixes, workarounds, and refactorings
  • Identify root cause from changes made

Conventional Commit Pattern Recognition

Parse conventional commit format: type(scope): subject

Common fix types:

  • fix: - Bug fixes
  • bugfix: - Explicit bug fixes
  • hotfix: - Urgent production fixes
  • patch: - Small fixes
  • revert: - Reverting broken changes
  • security: - Security fixes

Exclude types (not fixes):

  • feat: - New features
  • docs: - Documentation
  • chore: - Maintenance tasks
  • style: - Formatting, no logic change
  • refactor: - Code restructuring, no behavior change
  • test: - Test additions
  • build: - Build system changes
  • ci: - CI/CD configuration
  • perf: - Performance improvements (not fixes)

Keyword-Based Detection

When commit messages don't follow conventional format, look for keywords:

Strong fix indicators:

  • fix, fixes, fixed, fixing
  • bug, bugfix
  • issue, resolve, resolves, resolved
  • hotfix, patch
  • crash, error, failure
  • broken, break

Context-dependent indicators:

  • handle, prevent (may indicate defensive coding, not necessarily fixing existing bug)
  • improve, update (could be enhancement or fix)
  • correct, adjust (likely fixes)

AI analysis needed: When keywords are ambiguous, examine the diff to determine if it's fixing existing broken behavior or adding new functionality.

Commit Diff Analysis

Structure of Analysis

For each commit identified as potential fix, analyze:

  1. Files changed: Which modules/components affected
  2. Code patterns: What types of changes made
  3. Logic changes: What behavior was modified
  4. Test changes: What test coverage was added

Identifying Root Cause from Diff

Added Validation or Bounds Checking

Pattern: New if statements, assertions, or checks added

+ if (index < 0 || index >= array.length) {
+     throw new Error("Index out of bounds");
+ }
  return array[index];

Root cause: Missing input validation or boundary check

Fixed Null/Undefined Handling

Pattern: Added null checks, optional chaining, or default values

- const name = user.profile.name;
+ const name = user?.profile?.name ?? "Unknown";

Root cause: Null pointer/undefined access

Corrected Logic or Algorithm

Pattern: Changed comparison operators, loop conditions, or calculations

- if (count > threshold) {
+ if (count >= threshold) {

Root cause: Logic error, off-by-one error

Added Synchronization or Locking

Pattern: Added mutexes, locks, or atomic operations

+ mutex.lock();
  shared_resource.update();
+ mutex.unlock();

Root cause: Race condition or concurrency issue

Fixed Error Handling

Pattern: Added try-catch, error checking, or improved error propagation

  try {
      perform_operation();
+ } catch (SpecificError e) {
+     handle_error(e);
+     throw new UserFriendlyError("Operation failed");
  }

Root cause: Missing or inadequate error handling

Corrected API Usage

Pattern: Changed function calls, parameter order, or API contracts

- api.call(data, callback, options);
+ api.call(data, options, callback);

Root cause: API misuse or misunderstanding

Fixed Resource Management

Pattern: Added resource cleanup, close operations, or lifecycle management

  const file = open(path);
  process(file);
+ file.close();

Root cause: Resource leak

Pattern Detection

Common Problem Patterns

Identify recurring patterns across fix commits:

1. Input Validation Issues

Symptoms:

  • Added bounds checking
  • Added type validation
  • Added format verification

Pattern signature:

# Check for additions like:
if not validate_input(x):
    raise ValueError()

2. Null/None Safety Issues

Symptoms:

  • Added null checks
  • Added default values
  • Changed to safe navigation

Pattern signature:

# Check for c
Full SKILL.md on GitHub

Install Commit Analysis in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

references/pattern-detection.md

FAQ

What does the Commit Analysis skill do?

This skill should be used when the user asks to "analyze commits", "identify fix patterns", "detect code issues from commits", "git commit analysis", "parse commit history", or needs guidance on analyzing git commits to extract problem patterns and generate postmortem insights.

How do I install the Commit Analysis skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the Commit Analysis skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare Commit Analysis with