We earn commissions when you shop through the links below.
If you’ve spent any time with Claude Code, you already know it’s a genuinely capable AI coding assistant. But the real power unlock comes when you understand how to build custom skills for Claude Code — turning a general-purpose tool into something that knows your stack, your conventions, and your team’s specific workflows. In this guide, I’ll walk you through the three main extension points: custom slash commands, project-level instructions, and MCP (Model Context Protocol) tool servers.
What “Skills” Actually Means in Claude Code
Claude Code doesn’t use the word “skills” officially, but the concept maps cleanly onto three things you can build:
- Custom slash commands — reusable prompt templates you trigger with
/command-name - Project memory and instructions — persistent context that shapes every interaction in a project
- MCP tool servers — external programs Claude Code can call to fetch data, run scripts, or interact with APIs
Together these three mechanisms let you build remarkably specialized behavior without touching any Anthropic internals.
Custom Slash Commands
Slash commands are the quickest win. Claude Code looks for Markdown files inside .claude/commands/ in your project root (or ~/.claude/commands/ for global commands). Each file becomes a slash command named after the filename.
Here’s a real example. Say you work on a Laravel API and you’re constantly asking Claude to generate feature tests. Create this file:
# .claude/commands/feature-test.md
Generate a Laravel feature test for the following scenario.
Rules:
- Use `RefreshDatabase` trait
- Use factories for all model creation
- Assert both the HTTP response status and the database state
- Group assertions with comments like `// Assert response` and `// Assert database`
- Name the test method descriptively using snake_case
Scenario: $ARGUMENTS
Now inside any Claude Code session you just type:
/feature-test a user can purchase a subscription and receive a confirmation email
Claude substitutes $ARGUMENTS with your input and generates a fully structured test following your team’s conventions. This is how to build custom skills for Claude Code in under two minutes — no tooling required, just a Markdown file.
Useful Patterns for Slash Commands
- Code review checklist — a command that walks through security, performance, and style concerns for a given file
- PR description generator — takes a diff summary and formats it into your team’s PR template
- Migration planner — given a schema change, outputs migration + rollback + affected queries
- Commit message writer — formats commits to Conventional Commits spec with scope and body
Keep each command file focused. One purpose per file, with explicit rules rather than vague instructions.
Project Memory with CLAUDE.md
Before Claude Code starts any task in your project, it reads CLAUDE.md from the project root. This is your always-on context — tech stack, coding style, file structure, team conventions, things Claude should never do.
# CLAUDE.md
## Stack
- Backend: Laravel 11, PHP 8.3
- Frontend: React 19 with TypeScript, Tailwind CSS 4
- Database: PostgreSQL 16
- Queue: Laravel Horizon with Redis
- Deployment: Railway
## Conventions
- All API responses use a shared `ApiResponse` class with `data`, `message`, and `meta` keys
- Never use `dd()` or `var_dump()` in any file
- Controllers stay thin — business logic lives in Action classes under `app/Actions/`
- Always write Pest tests, never PHPUnit syntax
- Enum-backed types for all status fields
## File Structure Notes
- Feature flags live in `app/Features/`
- DTOs are in `app/Data/` using Spatie Laravel Data
- All jobs implement `ShouldBeUnique`
## Do Not
- Do not suggest installing new packages without asking first
- Do not modify migration files that have already been committed
This single file eliminates an enormous amount of repetitive prompting. Claude stops suggesting solutions that don’t fit your stack and starts defaulting to your patterns automatically.
MCP Tool Servers: Real Custom Skills
This is where things get serious. MCP (Model Context Protocol) lets you expose arbitrary tools — functions Claude Code can call like it calls shell commands or reads files. You write a small server in any language, register it in your Claude Code config, and suddenly Claude can query your internal API, check a feature flag system, search your documentation, or run a custom linter.
Here’s a minimal Node.js MCP server that lets Claude query a local PostgreSQL database schema:
// mcp-schema-server.js
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
import pg from "pg";
const client = new pg.Client({ connectionString: process.env.DATABASE_URL });
await client.connect();
const server = new Server(
{ name: "schema-server", version: "1.0.0" },
{ capabilities: { tools: {} } }
);
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [
{
name: "get_table_schema",
description: "Returns columns, types, and constraints for a given table",
inputSchema: {
type: "object",
properties: {
table_name: { type: "string", description: "The table to inspect" }
},
required: ["table_name"]
}
}
]
}));
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === "get_table_schema") {
const { table_name } = request.params.arguments;
const result = await client.query(
`SELECT column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_name = $1
ORDER BY ordinal_position`,
[table_name]
);
return {
content: [{ type: "text", text: JSON.stringify(result.rows, null, 2) }]
};
}
throw new Error("Unknown tool");
});
const transport = new StdioServerTransport();
await server.connect(transport);
Register it in ~/.claude/claude_desktop_config.json (or the Claude Code equivalent config):
{
"mcpServers": {
"schema-server": {
"command": "node",
"args": ["/path/to/mcp-schema-server.js"],
"env": {
"DATABASE_URL": "postgresql://localhost:5432/myapp_dev"
}
}
}
}
Now when you say “add a column to the orders table for tracking refund status”, Claude can call get_table_schema first, see the actual current schema, and generate a migration that fits reality — not a hallucinated version of your table structure.
If you want to deploy your MCP server so it’s always available across machines, Railway makes it trivial to host a small Node.js or Python service with environment variable management and automatic deploys from Git.
Combining All Three
The real answer to how to build custom skills for Claude Code isn’t picking one mechanism — it’s layering them. Here’s how a mature setup looks:
- CLAUDE.md sets the baseline: stack, conventions, non-negotiables
- Slash commands handle repeatable workflows: test generation, PR descriptions, code reviews
- MCP servers give Claude live access to systems: your database, internal APIs, documentation search, CI status
With this combination, Claude Code stops feeling like a smart autocomplete and starts feeling like a junior developer who actually understands your codebase.
Tips From Building This in Practice
Start with CLAUDE.md, not MCP. Most teams get 80% of the value from good project instructions. Build MCP servers only when Claude is making decisions based on stale or incorrect information about your systems.
Version control everything. Commit your .claude/commands/ directory and CLAUDE.md to the repo. The whole team benefits instantly, and you can review changes to AI instructions the same way you review code changes.
Name commands for the outcome, not the action. /feature-test is better than /generate. /security-review is better than /review. Specificity makes the commands memorable and self-documenting.
Keep MCP tools narrow. Each tool should do exactly one thing. A tool that returns table schema is more reliable than a tool that “helps with database stuff”. Claude is good at combining narrow tools — let it.
If you’re newer to AI-assisted development and want a structured path to getting productive fast, Udemy has solid courses on prompt engineering and AI coding workflows that complement what you’re building here.
What You Can Build Next
Once you understand how to build custom skills for Claude Code, the possibilities expand quickly. Some directions worth exploring:
- An MCP server that queries your error tracking tool (Sentry, Bugsnag) so Claude can see real production errors while helping debug
- A slash command that generates a full CRUD module — model, migration, controller, form request, resource, and tests — from a single description
- An MCP server wrapping your internal API documentation so Claude always references the actual current contract
- Project-specific review commands that check against your actual architecture decisions, not generic best practices
The barrier to entry is genuinely low. A useful slash command takes five minutes. A useful MCP server takes an afternoon. And the compounding value — every developer on your team getting a Claude that understands your specific system — is substantial.
Start with one command that solves a task you personally repeat every day. Ship it to your team. Iterate from there.