slicing-code-context
An agent skill by trailofbits, from trailofbits/skills. Tags: analysis, automation, code-quality, developer-tools.
What it does
Selects bounded, graph-informed source slices with Trailmark and delegates focused code analysis or patch-proposal work to a smaller subagent. Use when offloading function-, class-, caller-, callee-, call-path-, entrypoint-, or line-focused code tasks to constrained or locally hosted models without exposing the full repository.
Install
With the skills CLI, which installs into Claude Code, Codex, Cursor and other agents:
npx skills add trailofbits/skills --skill slicing-code-context
Or copy the skill folder into Claude Code's skills directory by hand (~/.claude/skills for every project, or .claude/skills inside one):
git clone --depth 1 https://github.com/trailofbits/skills
cp -r skills/plugins/trailmark/skills/slicing-code-context ~/.claude/skills/slicing-code-context
Safety box score
Grade C, moderate risk: 33 of 100 risk points, rated 2026-10-20. The grade rates what the skill and its scripts can reach on the machine of whoever installs it, across eight categories from shell execution to secrets access. How the score works.
This skill builds bounded source slices from a chosen repository root and hands them to a smaller worker for focused analysis. The main risks are local code execution via `uv`/Python, possible dependency fetching, and deliberate exposure of untrusted source text to the worker; it does not itself write or delete project files.
| Category | Level | Why |
|---|---|---|
| Code & shell execution | 2 (moderate) | The shipped `scripts/build_slice_packet.py` is a PEP 723 Python script run via `uv run`, and `main()` executes Trailmark analysis over the target tree. |
| Network access | 1 (low) | The skill depends on `trailmark>=0.5,<0.6` and says Trailmark is resolved with `uv`, which may contact package indexes, but it does not define any repository-data exfiltration endpoint. |
| Filesystem reach | 1 (low) | `safe_source_path()`, `validated_span()`, and `load_trailmark_graph()` read live files under the chosen target root and reject traversal, with no write/delete behavior. |
| Secrets & credentials | 0 (none) | Nothing in the skill reads tokens, keys, passwords, dotfiles, browser sessions, or CLI logins; it only inspects source files and graph metadata. |
| Privilege & persistence | 0 (none) | There is no sudo, global install, service registration, scheduled task, or shell/profile modification in the skill files. |
| Instruction hijack surface | 3 (high) | `SKILL.md` and `scripts/build_slice_packet.py` explicitly tell the worker to ignore instructions embedded in source/comments/strings/identifiers, so the skill deliberately treats repository text as possible prompt injection. |
| Irreversible actions | 0 (none) | The skill only analyzes code and proposes edits; it does not push, deploy, post, pay, book, or otherwise act outside the local workspace. |
| Transparency | 1 (low) | The scripts are readable, but `load_trailmark_graph()` imports `trailmark` at runtime and the skill relies on `uv` to resolve `trailmark 0.5.x`, so some behavior depends on an external package outside this repo. |
Before installing
- Run `uv run scripts/test_build_slice_packet.py` in a throwaway clone to confirm the local Trailmark/uv setup behaves as expected.
- Inspect `scripts/build_slice_packet.py` before use; verify `--target-dir` points only at the repository you intend to expose.
- Preinstall or allowlist `trailmark 0.5.x` if you want to avoid first-run dependency fetching by `uv`.
- If you use the Claude fallback worker, assume it receives extra ambient context in addition to the packet.
Rated 2026-10-20 by an automated review of 7 files from the skill's repository.
Source
- Repository
- trailofbits/skills (all skills from this repository)
- Path
- plugins/trailmark/skills/slicing-code-context/SKILL.md
- Branch
- main
- Collection
- trailmark
- Updated
- 2026-09-19
Related skills
- c-review — Performs comprehensive C/C++ security review for memory corruption, integer overflows, race conditions, and platform-specific vulnerabilities.
- code-improver — Runs an autonomous review-and-fix improvement loop over any code target — a skill, plugin, module, or directory — using a reviewer the user names.
- dwarf-expert — Analyzes DWARF debug information in compiled binaries.
- github-triage — Triages a repository's open GitHub issues and pull requests via the gh CLI.
- modern-python — Configures Python projects with modern tooling (uv, ruff, ty). Use when creating projects, writing standalone scripts, or migrating from pip/Poetry/mypy/black.
- mutation-testing — Configures mewt or muton campaigns, analyzes surviving mutants, and investigates bugs exposed by testing gaps.