Claude Code Concepts: CLI, Hooks, Skills, and More
Loading the Text to Speech Audio Player...
Overview
Claude Code consists of several components working together:
┌─────────────────────────────────────────┐
│ Claude Code │
├─────────────────────────────────────────┤
│ CLI ──→ Main interface │
│ Hooks ──→ Behavior customization │
│ Skills ──→ Extended capabilities │
│ MCP ──→ Communication protocol │
└─────────────────────────────────────────┘
1. CLI (Command Line Interface)
What Is It?
CLI is the primary way to interact with Claude Code via Terminal.
Basic Commands
# Start a new session
claude
# Start with a specific task
claude "Add authentication system"
# Resume a previous session
claude --resume
# Non-interactive mode (for scripts)
claude -p "Fix lint errors" --no-inputIn-Session Commands
| Command | Function |
|---|---|
/help | Show help |
/clear | Clear context |
/compact | Compress conversation |
/cost | Show current cost |
/doctor | Check settings |
/init | Create CLAUDE.md |
/memory | Manage memory |
/model | Change model |
/permissions | Manage permissions |
/status | Session status |
Important Flags
# Specify model
claude --model claude-sonnet-4
# Enable deep thinking
claude --thinking
# Verbose mode
claude --verbose
# Specify working directory
claude --cwd /path/to/project2. Hooks
What Are They?
Hooks let you execute custom code at specific points in Claude Code's workflow.
Hook Types
PreToolUse ──→ Before any tool use
PostToolUse ──→ After tool succeeds
Notification ──→ When notification arrives
Stop ──→ When task finishes
Example: Hook to Prevent File Deletion
// ~/.claude/settings.json
{
"hooks": {
"PreToolUse": [
{
"matcher": "bash",
"command": "check-dangerous-commands.sh",
"timeout": 5000
}
]
}
}# check-dangerous-commands.sh
#!/bin/bash
if echo "$CLAUDE_TOOL_INPUT" | grep -q "rm -rf"; then
echo '{"decision": "block", "reason": "Dangerous deletion blocked"}'
exit 0
fi
echo '{"decision": "allow"}'Hook Use Cases
| Use Case | Hook |
|---|---|
| Log commands | PostToolUse |
| Block dangerous commands | PreToolUse |
| Send notifications | Notification |
| Cleanup after completion | Stop |
3. Skills
What Are They?
Skills are additional capabilities you add to Claude Code via SKILL.md files.
Skill Structure
skills/
└── my-skill/
├── SKILL.md # AI instructions
├── scripts/ # Helper scripts
└── templates/ # Templates
Example: API Helper Skill
# SKILL.md
---
name: api-helper
description: Helper for working with REST APIs
---
## When to Use
When the user requests creating or modifying API endpoints.
## Instructions
1. Use Express.js for backend
2. Add validation with Zod
3. Add unified error handling
4. Document endpoints in Swagger
## Templates
Use `scripts/create-endpoint.sh` to create new endpointsCommon Skills
| Skill | Function |
|---|---|
| github | Work with GitHub CLI |
| docker | Manage containers |
| testing | Write and run tests |
| deployment | Deploy applications |
| database | Database management |
4. MCP (Model Context Protocol)
What Is It?
MCP is an open protocol for connecting AI to external data sources and tools.
How It Works
┌──────────────┐ ┌─────────────┐ ┌──────────────┐
│ Claude Code │────▶│ MCP Server │────▶│ External API │
└──────────────┘ └─────────────┘ └──────────────┘
Setting Up MCP Server
// ~/.claude/settings.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_xxx"
}
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres"],
"env": {
"DATABASE_URL": "postgresql://..."
}
}
}
}Available MCP Servers
- GitHub: Manage repos, issues, PRs
- Postgres/MySQL: Database queries
- Slack: Send messages
- Google Drive: Read/write files
- Notion: Manage pages
- And more...
5. CLAUDE.md
What Is It?
A file you place in your project root to help Claude Code understand project context.
Suggested Contents
# CLAUDE.md
## About the Project
E-commerce application with Next.js and Supabase.
## Technologies
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS
- Supabase (Auth + Database)
## Structure
- `app/` - Next.js pages
- `components/` - React components
- `lib/` - utilities
- `supabase/` - migrations
## Commands
- `npm run dev` - local development
- `npm run build` - production build
- `npm test` - run tests
## Code Rules
- Use TypeScript strict mode
- Each component in separate file
- CSS with Tailwind onlyPutting It All Together
Claude Code
│
├── CLI ────────────── User interface
│
├── CLAUDE.md ──────── Project context
│
├── Hooks ─────────── Behavior customization
│ ├── PreToolUse
│ ├── PostToolUse
│ └── ...
│
├── Skills ─────────── Extended capabilities
│ ├── SKILL.md
│ └── scripts/
│
└── MCP ────────────── External connections
├── GitHub
├── Database
└── ...
What's Next?
In the next article, we'll cover:
- Practical benefits of Claude Code
- Real use cases
- When to use it and when not to
Want to read more blog posts? Check out our latest blog post on Claude Code Pricing: How It's Calculated and Which Option Is Right for You.
Discuss Your Project with Us
We're here to help with your web development needs. Schedule a call to discuss your project and how we can assist you.
Let's find the best solutions for your needs.