>_

Why Skill Graphs Beat Flat Files in Claude Code

Robin||5 min
claude-codeknowledge-grapharchitectureagents
Why Skill Graphs Beat Flat Files in Claude Code

You Have 20 Files. Then 200. Then Chaos.

Every Claude Code power user hits the same wall. You start with a handful of markdown files in .claude/rules/. Ten files. Maybe twenty. Claude loads them, understands your project, and everything works.

Then your system grows. You add agents. Commands. Patterns. Skills. Suddenly you have 200 files and Claude cannot find what it needs. Worse, it loads everything, burns through your context window, and starts forgetting things by the third task.

I hit this wall at 44 rule files. The fix was not fewer files. It was connecting them.

Want the quick version? The free 3-pattern guide covers knowledge graphs alongside memory and delegation - the three patterns behind everything I build.

The Flat File Trap

Most Claude Code setups look like this: a folder full of markdown files, with no relationships between them, no hierarchy, and no way for Claude to know that your delegation rules connect to your agent traits, which connect to your model selection logic.

When you have 15 files, your brain holds the connections. You know that editing the delegation config means checking the trait system too. But Claude does not know that. It treats each file as an island.

This creates three problems at scale:

Discovery - Claude cannot find relevant files without exact keywords. Your brilliant pattern for handling context budgets sits in a file Claude never loads because the user said "tokens" instead of "budget."

Relationships - Files reference each other, but those references are invisible. Change your agent scoring and you need to update delegation thresholds. Nobody tells Claude that.

Overload - Without structure, the only safe strategy is loading everything. That works at 20 files. At 200 files, you burn 30K+ tokens before the first message.

flat-files-failure
20 files - works fine
v
50 files - getting slow
v
100 files - context burns fast
v
200+ files - system breaks

From Files to Graphs

The fix is treating your knowledge base as a graph, not a folder. Every file becomes a node. Every relationship becomes an edge. Instead of dumping files in a directory, you map how they connect.

This is not abstract computer science. It is practical architecture. When Claude loads your delegation rules, the graph tells it: "These connect to agent traits, model selection, and budget awareness." Claude can then decide - do I need those connected files right now? If yes, load them. If not, skip them.

The connections are explicit. Not inferred from keywords. Not guessed from filenames. Defined once, reused across every session.

My system maps 400+ components this way - agents, commands, skills, rules, patterns. Each one a node. Each connection an edge. When I add a new component, I define what it connects to. The graph handles the rest.

knowledge-architecture
NavigationAgents traverse the graph to find what they need
RelationshipsExplicit edges between connected components
ComponentsAgents, commands, skills, rules, patterns

Progressive Disclosure: The Part Nobody Talks About

Here is what I learned after 3 months of running skill graphs in production: a graph alone is not enough. If every node loads its full content when accessed, you just moved the overload problem from a flat folder to a connected one. The graph needs layers.

I built three layers of disclosure:

Layer 1: Metadata - A lightweight config that tells Claude what exists and how things connect. Small enough to hold in memory permanently. Think of it as the table of contents for your entire system.

Layer 2: Summaries - Compressed versions of each component. Core concepts, key decisions, when to use it. Enough for Claude to make informed choices without the full documentation.

Layer 3: Full Content - The complete documentation. Only loaded when Claude actually needs to implement something or deeply understand a pattern.

The loading logic is where it gets interesting. Claude starts with Layer 1 (always loaded, roughly 500 tokens). When it encounters a relevant topic, it pulls Layer 2 (about 300 tokens per component). Only if the task requires deep knowledge does it load Layer 3 (up to 3K tokens). Most tasks never go past Layer 2.

This is how agents navigate a massive knowledge base without the token cost of loading it. My context management architecture explains the routing layer in detail. The combination of graph structure and progressive loading is what makes it scale.

What This Looks Like in Practice

Say I ask Claude to "review the delegation scoring." Without a graph, Claude searches for files containing "delegation" or "scoring." It might find the right file. It might miss three related ones.

With a skill graph, Claude follows a path:

graph-navigation
Query: delegation scoring
v
Graph lookup: delegation node found
v
Load Layer 2 summary (300 tokens)
v
Connected: trait system, model selection
v
Load Layer 3 for delegation only (3K tokens)
v
Task complete - total cost: 3.8K tokens

Instead of loading everything related to delegation - traits, models, budgets, agents, easily 15K tokens - Claude loads the summary, identifies what it actually needs, and pulls only the full content for the relevant node. 3.8K tokens instead of 15K. And it found connected components it would have missed with keyword search alone.

Before and After

Flat Files (200+ components)
  • -Keyword search only - misses related files
  • -All-or-nothing loading per file
  • -30K+ tokens at session start
  • -Claude forgets connections between files
  • -Manual cross-referencing every session
Skill Graph (400+ components)
  • +Graph navigation finds related components
  • +Progressive disclosure - 3 layers
  • +2K tokens at session start
  • +Connections are explicit and persistent
  • +System grows without performance loss

The shift is not just technical. It changes how you think about knowledge management. Instead of asking "where do I put this file?" you ask "what does this connect to?" That question forces better architecture from the start.

Start Small, Connect Early

You do not need 400 components to benefit from this pattern. Even 20 files with defined relationships give Claude better navigation than keyword search. The structure compounds as you grow.

Start by mapping which of your files reference each other. That is your graph. Add a one-paragraph summary for each file. That is your progressive disclosure. Two steps, and you already have a system that scales. The delegation system shows how my agents use these graph connections to find the right context for every task.

The free 3-pattern guide covers the knowledge graph pattern at concept level - enough to get started. The course includes the complete graph schema, node definitions, edge types, and the progressive loading engine. Everything you need to build this for your own Claude Code setup.

Connected knowledge. Compounding returns.

FAQ

How is this different from just organizing files in folders?+
Folders create hierarchy but not relationships. A skill graph explicitly maps connections between any two components regardless of where they live in your file system. When Claude loads delegation rules, the graph surfaces connected components like traits and model selection - something folder structure alone cannot do.
Do I need a database for the knowledge graph?+
No. The graph can be a simple JSON file mapping nodes and edges. My production system uses plain JSON configuration files that Claude reads at session start. No external database, no server, no extra dependencies beyond your existing Claude Code setup.
When should I switch from flat files to a skill graph?+
When you notice Claude missing related files, loading too much context, or when you pass 30-40 components. The pattern works at any size, but the benefits compound significantly past 50 components where manual cross-referencing becomes impractical.
Does this work with Claude Code sub-agents?+
Sub-agents benefit the most because they start with fresh context and zero history. The graph gives them navigation paths to find relevant knowledge quickly instead of relying on the main agent to pass everything through the prompt.

>_ Get the free Claude Code guide

>_ No spam. Unsubscribe anytime.

>_ Related