The Claude Code Extension Stack: Commands, Skills, Hooks, and Agents Explained

Compares Claude Code extension types: CLAUDE.md, commands, skills, hooks, agents, then builds a memory system and 3 custom commands.

Table of Contents

The Claude Code Extension Stack is a 4-layer system (CLAUDE.md, Skills, Hooks, Agents) that gives Claude Code persistent memory and automated behavior across sessions. This lesson explains what each layer does, when to use it, and walks through building a CLAUDE.md file and two starter skills in about 20 minutes.

What you will be able to do

  • Write a CLAUDE.md file using the 5 essential sections: critical rules, project overview, how to work here, what Claude gets wrong, and deeper docs.
  • Place CLAUDE.md at the correct level, project (.claude/CLAUDE.md), user (/.claude/CLAUDE.md), or auto memory (/.claude/MEMORY.md), so project rules override personal ones correctly.
  • Build a user-invocable skill (SKILL.md with YAML frontmatter) like /quick-audit that runs on demand.
  • Set disable-model-invocation and user_invocable in a skill's frontmatter to control whether you, Claude, or both can trigger it.
  • Trim an oversized CLAUDE.md with progressive disclosure, moving task-specific content into separate docs files so Claude stops ignoring buried rules.

Before you start

  • Claude Code installed and a project folder open to work in.
  • Basic comfort reading and writing markdown and YAML frontmatter.
  • Having completed Lesson 1 (AI Content Multiplication System) helps since this lesson extends that project, though it is not strictly required.

Reference

Item Location Purpose
/init Run in project root Scans the project and generates a starter CLAUDE.md in about 30 seconds
.claude/CLAUDE.md Level 1: project memory Read every session opened in this project directory; knows architecture, conventions, key files
~/.claude/CLAUDE.md Level 2: user memory Applies across all projects; personal preferences, name, business context
~/.claude/MEMORY.md Level 3: auto memory The only memory file Claude Code writes to itself, storing lessons across sessions
.claude/skills/ (project) or ~/.claude/skills/ (global) Skill location Canonical folder for skills; legacy .claude/commands/ still works
description (frontmatter field) SKILL.md Explains the skill to users and tells Claude when to auto-invoke it
user_invocable: true/false SKILL.md frontmatter Controls whether the skill shows in the / menu (default: true)
disable-model-invocation: true/false SKILL.md frontmatter Controls whether Claude can auto-invoke the skill (default: false, meaning Claude can invoke)

Common errors and fixes

What goes wrong The fix
Claude keeps skipping a rule you set (e.g. read files before editing) The rule is buried in a long CLAUDE.md full of irrelevant content; cut the file to under 200 lines of universally relevant rules
CLAUDE.md is stuffed with everything (linting rules, task workflows, code snippets, full docs) Every irrelevant instruction degrades Claude's attention to the rules that matter; move linting to hooks, workflows to separate docs files, and replace code snippets with file:line pointers
Claude auto-invokes a skill that has side effects, like distributing a draft before it is ready Set disable-model-invocation: true on that skill so only you can trigger it
Claude opens a new session with zero memory of the project and you re-explain everything Create a CLAUDE.md file so project context persists automatically without repeating yourself
A background-knowledge skill (e.g. legacy API patterns) clutters the / menu as a manual command Set user_invocable: false so only Claude can invoke it as context, not you as a command

Read the full walkthrough

The complete lesson, with screenshots and any downloads, is published on Substack as part of Claude Code Masterclass: Build AI Systems Without Writing Code.

Read Lesson 2 on Substack →

More in this section

Continue the course

Browse all lessons in the Claude Code Masterclass: Build AI Systems Without Writing Code course, or subscribe to the GenAI Unplugged newsletter to get new lessons in your inbox.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
Creator of the n8n Zero to Hero course (42 lessons, 31+ hours). I help solopreneurs build AI systems that grow revenue without growing workload.

Get the n8n Mastery Bundle

All workflows, cheat sheets, and premium resources from the entire course in one package.

Read the full lesson on Substack