What you will be able to do
- Write a custom slash command as a skill and predict which one runs when names collide
- Define a subagent in .claude/agents/ and say what context it starts with
- Continue, resume and switch sessions
- Run Claude Code headless with -p and stream its output as stream-json
- Set a starting permission mode and keep hard boundaries in place under auto mode
1.Skills, commands, and built-in vs custom slash commands
Claude Code ships with built-in slash commands such as /init, /memory, /context, /config, /model, /effort and /resume. It also includes bundled skills, for example /run and /verify. You add your own custom slash commands as Skills. A skill is a folder containing a SKILL.md file, placed in ~/.claude/skills/ for personal use or in .claude/skills/ to share with the project. Claude runs it when you type its name, or on its own when your request matches the skill's description. A single markdown file in .claude/commands/ is the older Commands format. It still works, but skills are preferred because they can include supporting files.
---
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed, wants a commit message, or asks to review their diff.
---
## Current changes
!`git diff HEAD`
## Instructions
Summarize the changes above in two or three bullet points, then list any risks you notice such as missing error handling, hardcoded values, or tests that need updating. If the diff is empty, say there are no uncommitted changes.When two skills have the same name, the enterprise skill beats the personal one, and the personal one beats the project one. A skill beats a .claude/commands/ file with the same name. Your skill replaces a bundled command of that name, but not the command's aliases. Plugin skills are namespaced as /plugin-name:skill-name, so they never collide.
Checkpoint 1 of 7· Check yourself
deploy exists in both ~/.claude/skills/ and the project's .claude/skills/. What does /deploy run?
Among enterprise, personal and project skills, the more personal scope wins over the project.
“Enterprise over personal, and personal over project.”Source: code.claude.com
Sources1
2.Agents: built-in and custom subagents
A subagent does focused work in its own context, so exploration doesn't fill up your main conversation. Built-in types include Explore and Plan, which are read-only research agents, and General-purpose, which has every tool available to subagents and can modify code. To create your own, add a markdown file with frontmatter to .claude/agents/ for the project or ~/.claude/agents/ for all your projects.
---
name: code-reviewer
description: Reviews code for quality and best practices
tools: Read, Glob, Grep
model: sonnet
---
You are a code reviewer. When invoked, analyze the code and provide
specific, actionable feedback on quality, security, and best practices.| Location | Scope | Priority |
|---|---|---|
| Managed settings | Organization-wide | 1 (highest) |
| --agents CLI flag | Current session | 2 |
| .claude/agents/ | Current project | 3 |
| ~/.claude/agents/ | All your projects | 4 |
| Plugin's agents/ directory | Where plugin is enabled | 5 (lowest) |
Only name and description are required. The other frontmatter fields shape what the subagent starts with. By default it loads the user, project and local CLAUDE.md files; set omitClaudeMd to true to skip them. The skills field injects each listed skill's full content at startup. The memory field gives the subagent its own persistent memory with a user, project or local scope, so it can learn across sessions. permissionMode, model, tools and isolation: worktree complete the set.
Checkpoint 2 of 7· Check yourself
A custom subagent's frontmatter doesn't set omitClaudeMd. What happens to the project's CLAUDE.md when it launches?
omitClaudeMd is an opt-out. Without it, the subagent starts with your CLAUDE.md files.
“Set to true to launch this subagent without the user, project, and local CLAUDE.md files”Source: code.claude.com
Sources2
3.Session management
Every conversation is a saved session that you can return to. When you resume one, the full history comes back, including tool calls and their results, and the session normally keeps the model it was using.
| Command | What it does |
|---|---|
| claude --continue | Reopens the most recent conversation in the current directory |
| claude --resume | Opens the session picker |
| claude --resume <name> | Resumes the named session directly |
| claude --from-pr <number> | Opens the picker filtered to sessions linked to that pull request |
| /resume | Switches to a different conversation from inside an active session |
Checkpoint 3 of 7· Match them up
Match each command to its effect
Tap a term, then the definition that fits it.
--continue picks the most recent session for you, --resume lets you choose one, and /resume works from inside a running session.
“Reopens the most recent conversation in the current directory”Source: code.claude.com
Checkpoint 4 of 7· Exam question
Over several months, Claude has accumulated notes in a project's auto memory, and MEMORY.md has grown so long that Claude seems unaware of the entries near its end when a new session starts, even though the detailed topic files in the same directory are intact. Which change best fixes this?
Correct answer: A — Condense MEMORY.md into a short index with one line per memory, moving detailed notes into topic files that Claude reads on demand.
- A. Correct. Auto memory loads only the beginning of the index file at session start and drops what lies beyond its read limit, so the index should stay short and point to detail. Detailed notes belong in topic files, which Claude reads on demand with its standard file tools when it needs them.
- B. Incorrect. The
/memorycommand lists memory files and lets you browse, edit or toggle auto memory; it does not reload an over-long index into context, so the entries beyond the load limit would still be missing. - C. Incorrect. Topic files are the intended home for detail because Claude reads them on demand. Moving that detail into the index makes it longer and pushes even more content past the point where the session-start load stops.
- D. Incorrect. Claude Code does not condense the index on its own: when the file nears or exceeds its read limit it reminds Claude to shorten it, and the write still succeeds, so entries past the limit are simply dropped on the next load.
Sources3
4.Headless mode and streaming output
The -p flag runs Claude Code headless: there is no interactive session, and it prints the result and exits. This is how you use it in scripts and CI. You can pipe input in and redirect output out. --allowedTools approves tools in advance, so the run never stops at a permission prompt. --bare runs without loading local configuration, and flags such as --settings, --agents and --mcp-config pass that configuration in explicitly.
cat build-error.txt | claude -p 'concisely explain the root cause of this build error' > output.txt--output-format takes one of three values. text is the default. json returns structured JSON containing the result, the session ID and metadata, and you can add --json-schema to get structured output. stream-json is streaming mode: newline-delimited JSON events emitted as they happen. Add --include-partial-messages to receive text deltas as they arrive.
Checkpoint 5 of 7· Fill the gap
Which output format streams events in real time?
claude -p "Explain recursion" --output-format ? --verbose --include-partial-messagesstream-json emits newline-delimited JSON events as they happen. json returns a single object at the end.
Source: code.claude.comSources4
5.Permission modes and auto mode
The permission mode decides how often Claude Code stops to ask before acting. The modes are default, acceptEdits, plan, auto, dontAsk and bypassPermissions. In auto mode, a classifier approves or blocks each action instead of asking you. You can start a session in a given mode with a flag, or set permissions.defaultMode in a settings file.
So a committed project file can't turn on auto mode for a teammate. A defaultMode set in ~/.claude/settings.json or in managed settings does apply. For a single session, pass the mode as a flag, for example claude --permission-mode default.
Auto mode doesn't replace your permission rules. A permissions.deny rule blocks the action before the classifier is consulted. A permissions.ask rule always prompts, and the classifier can't auto-approve it. A boundary you only say in chat, such as 'don't push until I review', can be lost when context compaction removes that message. For a limit that has to hold, write a rule.
{
"permissions": {
"ask": [
"Bash(git push *)",
"Bash(gh pr create *)"
]
}
}Checkpoint 6 of 7· Check yourself
In auto mode, which mechanism makes sure an action never runs, whatever the classifier decides or the user asks?
deny is checked before the classifier and can't be overridden. ask still allows the action after you approve it, and a boundary stated in chat can be lost.
“Blocks before the classifier is consulted. Neither the classifier nor user intent can override it.”Source: code.claude.com
Checkpoint 7 of 7· Exam question
An organization deploys a Bash(curl *) deny rule through managed settings so no developer can override it. A project's checked-in .claude/settings.json adds an allow rule for Bash(curl *) so the CI pipeline can fetch build artifacts. A developer working locally runs curl from an interactive session. What happens?
Correct answer: A — The command is still blocked, because managed settings sit at the top of the precedence order and cannot be overridden by project, local, or user settings.
- A. Correct. Managed settings are the highest-priority scope and cannot be overridden by any other scope, so the deny rule still blocks the command regardless of the project's allow rule.
- B. Incorrect. While permission arrays merge across scopes, managed deny rules are not overridable by lower-priority allow rules from project settings.
- C. Incorrect. There is no automatic fallback to a prompt when a managed deny rule exists; the deny simply wins outright.
- D. Incorrect. Precedence is not based on load order; managed settings always outrank project settings regardless of when each file is read.
Practise it for real
Create a personal skill and call it both ways: by slash command and by plain request
1.Run
mkdir -p ~/.claude/skills/summarize-changesWhy: A personal skill is a folder under ~/.claude/skills/, so it loads in all your projects
You should see: An empty skill directory
2.Save the SKILL.md shown in this lesson into that folder
Why: The description tells Claude when to use the skill, and the !
git diff HEADline puts the diff into the promptYou should see: ~/.claude/skills/summarize-changes/SKILL.md exists
3.In a git repo with uncommitted edits, type
/summarize-changesWhy: The folder name becomes the custom slash command
You should see: Two or three bullet points summarizing the diff, followed by any risks
4.Start a fresh request and ask
What did I change?Why: Claude can choose a skill on its own when your request matches the skill's description
You should see: The same skill runs without you typing the slash command
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://code.claude.com/docs/en/skillsOfficial docs
“Prefer a skill for new work, since skills also support supporting files.”
↩︎ Skills, commands, and built-in vs custom slash commands“Your skill replaces the bundled command, but not its aliases.”
↩︎ Skills, commands, and built-in vs custom slash commands“a Markdown file in .claude/commands/ is the older format and still works.”
↩︎ Exam trap 2“Enterprise over personal, and personal over project.”
↩︎ Checkpoint - 2.https://code.claude.com/docs/en/sub-agentsOfficial docs
“Preserve context by keeping exploration and implementation out of your main conversation”
↩︎ Agents: built-in and custom subagents“Persistent memory scope: user, project, or local. Enables cross-session learning”
↩︎ Agents: built-in and custom subagents“The full skill content is injected, not only the description.”
↩︎ Agents: built-in and custom subagents“Set to true to launch this subagent without the user, project, and local CLAUDE.md files”
↩︎ Checkpoint - 3.https://code.claude.com/docs/en/sessionsOfficial docs
“Conversation history: the full history, including tool calls and results.”
↩︎ Session management“the session continues on the model it was using.”
↩︎ Session management“Reopens the most recent conversation in the current directory”
↩︎ Checkpoint - 4.https://code.claude.com/docs/en/headlessOfficial docs
“stream-json: newline-delimited JSON for real-time streaming”
↩︎ Headless mode and streaming output“json: structured JSON with result, session ID, and metadata”
↩︎ Headless mode and streaming output - 5.https://code.claude.com/docs/en/auto-mode-configOfficial docs
“The classifier blocks matching actions, but the boundary can be lost if context compaction removes the message that stated it.”
↩︎ Permission modes and auto mode“The classifier cannot auto-approve a matching action.”
↩︎ Permission modes and auto mode“Blocks before the classifier is consulted. Neither the classifier nor user intent can override it.”
↩︎ Checkpoint - 6.https://code.claude.com/docs/en/permission-modesOfficial docs
“Pass the permission mode as a flag, for example claude --permission-mode default”
↩︎ Permission modes and auto mode“Sessions you start in a terminal honor every value except auto and bypassPermissions”
↩︎ Exam trap 1“Sessions you start in a terminal honor every value except auto and bypassPermissions”
↩︎ Prediction