# Claude Code for coding: review, debug, hooks, memory

> Wire Engineering slash commands, CLAUDE.md memory, subagents, and a PreToolUse hook that exits 2.

Source: https://fullbytedeveloper.com/blog/claude-code-for-coding
Published here: 2026-11-26, updated 2026-11-26

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](/blog/write-agents-md-that-agents-read), [Claude Code settings load order](/blog/claude-code-settings-load-order). Browse the [Claude Code topic](https://fullbytedeveloper.com/blog/topic/claude-code).

## Install the Engineering plugin for slash workflows

```bash
claude plugin marketplace add anthropics/knowledge-work-plugins
claude plugin install engineering@knowledge-work-plugins
```

Plugins package skills, agents, hooks, and MCP servers as one unit. Engineering adds `/review`, `/debug`, `/architecture`, and `/deploy-checklist`. [6] [7]

```text
/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.0
```

You 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]

```markdown
# Commands
- Install: pnpm install
- One test: pnpm vitest run path/to/file.test.ts
- Typecheck: pnpm tsc --noEmit
```

Run `/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]

```json title=".claude/settings.json"
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-files.sh"
          }
        ]
      }
    ]
  }
}
```

```bash title=".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 0
```

Give Claude a check (tests, typecheck). Prefer hooks for rules without exceptions; leave preferences in `CLAUDE.md`. [1] [2]

## Close the coding loop before merge

1. Specific prompt or `/debug` with the failing path. [1] [6]
2. `/review` on the PR or diff. [6]
3. Tests and typecheck Claude can re-run. [1]
4. `/deploy-checklist` after green CI; person merges while hooks guard secrets. [2] [6]

For instruction files, use [Write AGENTS.md that agents read](/blog/write-agents-md-that-agents-read). For settings precedence, use [Claude Code settings load order](/blog/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.

## Sources

1. [Claude Code best practices, accessed 2026-11-26](https://code.claude.com/docs/en/best-practices)
2. [Claude Code docs: Hooks, accessed 2026-11-26](https://code.claude.com/docs/en/hooks)
3. [Claude Code hooks guide, accessed 2026-11-26](https://code.claude.com/docs/en/hooks-guide)
4. [Claude Code docs: Subagents, accessed 2026-11-26](https://code.claude.com/docs/en/sub-agents)
5. [Claude Code docs: Memory, accessed 2026-11-26](https://code.claude.com/docs/en/memory)
6. [Anthropic Engineering plugin README, accessed 2026-11-26](https://raw.githubusercontent.com/anthropics/knowledge-work-plugins/main/engineering/README.md)
7. [Claude Code docs: Plugins, accessed 2026-11-26](https://code.claude.com/docs/en/plugins)
8. [Full Byte Developer: Write AGENTS.md that agents read](https://fullbytedeveloper.com/blog/write-agents-md-that-agents-read)
9. [Full Byte Developer: Claude Code settings load order](https://fullbytedeveloper.com/blog/claude-code-settings-load-order)
