Skip to content

johnnichev/nv-context

Repository files navigation

nv:context

Context engineering for engineers who ship.

npx skills add johnnichev/nv-context -g -y

Auto-detects your tools, commands, and linters. Finds landmines with parallel agents. Generates configs, hooks, session management, and token budgets so every AI coding agent works at maximum effectiveness.

Live experience: skills.nichevlabs.com · production case studies, the research library, and the full synthesis.


Production Proof

Three real codebases. Same skill. Real numbers.

Repo Before After What changed
selectools (Python SDK, 4,612 tests) L3, 49/60 L5–L6, 58/60 CLAUDE.md 440 → 67 lines (-85%). Token budget cut 53%.
nichevlabs (multi-product SaaS, orchestrated by selectools) L4, 17/60 L6, 49/60 SESSION.md 805 → 59 lines (-93%). Saved 15.8K tokens per session. 81 bugs surfaced.
sheriff (Python + TypeScript) L4, 36/60 L5, 42/60 Incremental polish on an already-strong setup. Coverage gate added.

Read the full case studies →

Benchmark: 100% pass rate on 3 test scenarios vs 45.8% baseline (+54.2% delta).

"Most agent failures are not model failures. They are context failures." Philipp Schmid, Google DeepMind


The Problem

Your AI agent is smart. But it keeps running the wrong test command, touching files it shouldn't, and forgetting your rules mid-session. You've tried writing a CLAUDE.md. Maybe you ran /init. It didn't help. Research proves why:

Finding Source
Auto-generated configs reduce success by 3% ETH Zurich
Experienced devs are 19% slower with bad AI context METR Study
40%+ of AI project failures stem from poor context IntuitionLabs
Using 40% of context window outperforms using 90% Dex Horthy
A focused 300-token context beats unfocused 113K tokens FlowHunt

Bad context doesn't just not help. It actively hurts.

See all 200+ sources →


The Solution

nv:context applies 200+ research sources to set up your repo correctly. In under 3 minutes:

  1. Interviews you about your tools, pain points, landmines, and workflow preferences
  2. Analyzes your codebase for non-obvious patterns, exact commands, and architectural gotchas
  3. Scores your setup with the Hierarchy of Leverage framework
  4. Generates tailored configs, only for tools you use, only content agents can't discover themselves
  5. Sets up hooks for deterministic enforcement (auto-format, branch protection, PostCompact re-injection)
  6. Creates session management: HANDOFF.md, .claudeignore, Document-and-Clear workflow
  7. Installs compounding engineering: your codebase gets smarter with every PR review

What Gets Generated

your-repo/
  AGENTS.md                         # Universal: read by 25+ AI coding tools
  CLAUDE.md                         # Claude-specific with @imports (<50 lines)
  tests/CLAUDE.md                   # Testing scope
  src/CLAUDE.md                     # Source scope
  HANDOFF.md                        # Session handoff template
  .claudeignore                     # Exclude irrelevant files from context
  .claude/settings.local.json       # Hooks (auto-format, branch protection, PostCompact)
  .cursor/rules/*.mdc               # Cursor scoped rules (if you use Cursor)
  .github/copilot-instructions.md   # Copilot config (if you use Copilot)
  .github/workflows/
    learn-from-reviews.yml          # Auto-learn from PR reviews

Works with: Claude Code, Cursor, GitHub Copilot, Aider, Codeium, Continue, Windsurf, Zed, and 17 more AI coding tools via the universal AGENTS.md format.


Install

Option 1: Skills CLI (recommended)

npx skills add johnnichev/nv-context -g -y

Option 2: One-liner

mkdir -p ~/.claude/skills/nv-context && curl -o ~/.claude/skills/nv-context/SKILL.md \
  https://raw.githubusercontent.com/johnnichev/nv-context/main/skills/nv-context/SKILL.md

Option 3: Clone with templates

git clone https://github.com/johnnichev/nv-context.git
mkdir -p ~/.claude/skills/nv-context
cp -r nv-context/skills/nv-context/* ~/.claude/skills/nv-context/

Then open any project and run:

/nv-context

Key Features

Hierarchy of Leverage Scoring

Not just L0–L6 maturity. Scores each layer independently:

Hierarchy of Leverage Score
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Verification        [██████████] 10/10
CLAUDE.md quality   [████████░░]  8/10
Hooks               [██░░░░░░░░]  2/10  <- biggest gap
Skills              [████████░░]  8/10
Subagent patterns   [░░░░░░░░░░]  0/10
Session management  [████████░░]  8/10
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Overall             36/60

Top recommendation: Set up hooks for auto-format
and PostCompact re-injection to reach 48/60.

Token Budget Report

Know exactly how much context you're spending before a conversation starts:

Context Budget Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
System prompt          ~2,500 tokens
CLAUDE.md              ~800 tokens
Skill descriptions     ~400 tokens
MCP tools              ~1,200 tokens
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Baseline cost          ~4,900 tokens
Available for work     ~123,100 (96%)
Status: HEALTHY

PostCompact Context Re-injection

The #1 complaint: "my agent forgets rules mid-session." nv:context installs a hook that automatically re-injects critical context after compaction fires. Your landmines and boundaries survive context compression.

Negative Instruction Detection

Research proves "don't use X" makes agents MORE likely to use X. nv:context scans your configs and rewrites:

BEFORE: "don't use moment.js"
AFTER:  "MUST use date-fns for all date operations"

BEFORE: "avoid raw SQL queries"
AFTER:  "MUST use the ORM query builder for database operations"

Compounding Engineering

Tag PR reviews with @claude-learn and the learning auto-creates a PR adding it to AGENTS.md. Your context improves with every code review.

Multi-Level Hierarchy

Not just root configs. Generates scoped files per directory:

CLAUDE.md              # Orientation (50-100 lines)
tests/CLAUDE.md        # Testing patterns, async rules
src/CLAUDE.md          # Import conventions, code patterns
src/api/CLAUDE.md      # API-specific patterns

Agents only load what's relevant to where they're working.


The 8 Laws

Built into every file nv:context generates:

  1. Less is more. Every line must earn its place.
  2. Landmines, not maps. Document what agents can't discover.
  3. Commands beat prose. Snippets over paragraphs.
  4. Context is finite. 150–200 instruction budget.
  5. Progressive disclosure. Layer context by need.
  6. Hooks for determinism. 100% compliance for critical rules.
  7. Negative instructions backfire. "MUST use Y", not "don't use X".
  8. Compact proactively. 60% safe, 70% degrading, 85% hallucinating.

Read the full synthesis → · 10 laws, 4 universal operations, the complete framework.


Research

200+ external sources. 12 research logs. 471 KB of focused notes.

This isn't pop AI. Every recommendation in the skill links back to a real source: published papers, production data, experienced practitioners. Six parallel research agents synthesized 200+ sources into 12 focused logs, organized by research dimension.

Browse the full research library →

Log Coverage
Definitions & Theory Karpathy, Schmid, Anthropic, academic foundations
Articles & Blog Posts 36 deep-analyzed articles
X/Twitter Discourse 50+ posts from 15+ thought leaders
YouTube & Talks 15 videos, 11 podcasts, 5 conference talks
Tools & Frameworks 50+ tools across 10 categories
Agent Config Patterns 10 config formats, ETH Zurich data
Reddit & Forums Practitioner war stories, anti-patterns
GitHub Discussions 40+ real CLAUDE.md files, hooks, skills
Community Wisdom Dev.to, HackerNews, METR study
Advanced Patterns Boris Cherny's workflow, hierarchy of leverage
Python Patterns MCP SDK, Pydantic AI, Python-specific patterns
Workflow Patterns RPI, subagents, TDD, debugging, worktrees

Featured sources: Anthropic, ETH Zurich, Google DeepMind, Manus, LangChain, GitHub (2,500-repo analysis), JetBrains (NeurIPS 2025), METR, Boris Cherny (Claude Code creator), Dex Horthy (12-Factor Agents).

Read the full synthesis · Or read it on GitHub


Docs

Related skills

nv:context is part of the nv: skills collection:

  • nv:context (this repo) · context engineering for AI agents
  • nv:dev · TDD, debugging, code review workflows
  • nv:ops · release workflows, incident response, observability
  • nv:design · Vibe Design methodology (the skill that built skills.nichevlabs.com)

Contributing

nv:context improves when practitioners share what works. Open an issue or PR with:

  • Patterns that improved your agent performance
  • Anti-patterns you discovered the hard way
  • Research we should include
  • Tool-specific configs we're missing

License

MIT


Built by johnnichev. For engineers who ship. Live experience: skills.nichevlabs.com

About

nv:context > Context engineering for engineers who ship. Auto-detects, analyzes, generates configs, hooks, session management, and token budgets. 200+ research sources.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages