Beyond Basic Prompts: Set Up CLAUDE.md, Hooks, and MCP Integrations for a Bulletproof Claude Code Workflow
If you’ve been using Claude Code by typing requests into the terminal and hoping for the best, you’re getting maybe 20% of what it can do. The real power lives in three features that most developers overlook: a well-crafted CLAUDE.md file, deterministic shell hooks, and Model Context Protocol (MCP) integrations. Together, they transform Claude Code from a smart autocomplete into a fully automated, standards-enforcing development partner.
This tutorial walks you through each layer — with real examples you can copy, adapt, and ship today.
1. Why “Just Prompting” Leaves 80% of the Power on the Table
Prompts are ephemeral. Every new session, Claude Code starts without memory of your stack, your team’s conventions, or the architectural decisions you made last sprint. You end up repeating yourself constantly: “Use TypeScript strict mode,” “Don’t use any,” “We prefer zod for validation.”
Worse, ad-hoc prompting is non-deterministic. Two developers on the same project can get wildly different output because their prompts differ by a few words. That’s not a workflow — that’s chaos with a chat interface.
The fix is to move your intent out of prompts and into configuration.
2. Crafting Your CLAUDE.md: The Project Brain
A CLAUDE.md file lives at the root of your repository and is automatically loaded by Claude Code at the start of every session. Think of it as a standing brief — everything Claude needs to know about your project, written once.
What to Include
- Coding standards: language version, linting rules, formatting preferences
- Preferred libraries:
zodoveryup,pnpmovernpm,VitestoverJest - Architecture decisions: monorepo structure, API conventions, file naming patterns
- Review checklists: security considerations, accessibility requirements, PR scope limits
- Off-limits patterns: things Claude should never do (e.g.,
eval(), hardcoded secrets, skipping error handling)
A Real-World Template
# Project: Acme API
## Stack
- Runtime: Node.js 22, TypeScript 5.4 (strict mode, no `any`)
- Framework: Fastify 4
- Validation: zod
- Testing: Vitest + Supertest
- Package manager: pnpm
## Architecture
- All routes live in `src/routes/`, one file per resource
- Business logic goes in `src/services/`, never in route handlers
- Database access only through `src/db/` — no raw SQL elsewhere
## Code Standards
- Functions must have explicit return types
- All async functions must handle errors with try/catch or `.catch()`
- No `console.log` in production code — use the `logger` utility
## Review Checklist
- [ ] Input validated with zod at the route boundary
- [ ] No secrets or tokens hardcoded
- [ ] New endpoints have at least one integration test
- [ ] Breaking changes noted in CHANGELOG.md
This file is version-controlled, team-shared, and session-persistent. Every Claude Code interaction on this repo now starts with full project context — no repeated instructions required.
3. Writing Hooks: From Advisory to Deterministic
Instructions in CLAUDE.md are advisory — Claude will try to follow them. Hooks are deterministic — they execute shell commands automatically at defined points in Claude Code’s action lifecycle, regardless of what was prompted.
Key Hook Moments
- PreToolUse: runs before Claude takes an action (e.g., before writing a file)
- PostToolUse: runs after an action completes (e.g., after saving a file)
- Stop: runs when Claude finishes a task
Example: Auto-Format on Save
In your settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{ "type": "command", "command": "pnpm prettier --write $CLAUDE_FILE_PATH" }
]
}
]
}
}
Every time Claude writes or edits a file, Prettier runs automatically. No reminder needed.
Example: Lint + Security Scan on Stop
{
"hooks": {
"Stop": [
{
"hooks": [
{ "type": "command", "command": "pnpm eslint src/ --max-warnings 0" },
{ "type": "command", "command": "pnpm audit --audit-level=high" }
]
}
]
}
}
When Claude finishes a task, ESLint and npm audit run automatically. If either exits with an error, the output is surfaced back to Claude — which can then self-correct before you ever see the result.
Hooks turn your standards from suggestions into guardrails.
4. MCP Integrations: Connecting Claude Code to Your Entire Toolchain
The Model Context Protocol (MCP) lets Claude Code communicate with external services as if they were native tools. Instead of copy-pasting a Jira ticket into your terminal, Claude can fetch it directly. Instead of manually updating a Slack channel, Claude can post the update itself.
Common MCP Integrations
| Tool | What Claude Can Do |
|---|---|
| **Jira** | Read ticket details, update status, add comments |
| **Google Drive** | Fetch spec docs, PRDs, design notes |
| **Slack** | Post deployment summaries, PR links, alerts |
| **Custom DB** | Query internal data to inform code generation |
Adding an MCP Server
MCP servers are configured in settings.json under "mcpServers":
{
"mcpServers": {
"jira": {
"command": "npx",
"args": ["-y", "@your-org/mcp-jira"],
"env": {
"JIRA_BASE_URL": "https://acme.atlassian.net",
"JIRA_TOKEN": "${JIRA_TOKEN}"
}
}
}
}
Once registered, you can prompt Claude: “Pull the details from ACME-412 and implement the feature.” Claude fetches the ticket, reads the acceptance criteria, and starts coding — all in one command.
5. Putting It All Together: The Fully Automated Development Loop
Here’s what a project setup looks like with all three layers active:
On session start, Claude loads CLAUDE.md and knows your entire stack, conventions, and review checklist.
During coding, PostToolUse hooks auto-format every file Claude touches with Prettier.
When a task finishes, Stop hooks run ESLint and a security audit — and Claude sees the results, self-corrects, and only surfaces clean output.
For feature work, Claude pulls the Jira ticket via MCP, implements the feature, then posts a summary to your team’s Slack channel — without you leaving the terminal.
The result is a development loop that is:
- ✅ Consistent — same standards enforced for every developer, every session
- ✅ Automated — formatting, linting, and security checks happen without manual triggers
- ✅ Context-aware — Claude always has the full picture from your project config and connected tools
Start Small, Then Expand
You don’t have to implement all three layers at once. Start with a CLAUDE.md this week — it takes 20 minutes and pays dividends immediately. Add one formatting hook next. Then explore MCP when you find yourself copy-pasting context between tools.
Each layer compounds on the last. By the time all three are in place, you won’t just be using Claude Code — you’ll have built a development environment that works for you, automatically, every single time.