Most developers use Claude Code like a slightly smarter terminal autocomplete. They type a prompt, Claude generates code, they copy it somewhere. It works. But they're leaving 80% of the tool on the table.
Claude Code has a full extensibility stack: CLAUDE.md, slash commands, skills, hooks, subagents, MCP servers, and plugins. Each layer solves a different problem. Understanding which to reach for and when is what separates reactive usage from actually building a system.
This guide walks through every layer — from the basics to the most advanced — with concrete examples you can implement today.
1. CLAUDE.md: The One File That Changes Everything
Before touching any advanced feature, get your CLAUDE.md right.
This file is the agent's "constitution" — the primary source of truth for how your specific repository works. Every session, Claude reads it. Every session, it anchors Claude's behavior without you having to re-explain your architecture, conventions, or what commands to run.
A minimal CLAUDE.md worth having:
# Project: my-api
## Build
npm run build
## Lint
npm run lint -- --fix
## Test
npm test
## Conventions
- TypeScript strict mode
- No default exports
- Commit format: feat/fix/chore(scope): description
- Environment variables in .env.example, never hardcoded
Nested Directory Files
Claude Code also discovers nested CLAUDE.md files in subdirectories. When Claude reads files from a directory containing its own CLAUDE.md, that file gets added to context automatically.
my-project/
├── CLAUDE.md # Project-wide rules
├── src/
│ ├── db/
│ │ └── CLAUDE.md # Database-specific patterns
│ └── components/
│ └── CLAUDE.md # Component architecture guides
└── tests/
└── CLAUDE.md # Testing conventions
This keeps your main context lean until you actually need that specialized knowledge.
Golden rule: For hobby projects, let Claude maintain the CLAUDE.md. For anything you care about, own it yourself.
2. Slash Commands: Deterministic Shortcuts You Invoke
Slash commands are saved prompts you invoke with /command. Think of them as macros for your workflow.
Built-ins handle session hygiene: /clear, /compact, /context, /hooks. The interesting part is custom commands.
To create one, add a .md file under .claude/commands/:
mkdir -p .claude/commands
cat > .claude/commands/review-pr.md << 'EOF'
Fetch the PR diff for $ARGUMENTS using `gh pr diff`.
Review for: logic errors, security issues, missing error handling.
Do not comment on style or naming conventions.
Produce a structured list: Critical / Important / Minor.
EOF
Invoke it with /review-pr 142. Claude fetches the diff, runs the review, formats the output exactly as specified.
Slash commands can also orchestrate complex flows — launching parallel subagents, running research, then producing artifacts. All from a single markdown file.
The key distinction: Slash commands are user-invoked. Skills (covered next) are model-invoked — Claude autonomously uses them based on context. If you're starting fresh, use the skills format (.claude/skills/name/SKILL.md) which supports both manual (/name) and autonomous invocation.
3. Skills: Context Claude Loads Automatically
Skills are the architectural shift. Unlike commands you invoke manually, skills are model-invoked — Claude autonomously uses them based on context.
Location: .claude/skills/ for project scope, or ~/.claude/skills/ for personal scope across all projects.
Every skill is a directory with a SKILL.md file. The YAML frontmatter controls when Claude loads it:
---
name: generate-commit-messages
description: Generates clear commit messages from git diffs.
Use when writing commit messages or reviewing staged changes.
---
## Instructions
1. Run `git diff --staged` to see changes
2. Write a commit message: summary under 50 chars,
detailed description below
3. Use present tense. Explain what changed, not what you did.
The description is critical. Vague descriptions trigger false positives — Claude loads a skill that doesn't match the task and wastes context. Name the exact scenario.
A skill directory can also contain supporting scripts, reference files, and templates. The SKILL.md instructs Claude to use them. This is what makes skills genuinely powerful for complex workflows.
Context budget: Skill descriptions compete for a character budget (2% of the context window, with a fallback of 16,000 characters). If you have many skills, run /context to check for a warning about excluded skills.
4. Hooks: Deterministic Rules Claude Cannot Override
CLAUDE.md is advisory. Hooks are mandatory.
Hooks are scripts that execute automatically at specific points in Claude Code's lifecycle. Configuration lives in .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "npx prettier --write $FILE_PATH"
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "echo \"$(date): $CONVERSATION_SUMMARY\" >> ~/.claude/activity.log"
}
]
}
]
}
}
Key Lifecycle Events
| Event | When It Fires |
|---|---|
SessionStart |
When a session begins or resumes |
UserPromptSubmit |
When you submit a prompt, before Claude processes it |
PreToolUse |
Before a tool call executes. Can block it |
PostToolUse |
After a tool call succeeds |
Stop |
When Claude finishes responding |
PreCompact |
Before context compaction |
SessionEnd |
When a session terminates |
Practical Hook Strategy
Block at submit time, not at write time. Avoid hooks that block on every Edit or Write operation — let the agent finish its plan, then check the final result. Blocking mid-edit breaks Claude's reasoning chain.
Ideal hook use cases:
- Auto-formatting with Prettier or Black
- Session activity logging
- Pre-commit validation (run tests before allowing
git commit) - Desktop notifications when long tasks complete
- Blocking destructive commands (
rm -rf)
5. Subagents: Context Isolation for Complex Tasks
The pitch is simple: a complex task requires X tokens of input context, accumulates Y tokens of working context, and produces a Z token answer. Subagents farm out the work to specialized agents, which only return the final answers, keeping your main context clean.
Subagent files live in .claude/agents/ with the same YAML frontmatter pattern as skills.
The tradeoff is real. If you build a testing subagent, you've hidden all testing context from the main agent. It can no longer reason holistically about a change. Subagents are not free.
Use them when:
- You need to run parallel research branches
- A task requires sandboxed tool calls that shouldn't pollute the main session
- You want to maintain a clean main session on a long-running task
- You're doing a massive repository scan
6. MCP: Connecting Claude Code to Your External Tools
MCP (Model Context Protocol) connects Claude Code to external services — GitHub, databases, browsers, internal APIs. The server handles the integration; Claude handles the reasoning about what to do with it.
The Three Transports
# HTTP (recommended for remote servers)
claude mcp add --transport http notion https://mcp.notion.com/mcp
# Stdio (ideal for local tools)
claude mcp add --transport stdio github -- npx -y @modelcontextprotocol/server-github
# With authentication
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer your-token"
What You Can Do with MCP
- Implement features from issue trackers: "Add the feature described in JIRA ENG-4521 and create a PR on GitHub"
- Analyze monitoring data: "Check Sentry and Statsig to see the usage of the feature ENG-4521"
- Query databases: "Find emails of 10 random users who used feature ENG-4521 from our PostgreSQL database"
- Integrate designs: "Update our email template based on the new Figma designs"
- Automate workflows: "Create Gmail drafts inviting these 10 users to a feedback session"
Server Management
claude mcp list # List all servers
claude mcp get github # Server details
claude mcp remove github # Remove a server
/mcp # Status panel within Claude Code
7. Plugins: Bundled, Shareable Workflows
A plugin is a collection of slash commands, agents, skills, and hooks bundled together. A marketplace is a collection of plugins from the same source — Anthropic maintains an official one.
/plugin install name@marketplace
/reload-plugins
Before installing any community plugin: Plugins can include code in both skills and hooks. Never install and let Claude run code you haven't reviewed first. This applies especially to hooks, which execute with your credentials.
Community Ecosystem
- Claude Code Tresor: 8 autonomous skills + 8 expert agents + 4 workflow commands. Best place to start.
- Skills Library: 26+ domain-specific packages: marketing, product, project management, engineering.
- Skill Factory: Generates custom skills tailored to your specific stack.
8. Session Discipline: What Actually Matters
The tooling only works if the session stays clean.
-
Use
/clearoften. Every time you start something new, clear the chat. You don't need all that history eating your tokens. -
/compactis the middle option. It summarizes older context without discarding it entirely. Useful when you're mid-task and context is getting long. - The golden rule: Start clean, scope the task, clear between tasks.
Everything else — hooks enforcing quality gates, skills auto-loading relevant context, commands encoding your process — works better when the session itself isn't carrying dead weight from three problems ago.
The Full Stack in Action
Imagine this workflow:
-
CLAUDE.mddefines project conventions (TypeScript strict, no default exports, Vitest for testing) - A
PostToolUsehook auto-formats every edited file with Prettier - A
code-reviewerskill activates on file save and suggests security and performance improvements - A
/review-prslash command orchestrates a complete PR review usinggh pr diff - A
test-engineersubagent generates tests with isolated context without polluting the main session - A GitHub MCP server lets you create PRs, review issues, and check out branches without leaving Claude Code
- A
Stophook logs a summary of each session for future reference
Each layer solves a specific problem. The magic is in combining them.
Next Steps
You don't need to implement everything at once. Start with what gives you the highest return for the least effort:
-
Today: Create your
CLAUDE.mdwith build, lint, test commands and 3-5 key conventions - This week: Add 2-3 hooks (auto-formatting + session logging)
- This month: Create your first skill for a repetitive task in your workflow
- Once you have a stable flow: Package everything into a plugin to share with your team
The difference between using Claude Code as a glorified code assistant and having an AI-augmented development system isn't in the model — it's in how you configure it.
Ready to take your company's automation to the next level? At Guayoyo Tech, we build agentic AI solutions, enterprise integrations, and custom automations. Let's talk.

Top comments (0)