Growth Kit 2.0 is here! CRO, Paid Ads & more! Code Kit v4.6 released for CC's new Task System.
Claude FastClaude Fast
Mechanics

Load Different Context Based on Session Type in Claude Code

Use --init with slash commands to load different context per session type. A simpler alternative to setup hooks for context loading.

Different work needs different context. Writing blog posts requires brand guidelines and SEO workflows. Building features requires architecture docs and coding patterns. Debugging needs system diagrams and error handling conventions.

You could put everything in CLAUDE.md and hope Claude figures out what's relevant. Or you could load the right context for each session type.

The Simple Solution

Claude Code accepts a prompt after the --init flag:

claude --init "/blog"

This starts Claude and immediately executes the /blog slash command. That command can load whatever context you need: writing guidelines, content workflows, example posts, linking strategies.

No setup hooks. No environment variables. No file copying. Just a command file that contains your context.

When Setup Hooks Are Overkill

Setup hooks (released January 25th, 2026) combine deterministic scripts with agentic oversight. They install dependencies, initialize databases, and run maintenance tasks.

But if you only need to load context for a session type, setup hooks add complexity you don't need. A slash command does the job with less moving parts.

NeedSolution
Install dependencies, run migrationsSetup hooks
Load context for different work typesSlash commands
CI/CD automation with deterministic behaviorclaude --init-only
Interactive onboarding with questionsSetup hooks + /install true

Our Implementation

We use this pattern for blog writing sessions. The file structure:

.claude/
  commands/
    blog.md     # Context embedded in command
justfile        # Launcher shortcuts

The blog.md command contains everything needed for a blog session: brand voice guidelines, content workflow documentation, loading tier instructions, SEO checklists, internal linking rules.

The justfile provides a shortcut:

blog:
    claude --init "/blog"

Running just blog starts a Claude session with all blog context loaded. The session knows the brand voice, understands the linking strategy, and follows the content workflow without being told.

What Goes in a Context Command

A good session context command includes:

Startup message: Tell Claude what kind of session this is and report that context is loaded.

Workflow documentation: The steps and processes for this type of work.

Reference material: Guidelines, examples, checklists that apply to every task in this session.

Quality gates: What to check before considering work complete.

Here's the structure:

---
description: Start a blog writing session with pre-loaded context
---
 
# Blog Session
 
You are starting a blog/content writing session. Report: "Blog session started."
 
---
 
## Content Workflow
 
[Workflow steps and process documentation]
 
## Brand Voice
 
[Guidelines and patterns]
 
## Quality Checklist
 
[Verification steps before publishing]

The context lives directly in the command file. When the command runs, Claude has everything it needs.

Multiple Session Types

You can create commands for each type of work:

.claude/commands/
  blog.md       # Blog writing context
  feature.md    # Feature development context
  debug.md      # Debugging context
  review.md     # Code review context

Each command loads the specific guidelines, workflows, and reference material for that session type. Starting the right kind of session is one command:

just blog     # Blog writing
just feature  # Feature development
just debug    # Debugging session

Why This Works

The --init flag runs your command before any user interaction. By the time you type your first message, Claude already has the context loaded. You skip the "load these files first" dance and get straight to work.

For skills, this pattern means loading the right skill configuration automatically. For CLAUDE.md overrides, it means session-specific instructions without cluttering your base configuration.

Start simple. If you find yourself needing deterministic scripts, installation automation, or agent oversight during setup, move to setup hooks. But for context loading, a slash command is often all you need.

Last updated on

On this page

Claude Code ready in seconds.