원클릭으로
setup-snip-hooks
// Use when setting up snip CLI token reduction hooks in a project, before first terminal commands are run
// Use when setting up snip CLI token reduction hooks in a project, before first terminal commands are run
| name | setup-snip-hooks |
| description | Use when setting up snip CLI token reduction hooks in a project, before first terminal commands are run |
| argument-hint | Run this skill to scaffold snip preToolUse hooks for CLI token reduction in a project. Follow the instructions in the generated SKILL.md file to complete setup. |
| compatibility | copilot |
| user-invocable | true |
| disable-model-invocation | false |
Scaffolds snip preToolUse hook into a project's .github/hooks/ directory. The hook automatically rewrites supported CLI commands through snip to reduce output tokens.
Copilot/VS Code hooks require a hardcoded cwd in hooks.json — there is no environment variable (like ${CLAUDE_PLUGIN_ROOT}) to resolve the hook script path dynamically. The hook must live inside the project so the relative path works.
.github/hooks/snip-rewrite.sh yetsnip and jq are available on the machinecommand -v snip # must exist
command -v jq # must exist
If either is missing, STOP — install before proceeding.
.github/hooks/ in project root if it doesn't existtemplates/ directory:mkdir -p .github/hooks
cp templates/snip-rewrite.sh .github/hooks/snip-rewrite.sh
cp templates/hooks.json .github/hooks/hooks.json
chmod +x .github/hooks/snip-rewrite.sh
.github/hooks/hooks.json already exists, merge the preToolUse entry instead of overwriting.| File | Purpose |
|---|---|
snip-rewrite.sh | preToolUse hook — rewrites commands through snip (Claude Code + Copilot formats) |
hooks.json | Hook registration for Claude Code plugin system |
git, go, cargo, dotnet, npm, npx, yarn, pnpm, docker, kubectl, make, pip, pytest, jest, tsc, eslint, rustc
Custom snip filters for dotnet build and dotnet test are available in filters/:
mkdir -p ~/.config/snip/filters
cp <skill-dir>/filters/dotnet-build.yaml ~/.config/snip/filters/dotnet-build.yaml
cp <skill-dir>/filters/dotnet-test.yaml ~/.config/snip/filters/dotnet-test.yaml
Replace
<skill-dir>with the path to this skill folder (e.g.plugins/minimal-context-tools/skills/setup-snip-hooks).
dotnet-build keeps: compiler errors/warnings + Build succeeded. / Build FAILED. summary.
dotnet-test keeps: test failure details (name, error message, stack trace) + Passed! / Failed! summary.
echo '{"tool_input":{"command":"git status"}}' | .github/hooks/snip-rewrite.sh
# Should output JSON with "snip git status" in updatedInput
git add .github/hooks/
git commit -m "chore: add snip preToolUse hooks for token reduction"