CertSafari
    Anthropic Claude Certified Developer – Foundations (CCDV-F)· Lessons

    Domain 3 · Lesson 10/25

    Running Claude Code: Skills, Subagents, Sessions, Headless and Auto Mode

    Claude Code Operation

    11 min read
    3.1% of exam
    6 sources
    Published 4 Oct 2026
    Docs as of 30 Sep 2026

    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.

    SKILL.md for a /summarize-changes skill; the !`...` line runs a command and puts its output into the promptmarkdown
    ---
    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?

    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.

    A custom subagent definitionmarkdown
    ---
    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.
    Where subagent definitions live, from highest to lowest priority
    LocationScopePriority
    Managed settingsOrganization-wide1 (highest)
    --agents CLI flagCurrent session2
    .claude/agents/Current project3
    ~/.claude/agents/All your projects4
    Plugin's agents/ directoryWhere plugin is enabled5 (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?

    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.

    Session commands
    CommandWhat it does
    claude --continueReopens the most recent conversation in the current directory
    claude --resumeOpens 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
    /resumeSwitches 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.

    Checkpoint 4 of 7· Exam question

    Over several months, Claude has written extensive notes into a project's auto memory, and `MEMORY.md` has grown to 340 lines while individual topic files like `debugging.md` and `api-conventions.md` remain untouched in the same directory. A new session starts in this project. What gets loaded into context automatically at session start?

    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.

    Piping a file into a headless runbash
    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-messages

    Sources4

    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.

    Requiring a human checkpoint for pushes and PRs even in auto modejson
    {
      "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?

    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?

    Sources56

    Exam traps

    Each one states something that sounds right. Open it to see what is actually true.

    1. 1.Committing defaultMode: auto in .claude/settings.json starts every teammate's terminal session in auto mode.Why is that wrong?

      Terminal sessions honor project-level defaultMode values except auto and bypassPermissions.

      Covered in Permission modes and auto mode

    2. 2.Files in .claude/commands/ stopped working once skills were introduced.Why is that wrong?

      Command files are the older format and still work. Skills are preferred for new work, and a skill wins when both have the same name.

      Covered in Skills, commands, and built-in vs custom slash commands

    Practise it for real

    Create a personal skill and call it both ways: by slash command and by plain request

    1. 1.Run mkdir -p ~/.claude/skills/summarize-changes

      Why: A personal skill is a folder under ~/.claude/skills/, so it loads in all your projects

      You should see: An empty skill directory

    2. 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 HEAD line puts the diff into the prompt

      You should see: ~/.claude/skills/summarize-changes/SKILL.md exists

    3. 3.In a git repo with uncommitted edits, type /summarize-changes

      Why: The folder name becomes the custom slash command

      You should see: Two or three bullet points summarizing the diff, followed by any risks

    4. 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

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “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. 2.
      “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. 3.
      “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. 4.
      “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. 5.
      “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. 6.
      “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

    Ready to test yourself?

    Practise the 20 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.