Skip to content

Commit 306ddcb

Browse files
committed
feat: improve agent skill with forked context, reference docs, and release packaging
Run the skill in an isolated subagent (context: fork) to avoid bloating the main conversation. Split JSON schema and jq recipes into reference.md. Ship skill as a tarball in releases with one-liner install commands for Claude Code, Codex, and Amp.
1 parent c0ef258 commit 306ddcb

File tree

4 files changed

+55
-43
lines changed

4 files changed

+55
-43
lines changed

.claude/skills/drift/SKILL.md

Lines changed: 7 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
name: drift
3-
description: Compare files, directories, archives, or binaries using drift. Use when asked to compare, diff, or analyze differences between two paths - builds, releases, directories, archives (.ipa, .apk, .aar, .jar, .tar.gz), binaries, plists, or text files.
3+
description: Compare and diff files, directories, builds, releases, archives, or binaries. Use when the user wants to compare two versions of something, diff two directories or files, analyze what changed between builds or releases, or examine differences in .ipa, .apk, .aar, .jar, .tar.gz, .tar.bz2, Mach-O binaries, plists, or text files.
44
argument-hint: "<path-a> <path-b> [-m mode]"
5-
allowed-tools: Bash(drift *)
5+
allowed-tools: Bash(drift *), Bash(jq *)
6+
context: fork
67
---
78

89
Compare $ARGUMENTS using `drift --json` and analyze the results.
@@ -13,9 +14,7 @@ Compare $ARGUMENTS using `drift --json` and analyze the results.
1314
drift --json <path-a> <path-b>
1415
```
1516

16-
Optional: force a comparison mode with `-m <mode>` where mode is one of: `tree`, `binary`, `plist`, `text`.
17-
18-
drift auto-detects the correct mode from the inputs. Use `-m` only when the user explicitly requests a specific mode or auto-detection picks the wrong one.
17+
Optional: force a comparison mode with `-m <mode>` where mode is one of: `tree`, `binary`, `plist`, `text`. drift auto-detects the correct mode from the inputs - only use `-m` when the user explicitly requests a mode or auto-detection picks the wrong one.
1918

2019
## Supported inputs
2120

@@ -26,45 +25,14 @@ drift auto-detects the correct mode from the inputs. Use `-m` only when the user
2625
| plist | Property list files (.plist) | Structured key-value diff |
2726
| text | Everything else | Line-by-line unified diff |
2827

29-
## JSON output schema
30-
31-
Every result includes:
32-
33-
- `path_a`, `path_b` - the compared paths
34-
- `mode` - detected comparison mode
35-
- `root` - diff tree where each node has: `name`, `path`, `status` (unchanged/added/removed/modified), `kind`, `is_dir`, `size_a`, `size_b`, and optional `children`
36-
- `summary` - aggregate counts: `added`, `removed`, `modified`, `unchanged`, `size_delta`
37-
38-
For single-file modes (binary, plist, text), a `detail` field is included:
39-
40-
- **binary**: `symbols` (added/removed symbol names), `sections` (segment/section size changes)
41-
- **plist**: `changes` with `key_path`, `status`, and before/after values
42-
- **text**: `hunks` with line-level diffs (`kind`: context/added/removed)
43-
44-
## How to analyze
28+
## Steps
4529

4630
1. Run `drift --json <path-a> <path-b>` and capture the output
4731
2. Start with `summary` to give an overview of what changed
4832
3. For tree mode, walk the `root` to identify the most significant changes (largest size deltas, added/removed files)
4933
4. For binary mode, focus on symbol changes and section size deltas - these indicate code/data growth
5034
5. For plist mode, highlight changed keys and their before/after values
5135
6. For text mode, summarize the hunks by theme (e.g. "updated imports", "refactored function X")
36+
7. Present size deltas in human-readable units (KB/MB)
5237

53-
When the output is large, use `jq` to extract specific parts rather than dumping everything:
54-
55-
```sh
56-
# Just the summary
57-
drift --json A B | jq '.summary'
58-
59-
# Only changed files
60-
drift --json A B | jq '[.root | .. | select(.status? != "unchanged" and .is_dir? == false)]'
61-
62-
# Size delta per file, sorted
63-
drift --json A B | jq '[.root | .. | select(.is_dir? == false and .status? == "modified")] | sort_by(.size_b - .size_a) | reverse | .[] | {path, delta: (.size_b - .size_a)}'
64-
```
65-
66-
## Tips
67-
68-
- For large archives, the JSON can be verbose. Summarize at the directory level first, then drill into specific paths if the user asks.
69-
- Size delta is in bytes. Convert to human-readable units (KB/MB) when presenting to the user.
70-
- When comparing builds, highlight: new files added, files removed, largest size increases, and any unexpected changes.
38+
When the output is large, use `jq` to extract specific parts rather than dumping everything. See [reference.md](reference.md) for the JSON schema and useful jq recipes.

.claude/skills/drift/reference.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# drift JSON reference
2+
3+
## Output schema
4+
5+
Every result includes:
6+
7+
- `path_a`, `path_b` - the compared paths
8+
- `mode` - detected comparison mode (`tree`, `binary`, `plist`, `text`)
9+
- `root` - diff tree where each node has: `name`, `path`, `status` (unchanged/added/removed/modified), `kind`, `is_dir`, `size_a`, `size_b`, and optional `children`
10+
- `summary` - aggregate counts: `added`, `removed`, `modified`, `unchanged`, `size_delta`
11+
12+
For single-file modes (binary, plist, text), a `detail` field is included:
13+
14+
- **binary**: `symbols` (added/removed symbol names), `sections` (segment/section size changes)
15+
- **plist**: `changes` with `key_path`, `status`, and before/after values
16+
- **text**: `hunks` with line-level diffs (`kind`: context/added/removed)
17+
18+
## Useful jq recipes
19+
20+
```sh
21+
# Just the summary
22+
drift --json A B | jq '.summary'
23+
24+
# Only changed files (flat list)
25+
drift --json A B | jq '[.root | .. | select(.status? != "unchanged" and .is_dir? == false)]'
26+
27+
# Size delta per file, sorted largest first
28+
drift --json A B | jq '[.root | .. | select(.is_dir? == false and .status? == "modified")] | sort_by(.size_b - .size_a) | reverse | .[] | {path, delta: (.size_b - .size_a)}'
29+
30+
# List all added files
31+
drift --json A B | jq '[.root | .. | select(.status? == "added") | .path]'
32+
33+
# Total size delta
34+
drift --json A B | jq '.summary.size_delta'
35+
```
36+
37+
## Tips
38+
39+
- For large archives, summarize at the directory level first, then drill into specific paths if the user asks.
40+
- When comparing builds, highlight: new files added, files removed, largest size increases, and any unexpected changes.

.goreleaser.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ archives:
2222
checksum:
2323
name_template: "checksums.txt"
2424

25+
before:
26+
hooks:
27+
- tar -czf skill.tar.gz -C .claude/skills/drift .
28+
2529
release:
2630
extra_files:
27-
- glob: .claude/skills/drift/SKILL.md
31+
- glob: skill.tar.gz
2832

2933
changelog:
3034
sort: asc

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,20 @@ drift works on **macOS**, **Linux**, and **Windows**. Core features (directory/a
158158

159159
## Agent skill
160160

161-
drift ships a skill file that gives AI coding agents native access to structured file comparison via `drift --json`. The skill is included in every [GitHub release](https://github.com/block/drift/releases).
161+
drift ships a skill that gives AI coding agents native access to structured file comparison via `drift --json`. The skill is included in every [GitHub release](https://github.com/block/drift/releases).
162162

163163
Install with a single command:
164164

165165
**Claude Code**
166166

167167
```sh
168-
gh release download --repo block/drift --pattern 'SKILL.md' --dir ~/.claude/skills/drift
168+
mkdir -p ~/.claude/skills/drift && gh release download --repo block/drift --pattern 'skill.tar.gz' --output - | tar -xz -C ~/.claude/skills/drift
169169
```
170170

171171
**Codex / Amp**
172172

173173
```sh
174-
gh release download --repo block/drift --pattern 'SKILL.md' --dir ~/.agents/skills/drift
174+
mkdir -p ~/.agents/skills/drift && gh release download --repo block/drift --pattern 'skill.tar.gz' --output - | tar -xz -C ~/.agents/skills/drift
175175
```
176176

177177
## License

0 commit comments

Comments
 (0)