/nexus-agents:context-engineeringfrom nexus-agents
Curates what the agent sees by managing context hierarchy, rules files, memory, and subagent context budgets. Apply when starting sessions or output quality drifts.
Ships in nexus-agents. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
1. Rules files CLAUDE.md, AGENTS.md, .rules/*.md
2. Memory ~/.claude/projects/.../memory/MEMORY.md + topic files
3. Spec / architecture docs/architecture/*.md, ADRs (loaded per feature)
4. Relevant source source files for the task (loaded per task)
5. Live state error output, test results (loaded per iteration)
6. Conversation accumulates, compacts automatically
Higher levels persist across sessions; lower levels are transient. Engineer the higher levels well — they pay for themselves on every future session.
Project-wide, always loaded. nexus-agents canonical:
CLAUDE.md — prime directive, type-safety policy, anti-sprawl, autonomous-loop rules, tooling commandsAGENTS.md — per-skill routing keywords for non-Claude tools.rules/*.md — auto-loaded per-topic rules (typescript.md, git.md, subagent-coordination.md, untrusted-input.md, etc.)Edits here have repo-wide leverage. Treat with care: these are the single biggest input to every future session.
Per-user, cross-session. ~/.claude/projects/-home-william-git-nexus-agents/memory/:
MEMORY.md — index, always loaded. Keep entries to one line < 200 chars.<topic>.md — detail loaded on relevance.CLAUDE.md "auto memory" for what to save (user/feedback/project/reference) and what NOT to save (anything derivable from git log or current files).Memory is a point-in-time observation, not live state. Verify against current code before asserting facts from a stale memory.
Load the relevant section, not the entire 5000-word spec. ADR-shaped docs in docs/adr/ are short by design — load freely. Architecture docs in docs/architecture/ are larger — load only what applies.
Before editing a file, read it. Before introducing a pattern, find an existing example via Grep. nexus-agents canonical paths are tabulated in CLAUDE.md ("Canonical Paths") — start there for module discovery.
Test output, lint errors, CI logs, current git status. Capture once, summarize, don't keep re-fetching.
Auto-compacts as it grows. Per CLAUDE.md "Context management": when working with tool results, write down important info in your response — the original tool result may be cleared later.
Per CLAUDE.md "Subagent Context Management" + .rules/subagent-coordination.md:
src/consensus/") over codebase-wide sweeps. For whole-repo tasks, partition by top-level dir, one agent per partition.## Status: complete | blocked — <reason> | partial — cutoff at X of Y. Blockers surface in the same response, not silently.## Discoveries section for bugs found outside their scope. Parent agent re-verifies before filing (the 4-point gate in CLAUDE.md "Discovered Issues").When context conflicts or a requirement is ambiguous, don't silently pick. Surface it:
CONFUSION:
- The CLAUDE.md prime directive says "correctness > simplicity > performance"
- The performance-optimization skill says we should optimize hot paths
- This change adds 40 LOC of micro-optimization to a path with no perf evidence
Options:
A) Apply the optimization — defends a future hot path
B) Skip the optimization — no current evidence of slowness
C) Add a perf benchmark first to gather evidence
→ Which approach do you want?
When a requirement is missing, don't invent it. Ask. The human's job is to define requirements; the agent's job is to implement them.
For multi-step tasks, emit a lightweight plan before executing:
PLAN:
1. Add Zod schema for task creation — title required, description optional
2. Wire schema into POST /api/tasks route handler
3. Add test for the validation error response
→ Executing unless you redirect.
A 30-second plan catches wrong directions before you've built on them. Saves 30 minutes of rework.
| Excuse | Counter |
|---|---|
| "The agent should figure out the conventions" | It can't read your mind. Write the rules file. 10 minutes upfront saves hours of correction. |
| "I'll correct it when it goes wrong" | Prevention is cheaper than correction. Drift compounds across iterations. |
| "More context is always better" | Performance degrades with non-relevant context. Aim for ~2,000 lines of FOCUSED context per task. |
| "The context window is huge, I'll use it all" | Window size ≠ attention budget. Focused context outperforms large context. |
| "I'll just have one giant subagent do it all" | One 50k-token subagent return == catastrophic context flood. Wave of 3-4 with bounded outputs. |
| "I'll let the subagent decide what's relevant" | The subagent can't see your goal. State the question, the scope, and the output budget explicitly. |
| Anti-pattern | Symptom | Fix |
|---|---|---|
| Context starvation | Agent invents APIs, ignores conventions | Load rules + relevant source before each task |
| Context flooding | Agent loses focus with > 5k lines of irrelevant context | Include only what's relevant; aim < 2k focused lines per task |
| Stale context | Agent references deleted code or old patterns | Start fresh session when switching unrelated tasks |
| Missing examples | Agent invents new style instead of following yours | Include one example of the canonical pattern |
| Implicit knowledge | Agent doesn't know project-specific rules | Write it down. "Tribal knowledge" doesn't survive a session boundary. |
| Silent confusion | Agent guesses when it should ask | Surface ambiguity using the Confusion-management pattern |
| Subagent flood | Wave of 6+ parallel agents → parent context exhausted | Wave-of-3-4 max. Summarize each result to 2-3 bullets in parent. |
CLAUDE.md, AGENTS.md, relevant .rules/*.md) loaded at session startMEMORY.md index reviewed for relevant prior contextWhat SKILL.md sets; muted values are Claude Code's defaults
34 skills in this plugin
/api-and-interface-designDesign stable, hard-to-misuse interfaces — REST endpoints, MCP tool
schemas, module boundaries, type contracts. Apply when defining new
surfaces or evolving public ones. Triggers on "API design", "interface",
"schema", "contract", "module boundary", "type design".
/browser-testing-with-devtoolsTest UI in real browsers via Chrome DevTools MCP. Apply when debugging
rendering issues, console errors, network behavior, performance, or
accessibility — anywhere static code analysis can't see runtime state.
Triggers on "browser test", "DOM inspect", "console errors",
"network trace", "core web vitals in browser", "ui bug repro".
/bug-fixClaude Code installs this plugin but refuses to load it
hooks/hooks.json: hooks.PreToolUse.0: Hook matcher "hooks" must be an array of hook entries; received undefined; hooks.PreToolUse.1: Hook matcher "hooks" must be an array of hook entries; received undefined — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
hooks/hooks.json: hooks.PreToolUse.0: Hook matcher "hooks" must be an array of hook entries; received undefined; hooks.PreToolUse.1: Hook matcher "hooks" must be an array of hook entries; received undefined — a PreToolUse/PermissionRequest hook that cannot be loaded may be what guards the permissions declared beside it, so nothing it sits in is applied until the entry is fixed or removed
Checked against Claude Code 2.1.332. The listing below is what the repository ships; Claude Code doesn't load it as published.
Other plugins' skills for the same job