Claude Code¶
31 cards — 🟢 9 easy | 🟡 11 medium | 🔴 5 hard
🟢 Easy (9)¶
1. What is Claude Code and how does it differ from browser-based AI tools?
Show answer
Claude Code is Anthropic's terminal-native AI agent that runs in your shell with direct access to your filesystem, git history, and CLI tools. Unlike browser-based AI, it can read and edit your files, run commands, and interact with your infrastructure directly — no copy-pasting required.Remember: Claude Code = Anthropic's AI coding assistant CLI. Works in your terminal, understands your codebase, and helps write, debug, and refactor code.
2. What is CLAUDE.md and what is it used for?
Show answer
CLAUDE.md is a project context file that Claude Code reads automatically on startup. It contains project conventions, stack details, validation commands, and behavioral rules (like files not to modify). It supports a hierarchy: global (~/) > project root (./) > subdirectory, with more specific files overriding general ones.Remember: Claude Code = Anthropic's AI coding assistant CLI. Works in your terminal, understands your codebase, and helps write, debug, and refactor code.
3. How do you create a custom slash command in Claude Code?
Show answer
Create a markdown file in .claude/commands/ directory. The filename (minus .md) becomes the command name. Use $ARGUMENTS as a placeholder for user input. Example: .claude/commands/deploy-check.md becomes /deploy-check. Team-shared commands go in the repo's .claude/commands/; personal commands go in ~/.claude/commands/.Remember: slash commands (/commit, /review-pr) invoke built-in skills. They're shortcuts for common workflows that Claude Code handles end-to-end.
4. What does the /compact command do and when should you use it?
Show answer
/compact compresses the conversation to save context window space. Use it at milestones during long debugging sessions — when the context fills up, Claude Code starts forgetting earlier conversation including your constraints and instructions. It keeps key context while dropping noise.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
5. What are the available models in Claude Code and when should you use each?
Show answer
Opus: complex multi-file refactors, architecture decisions, deep debugging. Sonnet: day-to-day coding, quick fixes, file exploration. Haiku: fast lookups, simple questions, bulk operations. Switch with /model or --model flag.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
6. How does the Claude Code memory system work?
Show answer
Claude Code can persist information across sessions using memory files stored in ~/.claude/projects/Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
7. What built-in slash commands are available in Claude Code?
Show answer
Key built-in commands: /help (usage), /clear (reset context), /compact (compress conversation), /model (switch model), /cost (token usage), /permissions (manage tool access), /memory (view memories), /config (edit settings), /review (review changes), /fast (toggle fast mode), /vim (vim keybindings).Remember: slash commands (/commit, /review-pr) invoke built-in skills. They're shortcuts for common workflows that Claude Code handles end-to-end.
8. What are the main built-in tools Claude Code uses to interact with your system?
Show answer
Read (read files), Edit (targeted edits), Write (create/rewrite files), Bash (run commands), Glob (find files by pattern), Grep (search file contents), Agent (spawn sub-agents), TodoWrite (track task progress), WebFetch (fetch URLs), and WebSearch (search the web).Remember: Claude Code asks permission before modifying files or running commands. Review changes before approving. Trust but verify.
9. What is the best way to get high-quality suggestions from Claude Code?
Show answer
Let it read first. "Read the Helm chart and then suggest improvements" produces better results than "improve the Helm chart." Also: start with context about what you're doing (debugging vs learning), be specific in requests, and use /compact aggressively during long sessions to keep the context window fresh.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
🟡 Medium (11)¶
1. What are the three permission modes in Claude Code and when should you use each?
Show answer
Default mode asks before file edits and commands. Auto-accept edits mode allows file reads/writes but still asks for commands. YOLO mode auto-approves everything and should only be used for safe, isolated work — never on production infrastructure or shared systems.Remember: Claude Code asks permission before modifying files or running commands. Review changes before approving. Trust but verify.
2. What are MCP servers in Claude Code and how are they configured?
Show answer
MCP (Model Context Protocol) servers extend Claude Code with external integrations like databases, APIs, and internal tools. They are configured in .claude/settings.json under the mcpServers key, specifying a command, args, and environment variables. Use ${VAR} syntax for secrets — never hardcode credentials.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
3. What are Claude Code hooks and what events can they respond to?
Show answer
Hooks are shell commands that run automatically in response to Claude Code events. Events include: pre-tool-use (runs before and can block a tool), post-tool-use (runs after a tool), notification (for alerts), and on-session-start. Use cases include auto-linting after edits, blocking destructive commands, and sending Slack notifications.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
4. How can you use Claude Code in a CI pipeline or non-interactive mode?
Show answer
Use the -p flag for non-interactive (pipe-friendly) mode: claude -p "review this diff" < diff.txt. Combine with --output-format json for machine-readable output. Useful for automated code review, changelog generation, and migration scripts in CI/CD pipelines like GitHub Actions.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
5. How does Claude Code help with exploring an unfamiliar codebase?
Show answer
Claude Code reads your files directly, so you can ask questions like "How does the deploy pipeline work?" and it will read CI workflows, Helm charts, deploy scripts, and Dockerfiles to give you a narrative walkthrough with specific file references. Follow up with targeted questions about specific components.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
6. How can Claude Code assist with debugging Kubernetes OOMKilled pods?
Show answer
Claude Code runs kubectl commands in your context: gets pod status, describes the OOMKilled pod, runs kubectl top for resource usage, checks resource limits in the pod spec, reads your Helm values for resource configuration, suggests the fix (e.g., bump memory limits), and validates with helm lint — all without copy-pasting.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
7. What is the "overconfident commit" footgun and how do you prevent it?
Show answer
Claude Code can commit and push directly, including adding all files with git add -A (catching debug files, temp fixtures, IDE config). Prevent it by specifying target branches, requiring tests before commits, and adding git rules to CLAUDE.md: never push to main, always run make test, use feature branches.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
8. What happens when Claude Code's context window fills up during long sessions?
Show answer
Claude Code starts forgetting earlier conversation including your constraints and CLAUDE.md instructions. Signs: repeating failed approaches, losing track of modified files, ignoring instructions it followed earlier. Fix: use /compact at milestones, break long tasks into separate sessions, and watch the context usage indicator.Gotcha: Claude Code has a context window limit. Keep prompts focused and provide relevant code snippets rather than entire files when possible.
9. What makes an effective CLAUDE.md file?
Show answer
Include: stack and framework versions, validation/test commands (make test, ruff check), files that should not be modified (protected paths), naming conventions, commit message style, and a "Do NOT" section. Keep it concise — it's loaded every session and uses context window. Treat it like production config and keep it current.Remember: CLAUDE.md files provide repo-specific instructions. Precedence: direct user instruction > subtree CLAUDE.md > repo CLAUDE.md > workspace CLAUDE.md.
10. How can MCP server configurations lead to credential leaks?
Show answer
MCP configs in .claude/settings.json may contain database passwords or API tokens. If hardcoded and committed to git, secrets end up in repo history. Fix: use environment variable references (${DATABASE_URL}) instead of literal values, and add .claude/settings.local.json to .gitignore for per-developer secrets.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
11. How can Claude Code help with Terraform state splitting?
Show answer
Claude Code reads your main.tf, identifies networking resources (VPC, subnets, NAT gateways, route tables), creates a new module directory, generates terraform state mv commands, creates a migration script with rollback steps, and runs terraform fmt and terraform validate to verify. It handles the mechanical parts while you review the plan.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
🔴 Hard (5)¶
1. How do you configure targeted tool permissions instead of using YOLO mode?
Show answer
Use claude config set allowedTools with an array of tool patterns. Examples: '["Bash(kubectl get *)", "Bash(kubectl describe *)"]' for read-only kubectl, '["Bash(make *)", "Edit", "Write"]' for build and edit permissions. This is safer than YOLO mode because it limits blast radius to approved operations.Remember: Claude Code asks permission before modifying files or running commands. Review changes before approving. Trust but verify.
2. What are Claude Code sub-agents and when should you use them?
Show answer
Sub-agents (Agent tool) are spawned to handle parallel tasks autonomously. Use them for bulk operations like checking multiple services for vulnerabilities, processing endpoint files in parallel, or research that produces large output. The sub-agent's full output stays in its own context — only the summary returns to the main session, preserving your context window.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
3. Why is YOLO mode dangerous for infrastructure work and what should you use instead?
Show answer
YOLO mode auto-approves all commands including terraform apply, kubectl delete, and rm -rf. One bad inference can destroy resources. Instead, use targeted permissions with allowedTools patterns that grant read-only access to production tools. Example: allow "kubectl get *" and "kubectl describe *" but not "kubectl delete *".Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
4. How would you set up Claude Code for automated PR review in a CI pipeline?
Show answer
Use claude -p in a GitHub Actions step: pipe the PR diff into Claude Code with a review prompt. Example: claude -p "review this PR for security issues, missing error handling, and test coverage gaps" < <(git diff main). Use --output-format json for structured results that can be posted as PR comments via gh api.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.
5. What is the "multi-surface blast radius" footgun and how do you mitigate it?
Show answer
Claude Code can edit files across your entire repo in one pass. A broad request like "update the API version everywhere" might touch app code, Terraform, Helm charts, CI pipelines, and docs simultaneously. One wrong pattern match breaks multiple systems. Fix: scope requests to specific surfaces ("update the API version in Helm values only") and ask for the plan before executing.Remember: Claude Code understands your project through CLAUDE.md files, directory structure, and code context. Well-documented repos get better assistance.