a
Teaching Aid · Scenario 02

Claude Code
Dev Workflow

Learn how to configure Claude Code for your team, write powerful CLAUDE.md files, build custom slash commands, and know when to use plan mode vs. direct execution.

Claude Code CLAUDE.md Slash Commands Plan Mode Context Management MCP Integration
Primary Use CasesGen · Refactor · Debug · Docs
Config FilesCLAUDE.md + .claude/
Plan Mode TriggerShift + Tab
Clear Context/clear often
Scope HierarchyGlobal → Project → Session
01

Core Concepts — What Makes Claude Code Different

Concept 01
🗂

CLAUDE.md — Persistent Memory

Claude Code reads CLAUDE.md at the start of every session. It's how you give Claude project context without repeating it in every prompt. Hierarchy: Global (~/.claude/CLAUDE.md) → Project root (./CLAUDE.md) → Subdirectory.

Concept 02

Slash Commands — Reusable Prompts

Custom slash commands are markdown files in .claude/commands/ (project) or ~/.claude/commands/ (personal). They become /command-name shortcuts that any team member can invoke — no copy-pasting prompts.

Concept 03
🧭

Plan Mode — Think Before Acting

Hit Shift+Tab to enter plan mode. Claude analyzes requirements and proposes a step-by-step plan before writing a single line of code. Essential for complex features, migrations, and refactors.

Concept 04
🪣

Context Window — Use It Wisely

Every file reference, tool call, and message consumes context. Use /clear when switching tasks. Use /compact to summarize a long session. Use @file to add specific files rather than letting Claude scan everything.

Concept 05
🔌

MCP Servers — External Tool Access

Configure MCP servers in your settings to give Claude Code access to databases, GitHub, browser automation, Sentry, and more. Claude Code can act as both MCP client and server simultaneously.

Concept 06
🪝

Hooks — Automated Quality Gates

Hooks run shell commands automatically on events like PostToolUse. Run black after every Python file write, or tsc after TypeScript edits. Enforces standards without manual reminders.

02

CLAUDE.md — Interactive Builder

Toggle sections on the left to see how they compose into a real CLAUDE.md file. A well-configured CLAUDE.md saves tokens on every session by eliminating repetitive context-setting.

CLAUDE.md Sections
Project Context
📋 Project Overview
Workflow
🔧 Build & Test Commands
Quality
📐 Coding Standards
Architecture
🏗 Architecture Notes
Guard Rails
🚫 Do-Not-Do Rules
Integrations
🔌 MCP Tool Usage
📄 CLAUDE.md — live preview
# Acme API — Claude Context This is a Node.js + TypeScript REST API using Express. PostgreSQL database, managed with Prisma ORM. Authentication uses JWT tokens via Passport.js. ## Build & Test Commands `npm run dev` — start dev server with hot reload `npm test` — run Jest test suite `npm run build` — compile TypeScript to dist/ `npm run lint` — ESLint with --fix `npx prisma migrate dev` — apply DB migrations
💡 Hierarchy tip: Put universal standards in ~/.claude/CLAUDE.md (applies to all projects). Put project-specific context in ./CLAUDE.md at repo root. Claude merges both automatically.
03

Slash Commands — Click to Explore

Commands live as .md files in .claude/commands/ (project-scoped) or ~/.claude/commands/ (personal). They support frontmatter for tool permissions, model selection, and dynamic arguments via $ARGUMENTS. Skills in .claude/skills/ work similarly but can be auto-invoked by Claude.

/reviewprojectFull code review with checklist
File: .claude/commands/review.md
--- allowed-tools: Read, Grep, Glob, Bash(git diff:*) description: Comprehensive code review --- ## Changed Files !`git diff --name-only HEAD~1` ## Detailed Changes !`git diff HEAD~1` ## Review Checklist Review the above changes for: 1. Code quality and readability 2. Security vulnerabilities 3. Performance implications 4. Test coverage gaps 5. Documentation completeness Provide specific, actionable feedback by priority.
💡 The ! prefix before backtick commands injects live bash output into the prompt at invocation time.
/fix-issueprojectFix a GitHub issue end-to-end
File: .claude/commands/fix-issue.md
--- allowed-tools: Read, Write, Bash(gh *), Bash(git *) description: Analyze and fix a GitHub issue --- Fix GitHub issue #$ARGUMENTS: 1. Run `gh issue view $ARGUMENTS` to get full details 2. Search the codebase for relevant files 3. Implement the fix following our coding standards 4. Write or update tests covering the fix 5. Create a descriptive commit message 6. Open a PR referencing the issue
💡 $ARGUMENTS is replaced at runtime with whatever you type after /fix-issue — e.g. `/fix-issue 142` passes "142" as the argument.
/securityprojectSecurity vulnerability scan
File: .claude/commands/security.md
--- allowed-tools: Read, Grep, Glob model: claude-opus-4-6 description: Run security vulnerability scan --- Analyze the codebase for security vulnerabilities: - SQL injection risks - XSS vulnerabilities - Exposed credentials or secrets - Insecure direct object references - Missing input validation - Insecure dependencies (check package.json) Report findings by severity: CRITICAL / HIGH / MEDIUM / LOW
💡 You can pin specific models per command using the model: frontmatter key. Use Opus for security analysis, Sonnet for boilerplate.
/docspersonalGenerate docs for selected code
File: ~/.claude/commands/docs.md
--- allowed-tools: Read, Write description: Write documentation for the provided code --- Write comprehensive documentation for: $ARGUMENTS Include: - Purpose and what problem it solves - Parameter descriptions with types - Return value and possible errors - Usage example with realistic values - Any gotchas or edge cases Format as JSDoc/TSDoc comments in-place.
💡 Personal commands in ~/.claude/commands/ work across ALL your projects — great for general utilities you use everywhere.
/commitprojectSmart git commit with context
File: .claude/commands/commit.md
--- allowed-tools: Bash(git add:*), Bash(git status:*), Bash(git commit:*), Bash(git diff:*) description: Create a well-structured git commit --- Create a git commit for the current changes. Context: - Status: !`git status` - Diff: !`git diff HEAD` - Branch: !`git branch --show-current` Write a commit message following Conventional Commits: - feat: new feature - fix: bug fix - refactor: code restructure - docs: documentation - test: tests Stage and commit only the relevant files.
💡 Live bash injection (! prefix) means the command always uses real-time git state, not stale context.
04

Plan Mode vs. Direct Execution

The single most impactful habit you can build. Use Shift + Tab to trigger plan mode. Claude reads your codebase, proposes a full plan, and waits for your approval before touching anything.

🧭 Plan Mode First
🔵Feature spans multiple files or services
🔵Architecture decisions are involved (new DB table, API design)
🔵Touching legacy code you don't fully understand
🔵Migration or refactor that could break things
🔵You want to verify Claude's approach before it writes anything
Example prompts
"Add OAuth2 to our API"
"Migrate from REST to GraphQL"
"Refactor auth to use JWT"
"Add rate limiting middleware"
⚡ Direct Execution
🟢Fix is small and contained (single function, single file)
🟢You have a clear, unambiguous spec for what you want
🟢Generating boilerplate (tests, CRUD routes, types)
🟢Debugging a specific error with full stack trace provided
🟢Writing documentation for existing, understood code
Example prompts
"Fix this TypeError on line 42"
"Write tests for UserService"
"Add JSDoc to this function"
"Convert this class to a hook"
🔑 Rule of thumb: If you can describe exactly what you want in one sentence with no ambiguity, execute directly. If you'd need a paragraph to explain the task, use plan mode. The planning phase dramatically reduces wasted tokens from Claude going down the wrong path.
05

Context Window Simulator

Context is your most limited resource. Each scenario below shows what's consuming your context window and what you should do about it. Click a scenario to see the breakdown.

Scenario:
Fresh Session — Optimal12% used
CLAUDE.md (global)3%
CLAUDE.md (project)5%
Current message2%
Available90%
✅ Ideal. Claude has project context from CLAUDE.md, you have 90% of the window for actual work. Start with your task.
06

Recommended Team Workflow

A reproducible, token-efficient workflow for integrating Claude Code into a real engineering team. Each step builds on the last.

1
Bootstrap the project context

Run /init in a new project. Claude scans the codebase and generates a starting CLAUDE.md. Review and refine it — add your team's coding standards, the build commands, and any architecture conventions. Commit this to the repo so every team member benefits.

/init → review → git commit CLAUDE.md
2
Set up project slash commands

Identify your 3–5 most repeated workflows: code review, security scan, test generation, PR description writing. Create .md files in .claude/commands/ for each. These become team-wide standards. Use $ARGUMENTS for dynamic inputs and frontmatter to set allowed-tools.

mkdir -p .claude/commands && vim .claude/commands/review.md
3
Configure hooks for quality gates

Add PostToolUse hooks to your .claude/settings.json. Auto-run your linter on file edits, run type checks after TypeScript changes, format with Prettier after any write. This means Claude's output is always linted — no manual fixes needed.

PostToolUse → "Write(*.py)" → black $file
4
Start each task with a clean context

Use /clear at the start of every new feature or bug fix. Don't carry over conversation history from a different task — it wastes tokens and confuses Claude. Add specific files with @filename rather than letting Claude scan everything.

/clear → @src/auth/service.ts → describe the bug
5
Plan complex work, execute simple work

For new features and refactors, use plan mode (Shift+Tab). Review the plan, ask Claude to adjust it, then approve. For bug fixes and boilerplate, just execute directly.

Shift+Tab → review plan → approve → execute
6
Compact when context gets full

When you see a context warning from /context, run /compact. This summarizes the session into a compact representation, freeing up space without losing the work done so far. Then continue from where you left off.

/context → (warning) → /compact → continue
07

Quick Reference Cheat Sheet

Built-in Commands
/initGenerate CLAUDE.md from codebase
/clearReset context window entirely
/compactSummarize session to save tokens
/contextView context window usage
/modelSwitch between Opus / Sonnet
/helpList all available commands
Shift+TabEnter plan mode
File Locations
~/.claude/CLAUDE.mdGlobal context (all projects)
./CLAUDE.mdProject context (this repo)
~/.claude/commands/Personal slash commands
.claude/commands/Project slash commands
.claude/skills/Skills (auto-invoked)
.claude/settings.jsonHooks, permissions, model
Tips & Patterns
@filenameAdd specific file to context
$ARGUMENTSDynamic input in commands
allowed-tools:Restrict tools in frontmatter
"think hard"Trigger extended reasoning
/clear oftenNew task = new context
2% budgetMax chars for skill descriptions
08

Knowledge Check