codingBy HowDoIUseAI Team

How to train Claude Code agents with custom skills (the game-changing method)

Learn the new approach to agent training with custom Claude Code skills that's transforming how developers build AI agents. No complex setup required.

Building AI agents has traditionally meant either wrestling with complex frameworks or spending hours on trial-and-error prompting. But that's changing fast. Claude Code enables Agent Skills, which are modular capabilities consisting of instructions, scripts, and resources that extend Claude's functionality.

This approach to agent training is so practical that within six months, most developers will be using skills to create specialized AI assistants instead of manually crafting prompts for every task. Here's what you need to know about this shift and how to get started.

What makes Claude Code skills different from regular prompts?

Skills teach Claude how to do something. A Project might contain all the background on your product launch, while a skill could teach Claude your team's writing standards or code review process.

Think of skills as training manuals for your AI agent. Unlike one-time prompts that you write for specific conversations, skills are reusable packages that include:

  • Step-by-step instructions that Claude follows automatically
  • Python scripts and tools that extend what Claude can do
  • Templates and reference materials for consistent output
  • Smart loading - Claude only loads skills when they're relevant

Skills use progressive disclosure: metadata loads first (~100 tokens), providing just enough information for Claude to know when a Skill is relevant. Skills use progressive disclosure to keep Claude efficient. When working on tasks, Claude first scans Skill metadata (descriptions and summaries) to identify relevant matches. If a Skill matches, Claude loads the full instructions.

This means you can have dozens of specialized skills available without overwhelming Claude's context window. It only uses what it needs, when it needs it.

How do you create your first custom skill?

Getting started with Claude Code is straightforward. You'll need a Claude subscription and access to a terminal.

First, install Claude Code using npm (Node.js Package Manager), so you'll need to have Node.js (version 18 or newer) on your machine first. The command itself is just one line: npm install -g @anthropic-ai/claude-code. Once that's done, you just navigate to your project folder in the terminal and type claude.

Here's how to create a simple skill:

  1. Create the skill directory structure

    mkdir ~/.claude/skills/code-reviewer
    cd ~/.claude/skills/code-reviewer
    touch SKILL.md
    
  2. Write your SKILL.md file Every skill needs a YAML frontmatter (between --- markers) that tells Claude when to use the skill, and markdown content with instructions Claude follows when the skill is invoked. The description should include both what the Skill does and when Claude should use it.

    ---
    name: code-reviewer
    description: Performs thorough code reviews focusing on security, performance, and best practices. Use when reviewing pull requests or analyzing code quality.
    ---
    
    # Code Review Skill
    
    When reviewing code, follow this systematic approach:
    
    ## Security Analysis
    1. Check for input validation
    2. Look for potential injection vulnerabilities
    3. Verify authentication and authorization
    
    ## Performance Review
    1. Identify bottlenecks in algorithms
    2. Check for unnecessary database queries
    3. Review memory usage patterns
    
    ## Code Quality
    1. Ensure consistent naming conventions
    2. Check for proper error handling
    3. Verify documentation completeness
    
  3. Test your skill Run claude in your project directory and ask Claude to "review the authentication code." Claude will automatically detect and use your custom skill.

What advanced features can you add to skills?

By default, Claude can invoke any skill that doesn't have disable-model-invocation: true set. Skills that define allowed-tools grant Claude access to those tools without per-use approval when the skill is active.

Python Scripts Integration You can bundle Python scripts directly with your skills:

---
name: data-analyzer
description: Analyzes CSV data and generates reports with visualizations
allowed-tools: [Python]
---

# Data Analysis Skill

Use the bundled analysis script to process data files:

1. Load the CSV using pandas
2. Run statistical analysis
3. Generate matplotlib visualizations
4. Create summary report

Scripts available: `scripts/analyze_data.py`

Sub-agent Execution This skill runs research in a forked Explore agent. The skill content becomes the task, and the agent provides read-only tools optimized for codebase exploration. The agent field specifies which subagent configuration to use. Options include built-in agents (Explore, Plan, general-purpose) or any custom subagent from .claude/agents/.

Pre-command Execution The !command syntax runs shell commands before the skill content is sent to Claude. The command output replaces the placeholder, so Claude receives actual data, not the command itself. This skill summarizes a pull request by fetching live PR data with the GitHub CLI.

Why are skills becoming the standard approach?

The shift toward skills-based agent training is happening for several practical reasons:

Reusability Across Platforms Claude Code skills follow the Agent Skills open standard, which works across multiple AI tools. All skills use the open SKILL.md standard, compatible with Claude Code, OpenAI Codex CLI, and other tools adopting this format.

No More Repetitive Prompting Skills are reusable, filesystem-based resources that provide Claude with domain-specific expertise: workflows, context, and best practices that transform general-purpose agents into specialists. Unlike prompts (conversation-level instructions for one-off tasks), Skills load on-demand and eliminate the need to repeatedly provide the same guidance across multiple conversations.

Built-in Quality Control Skills provide that essential, non-negotiable structure. They channel the raw intelligence of agents, ensuring every mission is executed with precision instead of ending in chaotic, banana-fueled mayhem. In short, Skills enforce a process that turns a smart assistant into a truly structured collaborator.

How do you find and install existing skills?

Rather than building everything from scratch, you can leverage the growing ecosystem of pre-built skills.

Official Skills Repository You can register Anthropic's repository as a Claude Code Plugin marketplace by running: /plugin install document-skills@anthropic-agent-skills. After installing the plugin, you can use the skill by just mentioning it.

Community Skills Marketplace Browse 160000+ agent skills compatible with Claude Code, Codex CLI and ChatGPT. The open standard SKILL.md format for AI coding assistants. Check out SkillsMP for community-built skills.

Installation Process For Claude Code: Add to ~/.claude/skills/ (personal) or .claude/skills/ (project). For OpenAI Codex CLI: Add to ~/.codex/skills/. Both use the same SKILL.md format. Clone the GitHub repository and copy the skill folder to your chosen directory.

What's the workflow for iterating on skills?

Claude Code 2.1 introduces automatic skill hot-reloading. Saving the file immediately updates the skill in your running session. No restart. No reinstall. No session reset.

This changes the development experience completely. You can:

  1. Edit skills in real-time - Make changes to your SKILL.md file and see results immediately
  2. Test iteratively - Try different instruction approaches without restarting sessions
  3. Debug skill behavior - Watch how Claude interprets your instructions and refine them

Best Practices for Skill Development:

  • Start simple with clear, step-by-step instructions
  • Test with real tasks before adding complexity
  • Use specific examples in your skill documentation
  • Include error handling instructions
  • Document when the skill should and shouldn't be used

What are the limitations you should know about?

While skills are powerful, they're not magic. Here are key limitations:

Context Awareness Skills work best for procedural tasks but may struggle with highly context-dependent decisions that require deep understanding of your specific situation.

Debugging Complexity When a skill isn't working as expected, it can be challenging to debug whether the issue is in your instructions, Claude's interpretation, or the underlying task complexity.

Performance Trade-offs Finally, if the Skill includes executable code or reference files, those load only when needed. This architecture means you can have many Skills available without overwhelming Claude's context window. Claude accesses exactly what it needs, when it needs it.

What does this mean for the future of AI development?

The shift toward skill-based agent training represents a fundamental change in how we think about AI development. Instead of prompt engineering for each conversation, we're moving toward modular, reusable capabilities that can be combined and shared.

This transforms Claude Code from a sophisticated terminal code assistant into a full-fledged agent operating system. This isn't hyperbole. With 2.1, developers gain the ability to build live, governed, multi-agent systems using nothing more than Markdown files, YAML frontmatter, and shell scripts.

This approach is becoming the standard because it solves real problems developers face: inconsistent AI behavior, time spent on repetitive prompting, and difficulty sharing AI workflows across teams.

The developers who master this skill-based approach now will be the ones building the most effective AI-powered workflows in the coming years. The question isn't whether this method will catch on – it's whether you'll be ready when it becomes the default way teams train and deploy AI agents.