Skip to content
Agentmart
Submit a tool

ck:diff-context

Git diff context for focused changes

Skill by forgekit

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/duy-nguyen-2006-ck-diff-context

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Git diff context for focused changes

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/ck-diff-context

What's inside

Skill name
ck:diff-context
Description
Git diff context for focused changes
License
MIT
Metadata
author: forgekit · version: 1.0.0
Instructions
151 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • name: only lowercase letters, digits and single hyphens allowed
  • name: "ck:diff-context" does not match folder "diff-context"

Files (3)

  • SKILL.md
  • diff-workflow.md · references/
  • reverse-deps-strategies.md · references/

SKILL.md (first lines)

# Diff Context

Load minimal context cho fix/refactor/patch tasks từ git diff thay vì toàn codebase.

## Khi nào load skill này

- Fix bug, refactor, patch — task có git history
- Cần hiểu change impact mà không scan cả repo
- Task type: fix, refactor, patch, hotfix, cherry-pick
- User nhắc "diff", "changed files", "what changed"
- `ck:fix` hoặc `ck:code-review` cần context hẹp

## KHÔNG dùng khi

- Task greenfield (không có git history liên quan)
- Task cần hiểu toàn bộ architecture (dùng `ck:context-engineering`)
- Repo mới chưa có commits

## Workflow

### Step 1: Get Diff

```bash
# Staged + unstaged changes
git diff HEAD
# Hoặc so với branch cụ thể
git diff main...HEAD
# Chỉ file names
git diff --name-only HEAD
```

Nếu `--base=REF` được cung cấp: `git diff <REF>...HEAD`

**Output:** `✓ Step 1: Diff captured - [N] files changed, [+X/-Y] lines`

### Step 2: Extract Changed Files

Parse `git diff --name-only` → danh sách file paths.

Lọc bỏ:
- Lock files (package-lock, yarn.lock, pnpm-lock)
- Generated files (*.min.js, *.generated.*, dist/)
- Vendor/third-party

**Output:** `✓ Step 2: [M] changed files identified`

### Step 3: Find Reverse Dependencies

Cho mỗi changed file, tìm files phụ thuộc vào nó. Chi tiết tại `references/reverse-deps-strategies.md`.

**Ưu tiên strategy:**

| Priority | Strategy | Khi nào dùng |
|----------|----------|-------------|
| 1 | GitNexus `impact` | MCP có sẵn, codebase có LSP index |
| 2 | ast-grep AST reference search | Cần precise, có ast-grep installed |
| 3 | ripgrep import/require tracing | Fallback universal, nhanh |
| 4 | tree-sitter local symbol index | Cần offline symbol index |

**Output:** `✓ Step 3: [K] reverse dependencies found`

### Step 4: Load Minimal Context

Chỉ đọc:
1. **Changed files** (từ Step 2) — toàn bộ nội dung
2. **Reverse dep files** (từ Step 3) — chỉ phần liên quan (hunk context)
3. **Diff summary** (từ Step 1) — cho overview

KHÔNG đọc:
- Files không liên quan
- Toàn bộ directory listing
- Full codebase map

**Scope flag:**
- `--scope=files` → chỉ changed files (không reverse deps)
- `--scope=deps` → chỉ reverse deps (không changed files)
- `--scope=all` → cả hai (default)

**Output:** `✓ Step 4: Context loaded - [M] changed + [K] deps = [T] total files`

### Step 5: Build Context Window

Assemble thành context window cho agent:

```
## Diff Summary
[git diff --stat output]

## Changed Files
### path/to/changed-file.ts
[full content]

## Reverse Dependencies
### path/to/dep-file.ts (references: changed-file.ts)
[relevant hunk or full if small]
```

**Output:** `✓ Step 5: Context window built - ~[N] tokens`

## Token Budget

| Phase | Max tokens |
|-------|-----------|
| Step 1-2: Diff + file list | ≤ 500 |
| Step 3: Reverse deps | ≤ 1000 |
| Step 4-5: Load + build | ≤ 5000 (total context) |
| **Total** | **≤ 6500** |

Nếu vượt budget:
1. Ưu tiên changed files > reverse deps
2. Với reverse deps: chỉ load hunk context, không load full file
3. Nếu vẫn vượt: hỏi user refine scope

## Fallback khi không có git

- Không có git repo → route sang `ck:context-engineering`
- Không có GitNexus → dùng ripgrep (Step 3, strategy 3)
- Không có diff (clean working tree) → check `git log -1` cho last commit, hoặc hỏi user

From Duy-Nguyen-2006/ForgeKit, MIT.

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
May 12, 2026 (5 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0.0
License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from forgekit

Cite this page

ck:diff-context skill. Agent Mart. https://agentmart.dev/skills/duy-nguyen-2006-ck-diff-context (last updated 2026-10-24)