agentsclimarketplace

Context engineering

Skill manastalukdar/ai-devstudio/skills/context-engineering

Audit and curate the 5-layer agent context hierarchy to prevent quality degradation mid-session — rules files, specs, source files, error output, and conversation history.From its SKILL.md

Install
npx -y skills add manastalukdar/ai-devstudio --skill context-engineering

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.6 KB, 814 tokens by cl100k_base, as published. Nobody here has run it

Context Engineering

I'll audit your current context load, identify what is inflating it unnecessarily, and restructure the 5-layer hierarchy so the agent stays sharp for the rest of the session.

Arguments: $ARGUMENTS — optional focus (e.g., "optimize for implementation", "optimize for debugging")

Token Optimization

Expected range: 200–600 tokens (audit report + recommendations)

Early exit: If context appears healthy (no redundant files loaded, no stale error traces), report "Context healthy — no changes needed"

Patterns used: Bash for file size checks, progressive disclosure (summary first, details on request)

The 5-Layer Context Hierarchy

Layer 1 — Rules files       CLAUDE.md, .claude/rules/*.md
Layer 2 — Specs / designs   docs/specs/, PRD, ADRs
Layer 3 — Source files      only the files currently being changed
Layer 4 — Error output      compiler errors, test failures, logs
Layer 5 — Conversation      current session history

Each layer has an appropriate size budget. Layers 3–5 are the most common source of bloat.

Step 1 — Audit Current Context

# Estimate context pressure indicators
wc -l .claude/rules/*.md 2>/dev/null | tail -1
find . -name "CLAUDE.md" | xargs wc -l 2>/dev/null | tail -1
ls -la docs/specs/ 2>/dev/null | head -10

Check for common inflation sources:

  • Entire files loaded when only a function is needed
  • Stale error traces from previous attempts (no longer relevant)
  • Spec documents for features not currently being implemented
  • Multiple versions of the same file loaded
  • Test output exceeding 200 lines

Step 2 — Report Findings

Context Audit:

Layer 1 (Rules):     [N lines] — [healthy / inflated]
Layer 2 (Specs):     [N files loaded] — [relevant / stale]
Layer 3 (Source):    [N files] — [scoped / over-broad]
Layer 4 (Errors):    [N lines] — [current / stale]
Layer 5 (History):   [estimated turns] — [fresh / compressible]

Top 3 inflation sources:
1. [source] — [recommended action]
2. [source] — [recommended action]
3. [source] — [recommended action]

Step 3 — Apply Recommendations

For each inflation source, take the recommended action:

Over-broad source files: Identify the specific functions or classes needed; reference by grep pattern rather than loading the whole file

Stale error traces: Summarize to the key error type and location (1–2 lines); drop the full stack trace from active context

Off-topic specs: Note the spec exists and where to find it; remove it from active context

Redundant conversation: Summarize completed sub-tasks as a single line each; carry forward only open items

Step 4 — Curate Going Forward

Recommend a loading strategy for the rest of the session based on $ARGUMENTS:

Recommended context loading strategy:
- Layer 3: Load only [file list] — grep for symbols before loading full files
- Layer 4: Keep error output to last 50 lines per error type
- Layer 5: Summarize completed phases; keep only current phase in full detail

Edge Cases

  • No CLAUDE.md or rules files: note the absence; recommend creating minimal rules for consistent behavior
  • Context already very large: recommend starting a fresh session with a focused handoff prompt; provide a handoff template
  • Cannot determine what is loaded: provide the optimization heuristics and let the user apply them manually

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.