CLAUDE.md memory, skills and hooks

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

Watch it inside the full course

The whole course is also one long video on YouTube, all 8 lessons in order. Lesson 2 starts at 45:19.

Read the written version

The Substack article covers the same build step by step, with the prompts and files to copy. Read Lesson 2 on Substack.

More in this section

Continue the course

See all 8 lessons in the Claude Code Full Course: Build AI Systems Without Writing Code.

Dheeraj Sharma

Dheeraj Sharma

AI Systems Builder
I help founders, creators and tech teams build AI automation systems that grow revenue without growing workload. 20 years of enterprise engineering, now in plain English.

Build your own system with me, live

The Claude Code Builder cohort on Maven is 6 weeks of building with me live. You leave with a working system of your own.

See the Claude Code Builder cohort