Quick Summary#
This post covers:
- CLAUDE.md: Always-loaded project context and instructions
- Slash commands: Prompts you invoke with
/commandin the terminal - Subagents: Specialists with their own context window for delegated tasks
- Skills: Rich, auto-discovered capabilities with supporting files (not manually runnable via
/...) - Key insight: subagents keep your main context clean—in plan mode, Claude Code will typically delegate repo scanning to an
Explore-style subagent so your main thread doesn’t balloon
Table of Contents#
Introduction#
Claude Code gives you multiple ways to “teach” it project context or automate workflows, but it’s not always obvious when to use which.
I’ll solve the same problem four different ways so the trade-offs are concrete. Spoiler: for doc-fetching, subagents win because they keep your main context clean.
The Problem#
Claude Code doesn’t have up-to-date training data for every library, so it can’t reliably “remember” what a docs site says today.
The specific problem: I’m building a workout tracking app with Dexie.js (IndexedDB wrapper). Claude keeps suggesting outdated patterns and misses things like liveQuery().
Claude Code itself has a mechanism to fetch its own documentation. We need to do the same for our specialized libraries.
Let’s solve it with all four tools, then compare.
1. CLAUDE.md: Always-On Project Memory#
What It Is#
A markdown file that’s automatically loaded every time you start Claude Code. Think of it as your project’s “memory card.”
CLAUDE.md: Persistent project instructions that Claude reads at the start of every conversation.
Where It Lives#
Nested CLAUDE.md Files#
Claude Code also discovers nested CLAUDE.md files in subdirectories. When Claude reads files from a directory containing its own CLAUDE.md, that file gets added to the context automatically.
This is useful for directory-specific instructions:
tests/CLAUDE.md— testing conventions, preferred mocking patternssrc/db/CLAUDE.md— database-specific patterns and constraintssrc/components/CLAUDE.md— component architecture guidelines
The nested file is only loaded when Claude actually accesses files in that directory, keeping your main context lean until you need that specialized knowledge.
The Dexie.js Solution#
# CLAUDE.md
## Database
We use Dexie.js for IndexedDB. Before implementing any database code:
1. Fetch the docs index from https://dexie.org/llms.txt
2. Use `liveQuery()` for reactive data binding
3. Follow the repository pattern in `src/db/`
4. Always handle `ConstraintError` for duplicate keys
What Happens#
Every conversation starts with Claude knowing “fetch Dexie docs before writing database code.”
The catch is context drift: in long sessions, the model can gradually deprioritize earlier system-level instructions in favor of the most recent conversation history.
Trade-offs#
| ✅ Pros | ❌ Cons |
|---|---|
| Zero effort—always loaded | Context Drift: Claude forgets instructions as sessions get longer |
| Team-shared via git | No dedicated context window—competes with your conversation |
| Simple to maintain | No enforcement—Claude decides whether to follow |
2. Slash Commands: Simple Skills You Invoke#
What It Is#
A saved prompt you invoke by typing /command-name. Like a macro or keyboard shortcut for prompts.
Slash commands can be invoked explicitly (you type /command) and can also be auto-invoked by Claude when the command’s description matches the task.
Slash commands can also orchestrate other behavior: you can spell out in the command itself that it should spin up a subagent (or a specific subagent), call out a particular skill/workflow, and generally “pipeline” the work (e.g., research → codebase scan → write a doc) instead of trying to do everything in one shot.
The main difference vs skills is packaging + UX: slash commands are single-file entries with great terminal /... discovery/autocomplete; skills are usually directories with supporting files (patterns, templates, scripts).
Where It Lives#
The Dexie.js Solution#
---
description: Get Dexie.js guidance with current documentation
allowed-tools: Read, Grep, Glob, WebFetch
---
First, fetch the documentation index from https://dexie.org/llms.txt
Then, based on the user's question, fetch the relevant documentation pages.
Finally, answer the following question using the current documentation:
$ARGUMENTS
Manual Orchestration Example (Research)#
If you want a slash command that explicitly launches multiple subagents in parallel and then produces an artifact (like a research note in docs/research/), you can encode that directly in the command definition.
How You Use It#
/dexie-help how do I create a compound index?
What Happens#
Claude fetches the docs, finds the relevant pages, and answers your question—triggered explicitly.
Trade-offs#
| ✅ Pros | ❌ Cons |
|---|---|
| You control exactly when it runs | Must remember to type /dexie-help |
| Can pass arguments for specific questions | One-shot—doesn’t persist knowledge across messages |
| Simple single-file setup | Auto-triggering depends on description match |
3. Subagents: Specialists with Their Own Context#
What It Is#
A specialized AI “persona” with its own context window. Claude delegates entire tasks to it and gets results back.
Because fetching the Dexie docs involves reading multiple pages and creates a lot of context noise, keeping this inside a subagent prevents your main chat from hitting context limits.
Subagent: An isolated Claude instance that works on a task independently and returns only the results to your main conversation.
💪Subagents keep your main context clean
Even when the task is “just exploration,” subagents are a great default because they let Claude do lots of reading/searching without dumping everything into your main thread.
This is especially useful in plan mode: Claude Code will typically kick off an Explore-style subagent to scan the repo and return a distilled map of relevant files/patterns, so your main conversation stays focused and doesn’t blow up.
Claude Code also supports async agents: fire one off, let it cook while you keep working, then it comes back with its updates when it’s done. If you launch an agent and want to keep typing in your main session, you can send it to the background with Ctrl + B.
Claude Code does this too
Claude Code’s own system prompt includes a built-in “documentation lookup” workflow that uses a subagent:
-> Looking up your own documentation: When the user directly asks about any of the following:
- how to use Claude Code (eg. “can Claude Code do…”, “does Claude Code have…”)
- what you’re able to do as Claude Code in second person (eg. “are you able…”, “can you do…”)
- about how they might do something with Claude Code (eg. “how do I…”, “how can I…”)
- how to use a specific Claude Code feature (eg. implement a hook, write a skill, or install an MCP server)
- how to use the Claude Agent SDK, or asks you to write code that uses the Claude Agent SDK
Use the Task tool with subagent_type=‘claude-code-guide’ to get accurate information from the official Claude Code and Claude Agent SDK documentation.
Source: https://github.com/marckrenn/cc-mvp-prompts/blob/main/cc-prompt.md
Where It Lives#
The Dexie.js Solution#
What Happens#
When you ask about Dexie, Claude automatically recognizes this as a database task and delegates to the specialist. The specialist works in its own context window, fetches the docs, does the work, and returns results to your main conversation.
Trade-offs#
| ✅ Pros | ❌ Cons |
|---|---|
| Auto-delegated when task matches | Heavier—launches a separate agent |
| Separate context window—doesn’t clutter main | Results come back as a summary, not live |
| Can use different model (e.g., opus for complex) | You can’t interact with the agent directly |
| Can restrict tools for security | More complex to set up |
4. Skills: Rich Capabilities with Auto-Discovery#
What It Is#
A structured capability with optional supporting files that Claude discovers automatically and uses within your main conversation.
Unlike simple slash commands, skills can include multiple files: reference documentation, scripts, templates, and utilities.
Where It Lives#
How Claude Sees Skills#
Claude decides whether to invoke a skill largely based on its description.
You can also ask Claude Code something like:
> “tell me me exactly how this looks for you <available_skills> ?”
When it answers, you’ll often see structured blocks that look like <available_skills> (and typically a separate block for slash commands, e.g. <available_commands>).
<available_skills>
<skill>
<name>dexie-expert</name>
<description>
Dexie.js database guidance. Use when working with
IndexedDB, schemas, queries, liveQuery...
</description>
</skill>
</available_skills>
Here’s an abbreviated example of what the <available_skills> section can look like (truncated with ...):
<available_skills>
<skill>
<name>skill-creator</name>
<description>
Guide for creating effective skills. Use when you want to create or update a skill.
...
</description>
<location>user</location>
</skill>
<skill>
<name>c4-architecture</name>
<description>
Generate architecture documentation using C4 model Mermaid diagrams.
...
</description>
<location>user</location>
</skill>
<skill>
<name>vue-composables</name>
<description>
Write high-quality Vue 3 composables following established patterns and best practices.
...
</description>
<location>managed</location>
</skill>
...
</available_skills>
The Dexie.js Solution#
---
name: dexie-expert
description: Dexie.js database guidance. Use when working with IndexedDB, schemas, queries, liveQuery, or database migrations.
allowed-tools: Read, Grep, Glob, WebFetch
---
# Dexie.js Expert
When the user needs help with Dexie.js or IndexedDB:
1. Fetch https://dexie.org/llms.txt
2. Fetch only the relevant pages for the task
3. Apply the guidance to this repo’s patterns
A Minimal “Does This Even Work?” Skill#
If you just want to verify that a Skill can spin up subagents to do work (via the Task tool), here’s a deliberately dumb smoke test you can copy/paste.
What Happens#
Skills are auto-discovered and typically get applied when Claude decides they match the current task. They run in your main conversation, so you can iterate live.
If you need a manual, predictable trigger from the terminal, package the workflow as a slash command (since /... is for commands).
Trade-offs#
| ✅ Pros | ❌ Cons |
|---|---|
| Auto-discovered based on description | Shares main context window space |
| Works in main conversation—live interaction | Claude decides when to trigger (may not fire) |
| Can include reference files, scripts, templates | More setup than slash commands |
| Deep, reusable workflow packaging | Not manually invokable via /... in the terminal |
| Feels like enhanced Claude, not a separate tool |
📢Key Insight
In practice, the difference is mostly UX + packaging:
- Slash commands are what you can run manually from the terminal via
/command. - Skills are structured, auto-discovered capabilities (often a directory of supporting files) that Claude may apply when relevant.
When to use what#
| Pick this | When | Why |
|---|---|---|
| CLAUDE.md | You want Claude to always start with project rules/context | Auto-loaded on startup; shared via git |
| Slash command | You want an explicit one-shot workflow you run on demand | Discoverable via /..., can take arguments |
| Subagent | The task is research-heavy (lots of reading/searching/synthesis) | Uses a separate context window; returns a distilled result |
| Skill | You want a rich workflow that Claude can auto-apply when it recognizes the task | Packaged capability (often with supporting files) |
How they relate#
| Mechanism | Runs in main conversation | Separate context window | Can spawn subagents | Can use skills | Manually runnable via /... |
|---|---|---|---|---|---|
| CLAUDE.md | ✅ | ❌ | ❌ | ❌ | ❌ |
| Slash command | ✅ | ❌ | ✅ (by instructing Task) | ✅ (indirectly; Claude may apply skills) | ✅ |
| Skill | ✅ | ❌ | ✅ (if Task is allowed) | ✅ (Claude may apply multiple skills) | ❌ |
| Subagent | ❌ | ✅ | ⚠️ Possible (depends on allowed tools, e.g. Bash(claude:*)) | ✅ (if configured via skills:) | ⚠️ Usually delegated |
Conclusion#
- Use subagents (especially
Explorein plan mode) to keep your main context small and focused. - Use slash commands when you want an explicit, repeatable terminal entry point.
- Use skills when you want Claude to auto-apply a richer workflow (often with supporting files).
- Use CLAUDE.md for short, always-true project conventions and standards.
