Skip to content
Skills Library
Programming · Analysis

code-history

/code-history

Trace the git history of specific code — when a function, pattern, or file was added, modified, or removed, and the intent behind each change. Use when the user asks when or why a piece of code changed, wants the evolution of a function, or needs the commit or PR that introduced a behavior. Read-only; not for plain git log or a single line's last author.

Licence
MIT
Last repository change
04.08.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 04.08.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Trace the git history of specific code — when a function, pattern, or file was added, modified, or removed, and the intent behind each change. Use when the user asks when or why a piece of code changed, wants the evolution of a function, or needs the commit or PR that introduced a behavior. Read-only; not for plain git log or a single line's last author.

Arguments

/code-history <pattern | function-name | file-path>
Original author description

Trace the git history of specific code — when a function, pattern, or file was added, modified, or removed, and the intent behind each change. Use when the user asks when or why a piece of code changed, wants the evolution of a function, or needs the commit or PR that introduced a behavior. Read-only; not for plain git log or a single line's last author.

How it works

  1. Use this skill when
  2. Do not use this skill when
  3. Instructions
Original SKILL.md headings · 112 lines, 748 words
SKILL.md preview
---
name: code-history
version: 0.0.2
category: development
description: "Trace the git history of specific code — when a function, pattern, or file was added, modified, or removed, and the intent behind each change. Use when the user asks when or why a piece of code changed, wants the evolution of a function, or needs the commit or PR that introduced a behavior. Read-only; not for plain git log or a single line's last author."
argument-hint: "<pattern | function-name | file-path>"
---

# Code History

Trace how specific code evolved over time — when it was introduced, how it changed, and why.

## Use this skill when

- Understanding how a function or method evolved over time
- Tracking when a specific code pattern was introduced or changed
- Finding which commit/PR introduced, modified, or removed a piece of code
- Investigating why code changed and what motivated each revision

## Do not use this skill when

- The user wants to modify code (this skill is read-only)
- The user wants general git log without a specific target
- The user only needs `git blame` for a single line's last author
- The user only wants to see a specific commit's diff (`git show` is sufficient)

**This skill is read-only. Never modify any files or run write commands.**

## Instructions

### Tool Usage

| Purpose | Tool | Command / Pattern |
|---------|------|-------------------|
| Search code pattern history | **Bash** | `git log -p --all -S '<pattern>'` |
| Trace function line history | **Bash** | `git log -L :'<func>':<file> --no-patch` |
| Trace file history | **Bash** | `git log --follow --oneline -- <path>` |
| Find pattern location | **Grep** | Search for pattern across codebase |
| Read file context | **Read** | Read surrounding code for understanding |
| Link commit to PR | **Bash** | `gh pr list --search '<sha>' --state all` |

### Step 1: Identify the Target

Parse `$ARGUMENTS` to determine what to trace:

| Input type | Example | Detection |
|------------|---------|-----------|
| Code pattern | `user["type"] == "ADMIN"` | Contains operators, quotes, brackets |
| Function/method name | `ensure_valid_state` | Single identifier, no operators |
| File path | `src/auth/services.py` | Contains `/` or file extension |
| Ambiguous | Something else | Ask the user to clarify |

If the input is a function name, locate the file it belongs to using **Grep** to search for the definition pattern.

### Step 2: Collect History

First, measure the history size:

```bash
git log --oneline --all -S '<pattern>' | wc -l
```

Then choose the appropriate strategy:

**If commits ≤ 30**: read full history with `git log -p --all -S '<pattern>'`

**If commits > 30**: narrow scope with `-- <file_path>` or `--since="1 year ago"`. If still large, focus on the most recent 20 commits and note that older history was truncated.

**By target type:**

- **Code patterns**: `git log -p --all -S '<pattern>'`
- **Functions**: supplement with `git log -L :'<function_name>':<file_path> --no-patch --oneline`
- **Files**: `git log --follow --oneline -- <file_path>`

### Step 3: Link to PRs

For each relevant commit, extract the PR reference:

1. **From commit message**: parse PR number if present (e.g., `(#123)`, `Merge pull request #123`)
2. **Via `gh` CLI** (if available): `gh pr list --search '<commit-sha>' --state all --json number,title,url --limit 1`

If `gh` is not installed or fails, rely on commit message parsing only and note it.

### Step 4: Analyze Changes

For each commit in the history, classify:

| Dimension | Values |
|-----------|--------|
| **Change type** | Added / Modified / Refactored / Moved / Deleted / Restored |
| **Intent** | Bug fix / Feature / Refactoring / Performance / Cleanup / Migration |
| **Scope** | Targeted (commit directly addresses this code) / Incidental (side effect of a larger change) |

Determine intent from: commit message, PR title, and diff context. If intent is unclear, state that explicitly rather than guessing.

### Step 5: Output

**Timeline table:**

```markdown
## Change History: `<target>`

| # | Date | Author | Commit | PR | Change |
|---|------|--------|--------|----|--------|
| 1 | YYYY-MM-DD | name | `abcdef1` | #N title | Added — initial implementation |
| 2 | YYYY-MM-DD | name | `abcdef2` | #N title | Modified — added validation |
| 3 | YYYY-MM-DD | name | `abcdef3` | #N title | Refactored — extracted to util |
```

**Detailed analysis** (for each significant change):
- Before/after diff summary
- Change intent (based on commit message/PR)
- Functional impact — what changed in behavior or interface

**Insights** (only when directly supported by evidence in the history):
- Summarize the evolution arc (e.g., "started as 10-line helper, grew to 80-line class over 5 PRs")
- Flag concrete issues found in the history: reverted changes, repeated patches to the same area, scope mismatches between commit message and actual diff
- Connect related changes across files if the same commit touched multiple relevant locations
Files in this package (3)
  • README.ko.md 2 KB
  • README.md 2 KB
  • SKILL.md 5 KB

Versions

The database has no other skills named code-history.

Identical content appears in 1 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version fca6a8e7f9e0 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100git-mining
    This skill should be used when the user asks to "check git history", "trace code changes", "find when something was added", "correlate commits with sessions", "find hotspot files", or needs to mine git repository history for insights. Only applicable when the current project is a git repository.
  • 100nalcos
    Search this repository's Git history by meaning with the nalcos CLI. Use this skill whenever a question is about the repository's history - which commit introduced, changed, removed, or broke something; when or why code or behavior changed; or which commits between two revisions…
  • 100git-archaeology
    Investigate how code reached its current state — when a line, function, import, or whole file was changed or deleted, who removed it, and what it looked like before. Use when `git blame` came up empty, when content has been refactored away, or when you need the full evolution of…
  • 100git-history-forensics
    Git 历史追溯与文档完整性验证 - 追踪功能/概念的引入时间、演变过程,发现文档遗漏。 当用户问"X呢"、"Y什么时候加的"、"之前的Z呢"时使用。 Use when user asks "what about X", "when was Y added", "what happened to Z before date".
  • 100git-investigate
    Git history investigation. Use when: tracking code changes, finding where bugs were introduced, root cause analysis. Not for: code exploration (use code-explore), issue analysis (use issue-analyze). Output: history trace + root cause report.
  • 92git-history-analyzer
    Performs archaeological analysis of git history to trace code evolution, identify contributors, and understand why code patterns exist. Use when you need historical context for code changes.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.