Skip to content

How to Create and Use Claude Code Skills for AI Workflow Automation

I found myself typing the same prompts over and over. Every time I started a new coding session, I’d ask Claude to “review this code” or “help me write tests first.” Same instructions, same context, same workflow—repeated across dozens of sessions.

That’s when I discovered Claude Code skills. They’re simple markdown files that define reusable workflows. When triggered by keywords, Claude loads the skill and follows the protocol. No more repetitive prompting.

What Are Claude Code Skills?

Skills are markdown protocol files stored in ~/.claude/skills/. Each skill contains:

  1. YAML frontmatter - Defines when the skill activates
  2. Step-by-step workflow - Instructions Claude follows

When you mention a trigger keyword in your prompt, Claude detects it, loads the skill, and executes the workflow. The skill only consumes tokens when active—not when sitting idle.

This is Level 3 in the Claude Code maturity model. Many users report this as a breakthrough moment. One Reddit user put it: “Level 3 was where things clicked, having reusable ‘skills’ or templates changed everything.”

The Problem Skills Solve

Before skills, I had inconsistent workflows. Sometimes I’d remember to check for security issues during code review. Sometimes I’d forget. My test-driven development sessions varied in quality depending on what I remembered to ask for.

Skills codify your best practices. Instead of hoping you remember every step, you write it down once. Every time the skill triggers, the same workflow executes.

Creating Your First Skill

Let’s build a practical skill together. I’ll show you a code review skill that I use daily.

Step 1: Create the Skills Directory

First, ensure the skills directory exists:

Terminal window
mkdir -p ~/.claude/skills

Step 2: Create the Skill File

Create a file called code-reviewer.md in that directory:

~/.claude/skills/code-reviewer.md
---
name: code-reviewer
description: Performs comprehensive code review
trigger:
- review code
- code review
- review this
---
# Code Review Protocol
## Step 1: Security Analysis
Scan for:
- Hardcoded credentials
- SQL injection vectors
- XSS vulnerabilities
- Insecure dependencies
## Step 2: Code Quality
Check for:
- Functions under 50 lines
- Files under 800 lines
- No deep nesting (>4 levels)
- Proper error handling
## Step 3: Generate Report
Output format:
- CRITICAL: Blocking issues
- HIGH: Should fix before merge
- MEDIUM: Consider addressing
- LOW: Nice to have

Step 3: Trigger the Skill

Now when you type “review this code” in Claude Code, it loads the skill and follows your protocol. No need to explain what you want reviewed or how to format the output.

Understanding the Frontmatter

The frontmatter controls when your skill activates:

---
name: code-reviewer # Internal identifier
description: What it does # Shown in skill listings
trigger: # Activation keywords
- review code
- code review
- review this
---

The trigger field is critical. Claude scans your prompt for these keywords. When it finds a match, it loads the skill. Choose triggers that are natural phrases you’d actually type.

A More Advanced Example: TDD Skill

Test-driven development benefits enormously from skills. Here’s a TDD skill that guides the full workflow:

~/.claude/skills/tdd-guide.md
---
name: tdd-guide
description: Guides test-driven development workflow
trigger:
- tdd
- test-driven
- write tests first
---
# TDD Protocol
## Phase 1: RED
1. Identify the feature to implement
2. Write a failing test
3. Run test - confirm it FAILS
## Phase 2: GREEN
1. Write minimal implementation
2. Run test - confirm it PASSES
3. No refactoring yet
## Phase 3: IMPROVE
1. Refactor for clarity
2. Run tests again
3. Check coverage (target: 80%+)
Reference: Load detailed patterns from ~/.claude/rules/testing.md

This skill enforces discipline. I can’t skip the RED phase or jump straight to implementation. The skill structure keeps me honest.

Skills with Evaluation Criteria (Level 3.5)

Recent Claude Code versions support evaluation criteria in skills. This lets you define success conditions:

~/.claude/skills/deploy-checker.md
---
name: deploy-checker
description: Validates deployment readiness
trigger:
- deploy
- deploy check
- ready to deploy
eval:
- all tests pass
- no console.log statements
- no hardcoded secrets
- build succeeds
---
# Deployment Readiness Protocol
## Pre-deployment Checklist
- [ ] All unit tests passing
- [ ] Integration tests passing
- [ ] E2E tests passing (critical paths)
- [ ] No console.log in production code
- [ ] Environment variables documented
- [ ] Database migrations tested
- [ ] Rollback plan documented
## Output
If all checks pass: Proceed with deployment
If checks fail: List blocking issues with fixes

The eval section defines hard requirements. Claude can verify these conditions before proceeding.

Loading External References

Skills can reference other files. This keeps skills focused while allowing detailed references:

---
name: security-reviewer
description: Security-focused code review
trigger:
- security review
- security audit
---
# Security Review Protocol
1. Load security checklist from ~/.claude/rules/security.md
2. Scan codebase for each vulnerability type
3. Generate report with severity ratings
4. Provide fix recommendations for each issue

This pattern separates the skill logic from the detailed security rules. You can update security.md without touching the skill.

Common Mistakes to Avoid

Over-engineering Skills

Keep skills focused. A skill should do one thing well. I made the mistake of creating a “super-skill” that tried to handle code review, testing, and deployment. It became unwieldy and hard to trigger correctly.

Better approach: Split into separate skills: code-reviewer, tdd-guide, deploy-checker.

Vague Triggers

Triggers need to be specific:

# Bad - too generic
trigger:
- fix
- help
# Good - specific phrases
trigger:
- fix this bug
- help with debugging
- debug this issue

Generic triggers cause false activations. You don’t want your bug-fixing skill loading when you ask for help with documentation.

No Documentation

Future you won’t remember what a skill does. Add context:

---
name: api-generator
description: Generates REST API endpoints from OpenAPI spec
trigger:
- generate api
- create endpoints
---
# API Generator
## Purpose
Generate Express.js route handlers from OpenAPI 3.0 specifications.
## Prerequisites
- OpenAPI spec file in project root
- Express.js project structure
...

How Skills Fit Your Workflow

Skills work best for workflows you repeat across sessions. Ask yourself:

  • Do I send similar prompts multiple times per week?
  • Is there a procedure I want Claude to follow consistently?
  • Would I benefit from a structured checklist?

If yes to any of these, create a skill.

Skills don’t replace good prompting—they enhance it. You still need to provide context and make decisions. But the repetitive structure gets handled automatically.

Token Cost Clarification

One note on tokens: Skills don’t truly cost “zero tokens when inactive.” Claude must read each skill’s frontmatter to check triggers. However, the full skill content only loads when activated.

For most users with a handful of skills, this overhead is negligible. If you have dozens of skills, consider whether you need all of them active.

Getting Started Checklist

  • Create ~/.claude/skills/ directory
  • Identify your most common repetitive workflows
  • Start with one skill (don’t overcomplicate)
  • Test the trigger keywords work as expected
  • Iterate based on actual usage

Skills are a simple tool with outsized impact. They transform Claude Code from a conversational AI into a workflow automation system. Start small, build what you actually need, and refine based on real usage.

Final Words + More Resources

My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me

Here are also the most important links from this article along with some further resources that will help you in this scope:

Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!

Comments