Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Context Packing

ASecurity

When and how to bundle local folders/files into LLM context with carrel pack — query-ranked selection, git-scoped packs for PRs, outline/tree orientation, exact token budgeting, chunking and include/exclude strategy. Use when preparing documents or a codebase-adjacent folder as context for an LLM, or when a pack would blow the context window.

2 stars
0 votes
0 copies
0 views
Added 9/19/2026
ai-agentsbashgit

Security Analysis

A100/100

Scanned 9/19/2026

Install to Claude Code

$npx -y skills add coltonbearden/carrel --skill context-packing --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Context Packing?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Context Packing
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/coltonbearden-context-packing/badge)](https://www.skillsdirectory.com/skills/coltonbearden-context-packing)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: context-packing
description: When and how to bundle local folders/files into LLM context with carrel pack — query-ranked selection, git-scoped packs for PRs, outline/tree orientation, exact token budgeting, chunking and include/exclude strategy. Use when preparing documents or a codebase-adjacent folder as context for an LLM, or when a pack would blow the context window.
---

# Context packing with `carrel pack`

`carrel pack PATHS...` turns files and folders into a single LLM-ready document. The skill is choosing *which* files and *how much* of them — in that order. Run `carrel pack --help` before composing flags; the slash command `/carrel-inspect:pack` carries the current help.

## When to pack

- The user wants an LLM (this session or another) to "read" a folder of documents.
- You need repeatable, shareable context (a file you can re-attach) rather than ad-hoc Reads.
- Many small files are involved — one pack beats dozens of Read calls.

Don't pack when the user needs 1–2 specific files — just read those.

## Decision procedure

1. **Ask the index first: `--query`.** For "what does this folder say about X", don't pack the folder — pack the hits: `carrel --root DIR pack DIR --query 'X OR "x phrase"' --top 12 -o ctx.md`. Files come out in relevance order (FTS5 syntax: phrases in quotes, AND/OR/NOT, `term*`). This needs a desk index — run `carrel --root DIR index` once (incremental, cheap to repeat). FTS5 AND-s the terms, so a natural-language question usually matches nothing: under `--json` an empty pack exits 5 and names the query on stderr, so you notice rather than reading a valid empty document (`--no-fail-empty` to opt out; in human mode `--fail-empty` opts in).
2. **Scope by git for reviews: `--since`.** For a PR or branch, `carrel pack . --since main -o pr.md` packs only what changed since the ref (deleted files are listed in the header as removed, not packed); `--changed` does the same for uncommitted work. Combine with `--query` or globs — filters intersect.
3. **Orient before you commit: `--tree-only` / `--outline`.** On an unknown folder, `carrel pack DIR --outline` costs the same as a tree but shows `.py` def/class names with line numbers and `.md` headings — usually enough to pick `--include` globs. `--tree-only` is the bare structure. `--stats` prints a per-file token table (the pack is still written when `-o` is given).
4. **Choose a format.**
   - `--format xml` for Claude — CDATA-wrapped `<file>` sections parse robustly.
   - `--format md` (default) for humans and most models — fenced sections, fences auto-lengthen on collision.
   - `--format json` when a program will consume the pack.
5. **Trim before you chunk.** Prefer `--exclude`/`--include` globs (repeatable) over huge chunk counts: exclude build output, archives, fixtures. `.gitignore` is honored, including `!pattern` re-includes with git's last-match-wins rule (`--no-gitignore` disables); `.git`/`.carrel` are always skipped. Binaries outside the supported types are tree-listed, never inlined. `--dedupe-content` inlines identical files once.
6. **Count precisely when it matters: `--tokenizer exact`.** The default estimate is `ceil(chars/3.6)` labeled `tokens_est` — fine for sizing. When the pack must fit a hard budget (chunks near the window, billing), add `--tokenizer exact` (tiktoken o200k_base, field `tokens`; needs the `carrel[tokens]` extra — exit 3 tells you).
7. **Set budgets.**
   - Fits comfortably (rule of thumb: ≤ half the model's window, e.g. ≲80k tokens for a 200k window): single pack, `-o context.md`.
   - Too big: `--chunk TOKENS -o out.md` → `out.part1..N`, each ≤ TOKENS under the active tokenizer. Files are never split mid-file unless one alone exceeds the budget (then split on line boundaries with "(continued)" markers). Pick TOKENS ≈ what one turn can afford, e.g. 30000–60000. Not with `--outline`.
   - Hard caps: `--max-bytes N` (total) and `--max-file-bytes N` (skip single huge files); omissions are noted in the pack header — mention them to the user.
8. **Images/scans:** only read with `--ocr` (needs tesseract/ocrmypdf); otherwise they're listed but contribute no text.

## Examples

```bash
# The 12 most relevant files about a topic, Claude-friendly
carrel --root ./papers index
carrel --root ./papers pack ./papers --query 'transformer AND survey' --top 12 --format xml -o topic.xml

# Everything a PR touched, with exact token counts
carrel pack . --since main --tokenizer exact --stats -o pr.md

# Orientation pass on an unknown folder
carrel pack ./unknown-folder --outline

# Big corpus, 40k-token chunks, skip anything over 2 MB
carrel pack ./archive --chunk 40000 --max-file-bytes 2000000 -o archive.md
```

## Interpreting results

Report to the user: output path(s), the token total (`tokens_est` or exact `tokens`), the query/ref that selected the files, and anything the header says was omitted or removed (budget hits, skipped binaries, deleted files). If chunked, say how many parts and suggest feeding them in order.

Attribution

coltonbeardencoltonbearden
View sourceMore from coltonbearden →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

1023331 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

686011 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3331 votes

catchup

Recovers prior coding-agent session context by running `catchup <agent> --since-compact`, which extracts a clean summary of a previous Codex, Claude Code, Antigravity, OpenCode, or Pi Agent session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", or asks to recover/summarize a previous session before continuing. Do NOT use for the current conversation, git history, or any non-agent log.

611 votes

math-skill

A comprehensive mathematical reasoning skill for AI assistants — handles arithmetic to research-level problems with rigorous step-by-step reasoning, systematic verification, and transparent uncertainty handling

381 votes
View all in ai-agents →