Claude Code Tutorial: Install to Automation
TL;DR
- This tutorial builds a working automated dev workflow by wiring together Claude Code's four core systems on a real project.
- Step 1: create a project and a CLAUDE.md file that holds your conventions, commands, and context so Claude makes consistent decisions.
- Step 2: add a custom skill in
.claude/skills/that encodes a reusable task pattern (the example generates API endpoints). - Step 3: configure hooks in
.claude/settings.jsonto run automated checks (a type-check after writes, tests before commits); skills guide behaviour, hooks enforce it. - Step 4: add persistent memory in
.claude/memory.mdso context survives across sessions, then chain CLAUDE.md, skills, hooks, and memory together (Steps 5 and 6) with slash commands.
Learn Claude Code by building something real
This Claude Code tutorial takes you from zero to a working automated development workflow. Instead of listing features, we'll build something: a project with a configured CLAUDE.md file, a custom skill, a hook, and a memory system. By the end, you'll understand how Claude Code's key systems work together.
If you haven't installed Claude Code yet, start with our setup guide. This tutorial assumes you have Claude Code running and ready.
Step 1: Create a project and your first CLAUDE.md
Every Claude Code project starts with a CLAUDE.md file. This is the configuration file that tells Claude about your project: conventions, rules, architecture, and preferences.
Create a new project directory and add a CLAUDE.md:
mkdir my-project && cd my-project
git init
Now create your CLAUDE.md file:
# Project Context
This is a Node.js REST API using Express and TypeScript.
## Conventions
- Use TypeScript strict mode
- Error responses follow: { error: string, code: number }
- All routes go in src/routes/
- Tests use Vitest, co-located as *.test.ts files
- Prefer named exports over default exports
## Commands
- `npm run dev`: start dev server
- `npm test`: run all tests
- `npm run build`: compile TypeScript
This CLAUDE.md gives Claude Code the context it needs to make consistent decisions. Without it, Claude guesses at your conventions. With it, every suggestion follows your rules.
Start Claude Code in your project:
claude
Now try: "Create a basic Express + TypeScript project with a health check endpoint and a test for it."
Watch what happens. Claude Code reads your CLAUDE.md, creates files following your conventions (TypeScript, named exports, co-located tests, your error format), runs npm install, and executes your tests to verify everything works.
Step 2: Build a custom skill
Skills are reusable instructions that teach Claude Code how to handle specific tasks. They live in .claude/skills/ and are loaded on demand.
Create a skill for API endpoint generation:
mkdir -p .claude/skills
Create .claude/skills/api-endpoint.md:
# API Endpoint Skill
When asked to create an API endpoint, follow this pattern:
1. Create the route handler in src/routes/{resource}.ts
2. Add input validation using zod schemas
3. Add error handling with try/catch, returning { error, code }
4. Create a co-located test file src/routes/{resource}.test.ts
5. Register the route in src/routes/index.ts
6. Run tests to verify
## Route template
Every route handler should:
- Parse and validate input with zod
- Return consistent JSON responses
- Include appropriate HTTP status codes
- Log errors but don't expose internals to clients
Now when you tell Claude Code "create a users endpoint with GET and POST," it follows this skill's pattern exactly. The skill encodes your team's conventions so every endpoint is consistent.
Step 3: Set up a hook for automated checks
Hooks are rules that run automatically before or after Claude Code actions. They enforce quality gates without you remembering to ask.
Add a hook configuration to .claude/settings.json:
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit",
"command": "npx tsc --noEmit 2>&1 | head -20"
}
]
}
}
This hook runs the TypeScript compiler after every file write or edit. If Claude Code introduces a type error, the hook catches it immediately and Claude sees the error output, then fixes it before moving on.
Other practical hooks:
{
"hooks": {
"PreCommit": [
{
"command": "npm test"
}
]
}
}
This runs your tests before every commit Claude makes. If tests fail, the commit is blocked and Claude fixes the issue.
The power of hooks is that they're deterministic. Skills guide behavior; hooks enforce it. Together, they create a system where Claude Code consistently produces working, convention-following code.
Step 4: Add persistent memory
Claude Code's memory system lets it remember context across sessions. Without memory, every conversation starts fresh. With memory, Claude knows your project's history.
Create the memory structure:
mkdir -p .claude/memory
Create .claude/memory.md:
# Project Memory
## Architecture Decisions
- Chose Express over Fastify for ecosystem compatibility (2026-03-25)
- Using zod for runtime validation, not class-validator
## Known Issues
- The /users endpoint needs rate limiting before launch
- SQLite is temporary, migrating to Postgres in v2
## Patterns That Work
- Co-located tests catch bugs faster than a separate test directory
- Zod schemas double as API documentation
Claude Code reads this file at the start of every session. When you say "add rate limiting to the users endpoint," it already knows this was a known issue: no need to re-explain the context.
Update memory as your project evolves. The best memory files are living documents, not snapshots.
Step 5: Chain it all together
Now you have the four core systems working:
| System | File | Purpose |
|---|---|---|
| CLAUDE.md | CLAUDE.md |
Project conventions and context |
| Skills | .claude/skills/*.md |
Reusable task patterns |
| Hooks | .claude/settings.json |
Automated quality enforcement |
| Memory | .claude/memory.md |
Persistent context across sessions |
Try a real workflow. Tell Claude Code:
"Add a POST /posts endpoint that creates a blog post. Include validation, tests, and error handling."
Watch the cascade:
- Claude reads CLAUDE.md for conventions (TypeScript, named exports, error format)
- The API endpoint skill guides the implementation pattern (zod, co-located tests, route registration)
- After writing each file, the TypeScript hook verifies type safety
- Tests run automatically before any commit
- Memory records the decision for future sessions
This is the difference between using Claude Code as a chatbot and using it as a development system. The systems compound: each one makes the others more effective.
Step 6: Level up with slash commands
Slash commands are shortcuts for multi-step workflows. Add them to your CLAUDE.md:
## Commands
### /feature {name}
Create a new feature:
1. Create route in src/routes/{name}.ts with full CRUD
2. Add zod validation schemas
3. Create tests
4. Register routes
5. Run all tests
6. Update memory with the new feature
### /review
Review all staged changes:
1. Run `git diff --staged`
2. Check for TypeScript errors
3. Check for missing tests
4. Check for security issues (SQL injection, XSS)
5. Summarize findings
Now /feature comments scaffolds an entire feature following all your conventions. /review runs a comprehensive code review. These commands encode your workflow as repeatable procedures.
Common mistakes to avoid
Writing CLAUDE.md files that are too long. Keep them under 100 lines. Claude Code reads the entire file every turn: bloated files waste context and dilute important rules. Put detailed instructions in skills, not CLAUDE.md.
Not running tests. The biggest advantage of Claude Code over ChatGPT for coding is that it can execute and verify its own output. Always include test commands in your CLAUDE.md so Claude runs them automatically.
Ignoring memory. If you don't maintain .claude/memory.md, every session starts cold. Spend 30 seconds updating it at the end of each work session. Future-you will thank present-you.
Over-engineering skills. Skills should be concise patterns, not 500-line documents. If a skill needs that much detail, break it into multiple focused skills.
What comes next
This tutorial covered the fundamentals. To go deeper:
- Claude Code Tips: 15 techniques most developers miss
- Claude Code Skills Explained: advanced skill patterns and organization
- Claude Code Hooks: comprehensive hook reference with examples
- CLAUDE.md Explained: writing effective project configuration files
Or skip the manual configuration entirely. Claudify ships with 1,727 pre-built skills, 9 specialist agents, 21 slash commands, 9 hook configurations, and a complete memory architecture, all installed with a single command:
npx create-claudify
Everything in this tutorial, and far more, configured and production-tested out of the box.
Get Claudify: the complete Claude Code operating system, ready in one command.
More like this
Ready to upgrade your Claude Code setup?
Get Claudify