Claude Code for coding: review, debug, hooks, memory
Wire Engineering slash commands, CLAUDE.md memory, subagents, and a PreToolUse hook that exits 2.
Published here , updated · 9 sources · Resume reading
Coding with Claude Code works when hooks and checks define done, not when prompts get longer. Keep guidance (prompts, CLAUDE.md, skills) separate from enforcement: PreToolUse hooks that exit 2, deny rules in settings, and CI gates that Claude cannot skip. [1] [2]
After this page you can install Engineering slash workflows, keep CLAUDE.md short, delegate noisy work to subagents, and block never-rules with a PreToolUse hook that exits 2. Related: Write AGENTS.md that agents read, Claude Code settings load order. Browse the Claude Code topic.
Install the Engineering plugin for slash workflows
claude plugin marketplace add anthropics/knowledge-work-plugins
claude plugin install engineering@knowledge-work-pluginsPlugins package skills, agents, hooks, and MCP servers as one unit. Engineering adds /review, /debug, /architecture, and /deploy-checklist. [6] [7]
/review https://github.com/org/repo/pull/123
/debug checkout returns 500 after session timeout
/architecture message queue versus direct API between services
/deploy-checklist auth-service v2.3.0You should get structured review notes, a debug plan, an ADR-shaped writeup, or a deploy checklist. [6]
Keep CLAUDE.md short and loadable
Write CLAUDE.md for build commands, conventions, and decisions not in the code. Target under 200 lines. Auto memory is separate notes from corrections. Neither is enforced. [5]
# Commands
- Install: pnpm install
- One test: pnpm vitest run path/to/file.test.ts
- Typecheck: pnpm tsc --noEmitRun /context all to confirm memory loaded. Prefer /init, then cut lines Claude can rediscover. [1] [5]
Delegate noisy work to subagents
Subagents use their own context and return a summary when search or logs would flood the main chat. Built-ins include Explore and Plan (read-only). Custom agents are Markdown with YAML frontmatter under .claude/agents/ (name, description, tools, model, then the system prompt). Keep descriptions short. [4]
Enforce never-rules with PreToolUse exit 2
On PreToolUse, exit code 2 blocks the tool call; stderr is the reason. Match Edit|Write and refuse protected paths. [2] [3]
{
"hooks": {
"PreToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-files.sh"
}
]
}
]
}
}#!/bin/bash
file=$(jq -r '.tool_input.file_path // empty')
case "$file" in
*.env|*.env.*|*package-lock.json) echo "Blocked: $file" >&2; exit 2 ;;
esac
exit 0Give Claude a check (tests, typecheck). Prefer hooks for rules without exceptions; leave preferences in CLAUDE.md. [1] [2]
Close the coding loop before merge
- Specific prompt or
/debugwith the failing path. [1] [6] /reviewon the PR or diff. [6]- Tests and typecheck Claude can re-run. [1]
/deploy-checklistafter green CI; person merges while hooks guard secrets. [2] [6]
For instruction files, use Write AGENTS.md that agents read. For settings precedence, use Claude Code settings load order. [8] [9]
You now have a coding loop: Engineering commands, short memory, subagents, PreToolUse exit 2, checks before merge.
Send this to the engineer who wants Claude reviewing diffs without touching lockfiles or env files.
Keep this guide
Filed under Claude Code, Dev tools
Questions about this guide
Which Engineering plugin commands help day-to-day coding?
The README lists /review, /debug, /architecture, and /deploy-checklist. Paste a PR URL or diff for /review; describe the failure for /debug.
Is CLAUDE.md enforced like a deny rule?
No. Memory docs say CLAUDE.md and auto memory are context. Block actions with a PreToolUse hook or a permission deny rule.
What does exit code 2 mean on a PreToolUse hook?
Exit code 2 blocks the tool call. Stderr (or a JSON block reason) is returned so Claude can adjust.
Sources
- Claude Code best practices, accessed 2026-11-26code.claude.com
- Claude Code docs: Hooks, accessed 2026-11-26code.claude.com
- Claude Code hooks guide, accessed 2026-11-26code.claude.com
- Claude Code docs: Subagents, accessed 2026-11-26code.claude.com
- Claude Code docs: Memory, accessed 2026-11-26code.claude.com
- Anthropic Engineering plugin README, accessed 2026-11-26raw.githubusercontent.com
- Claude Code docs: Plugins, accessed 2026-11-26code.claude.com
- Full Byte Developer: Write AGENTS.md that agents readfullbytedeveloper.com
- Full Byte Developer: Claude Code settings load orderfullbytedeveloper.com