Agent Skills in Claude Code: Extend Claude's Capabilities
By Learnia Team
Agent Skills in Claude Code: Extend Claude's Capabilities
This article is written in English. Our training modules are available in French.
Skills are Claude Code's learned behaviors—patterns Claude discovers in your codebase and remembers for future use. Unlike static configuration, skills evolve as Claude works with your project, building a repertoire of capabilities tailored to your development environment.
What Are Skills?
Skills are reusable capabilities that Claude learns and applies automatically. When Claude successfully completes a task pattern, it can save that knowledge as a skill for future use.
Example: Before Skills
Every time you ask Claude to deploy:
> Deploy to staging
What's your deployment process? Do you use Docker,
Kubernetes, or a platform like Vercel? What
environment variables are needed?
Claude asks the same questions every session.
Example: With Skills
Claude remembers your deployment pattern:
> Deploy to staging
Using learned skill: "Staging Deployment"
1. Running tests...
2. Building Docker image...
3. Pushing to registry...
4. Updating Kubernetes deployment...
5. Verifying health checks...
✓ Deployed to staging successfully
Claude applies what it learned before.
How Skills Work
The skill lifecycle follows three stages:
1. Discover → Claude finds patterns in your workflow
2. Use → Claude applies learned skills automatically
3. Refine → Claude improves skills based on feedback
This cycle repeats continuously as you work with Claude Code.
Skill Discovery
Claude identifies patterns from:
- →CLAUDE.md files: Documented conventions
- →Codebase analysis: Existing patterns in code
- →Session history: Successful task completions
- →Explicit teaching: When you tell Claude how to do something
Skill Storage
Skills are stored in:
- →
— User-level skills~/.claude/skills/ - →
— Project-level skills.claude/skills/ - →Memory context — Session-derived capabilities
Skill Application
When you request something, Claude:
- →Checks relevant skills
- →Applies matching patterns
- →Adapts to current context
- →Executes with learned knowledge
Built-in Skills
Claude Code comes with foundational skills:
| Skill Category | Examples |
|---|---|
| Code Generation | Create components, functions, tests |
| Refactoring | Extract methods, rename symbols, restructure |
| Testing | Generate unit/integration tests |
| Documentation | Create README, API docs, comments |
| Git Operations | Commits, branches, PRs |
| Debugging | Find and fix bugs |
These are enhanced by project-specific learning.
Skill Files
Anatomy of a Skill File
# .claude/skills/deploy-staging.yaml
name: deploy-staging
description: Deploy application to staging environment
version: "1.0"
triggers:
- "deploy to staging"
- "staging deployment"
- "update staging"
prerequisites:
- All tests passing
- On main or develop branch
- Docker daemon running
steps:
- Run test suite: npm test
- Build Docker image: docker build -t app:staging .
- Push to registry: docker push registry/app:staging
- Update Kubernetes: kubectl rollout restart deployment/app -n staging
- Verify health: curl -f https://staging.example.com/health
tools_used:
- Bash(npm:test)
- Bash(docker:*)
- Bash(kubectl:*)
notes: |
- Staging uses the staging-config configmap
- Health check may take 30-60 seconds
- Notify #deployments on Slack after completion
Skill Properties
| Property | Description |
|---|---|
| Unique identifier |
| What the skill does |
| Skill version for updates |
| Phrases that activate the skill |
| Conditions before execution |
| Ordered actions to perform |
| Required tool permissions |
| Additional context |
Creating Skills
From Conversation
Ask Claude to save a pattern:
> That deployment process worked great. Save it as a skill.
Saved skill: "Staging Deployment"
Triggers:
- deploy to staging
- staging deployment
- update staging
Steps captured:
1. npm test
2. docker build -t app:staging .
3. docker push registry/app:staging
4. kubectl rollout restart...
5. Health verification
Skill saved to: .claude/skills/deploy-staging.yaml
Manual Creation
Create skill files directly:
# .claude/skills/code-review.yaml
name: code-review
description: Comprehensive code review following team standards
triggers:
- "review this code"
- "code review"
- "/review"
steps:
- Check for ESLint errors: npm run lint
- Verify TypeScript types: npm run typecheck
- Review changes: git diff HEAD~1
- Analyze for security issues
- Check test coverage for changed files
- Summarize findings with severity ratings
context:
style_guide: docs/STYLE_GUIDE.md
security_rules: docs/SECURITY.md
From CLAUDE.md
Skills can reference CLAUDE.md conventions:
# .claude/skills/create-component.yaml
name: create-component
description: Create React component following project conventions
triggers:
- "create component"
- "new component"
- "generate component"
context_from_claude_md:
- Component structure conventions
- Styling approach (CSS modules)
- Testing requirements
steps:
- Create component file in src/components/
- Add TypeScript types
- Create CSS module
- Generate unit tests
- Add Storybook story if UI component
Skill Categories
Development Skills
# Create API endpoint
name: create-api-endpoint
triggers: ["create endpoint", "new api route", "add endpoint"]
steps:
- Create route handler
- Add request validation
- Implement service logic
- Add error handling
- Generate tests
- Update API documentation
Testing Skills
# Generate comprehensive tests
name: test-generation
triggers: ["generate tests", "create tests", "add tests for"]
steps:
- Analyze target code structure
- Identify test scenarios
- Create unit tests for functions
- Create integration tests for modules
- Add edge case coverage
- Verify tests pass
Refactoring Skills
# Extract and refactor
name: extract-component
triggers: ["extract component", "refactor into component"]
steps:
- Identify extractable code
- Create new component file
- Move code with proper imports
- Update original file
- Add TypeScript types
- Verify functionality preserved
- Run affected tests
DevOps Skills
# Database migration
name: create-migration
triggers: ["create migration", "add migration", "database change"]
steps:
- Generate migration file
- Add up/down operations
- Update schema types
- Run migration locally
- Verify data integrity
- Create rollback test
Skill Inheritance
User to Project
User skills provide defaults, project skills override:
User skills (~/.claude/skills/):
- →
- Generic deploymentdeploy.yaml - →
- Generic testingtest.yaml - →
- Generic reviewreview.yaml
Project skills (project/.claude/skills/):
- →
- Project-specific (overrides user)deploy.yaml - →
- Project-specific additionci-check.yaml
Skill Composition
Skills can build on other skills:
# .claude/skills/release.yaml
name: release
description: Full release process
triggers:
- "release"
- "create release"
- "new version"
composed_of:
- code-review # Run code review first
- test-generation # Ensure test coverage
- deploy-staging # Deploy to staging
- verify-staging # Verify staging works
additional_steps:
- Update version in package.json
- Generate changelog
- Create git tag
- Deploy to production
- Create GitHub release
Skill Context
Providing Context to Skills
Skills can reference external context:
# .claude/skills/api-design.yaml
name: api-design
description: Design API following company standards
context_files:
- docs/API_STANDARDS.md
- docs/ERROR_CODES.md
- src/types/api.ts
context_patterns:
- Existing API routes in src/api/
- Current error handling patterns
- Response format standards
Dynamic Context
Skills adapt to the current state:
# .claude/skills/debug.yaml
name: debug
description: Debug current issue
dynamic_context:
- Current error messages
- Recent code changes (git diff)
- Relevant test failures
- Related stack traces
steps:
- Gather error context
- Identify potential causes
- Check recent changes
- Propose fixes
- Test fix locally
Managing Skills
List Skills
> What skills do you have for this project?
Available Skills:
Project Skills:
- deploy-staging: Deploy to staging environment
- code-review: Code review with team standards
- create-component: Create React component
- create-endpoint: Create API endpoint
User Skills:
- git-workflow: Standard git commit flow
- documentation: Generate documentation
Built-in Skills:
- refactoring: Code refactoring patterns
- testing: Test generation
- debugging: Bug finding and fixing
View Skill Details
> Show me the deploy-staging skill
Skill: deploy-staging
Version: 1.2
Last used: 2 hours ago
Success rate: 95%
Triggers:
- deploy to staging
- staging deployment
- update staging
Prerequisites:
- Tests passing
- On main/develop branch
- Docker running
Steps:
1. npm test
2. docker build -t app:staging .
3. docker push registry/app:staging
4. kubectl rollout restart...
5. curl -f staging/health
Notes:
- Uses staging-config configmap
- Health check takes 30-60s
Update Skills
> Update the deploy skill to also run linting
Updated skill: deploy-staging
Added step before tests:
- npm run lint
Updated version: 1.2 → 1.3
Delete Skills
> Remove the old-deploy skill
Removed skill: old-deploy
Previous file archived to: .claude/skills/.archive/old-deploy.yaml
Skill Optimization
Learning from Failures
When skills fail, Claude learns:
> Deploy to staging
Using skill: deploy-staging
Step 3 failed: docker push registry/app:staging
Error: Authentication required
Would you like me to:
1. Add authentication step to skill
2. Skip and continue manually
3. Update skill with new registry
> 1
Updated skill with:
- Pre-step: docker login registry (with env credentials)
- Saved to deploy-staging v1.4
Skill Analytics
Track skill performance:
> Show skill statistics
Skill Usage (last 30 days):
| Skill | Uses | Success | Avg Time |
|-----------------|------|---------|----------|
| deploy-staging | 23 | 96% | 4.2 min |
| code-review | 45 | 100% | 2.1 min |
| create-component| 12 | 100% | 1.5 min |
| debug | 31 | 84% | 6.8 min |
Recommendations:
- debug skill has lower success rate; review failure patterns
- deploy-staging could benefit from parallel steps
Skills in Practice
Workflow: Onboarding New Developer
> Set up a new developer environment
Using skills:
- environment-setup (system skill)
- project-setup (project skill)
Steps:
1. Checking system requirements...
✓ Node 18+, Docker, Git installed
2. Installing dependencies...
✓ npm install complete
3. Setting up environment...
✓ .env.local created from template
4. Initializing database...
✓ Docker containers started
✓ Migrations applied
5. Verifying setup...
✓ npm test: all passing
✓ npm run dev: server started
Environment ready! See docs/DEVELOPMENT.md for next steps.
Workflow: Feature Development
> Create a user profile feature
Using skills:
- create-component
- create-endpoint
- test-generation
Creating user profile feature...
Components:
✓ src/components/UserProfile.tsx
✓ src/components/UserAvatar.tsx
✓ src/components/UserSettings.tsx
API:
✓ src/api/profile/route.ts
✓ src/services/ProfileService.ts
✓ src/types/profile.ts
Tests:
✓ __tests__/components/UserProfile.test.tsx
✓ __tests__/api/profile.test.ts
✓ __tests__/services/ProfileService.test.ts
Documentation:
✓ Updated docs/API.md with profile endpoints
Workflow: Bug Investigation
> There's a bug where users can't update their email
Using skill: debug
Investigation:
1. Searching for email update code...
Found: src/api/users/update.ts
2. Checking recent changes...
Last modified: 3 days ago (commit abc123)
3. Analyzing the change...
Issue found: Missing validation bypass for same-email updates
4. Proposed fix:
Add check: if (newEmail === currentEmail) return success;
5. Created test case for this scenario
Apply fix? [y/n]
Integration with Other Features
Skills + Custom Commands
Commands can invoke skills:
<!-- .claude/commands/feature.md -->
Create a new feature using our standard skills:
1. Use create-component skill for UI
2. Use create-endpoint skill for API
3. Use test-generation skill for coverage
4. Use documentation skill for docs
See Custom Slash Commands in Claude Code: Build Your Own.
Skills + Sub-Agents
Sub-agents inherit skills:
> Use sub-agents to create tests for all services
[Spawning test-generation agents...]
Each agent uses: test-generation skill
Agent 1: UserService → 12 tests
Agent 2: OrderService → 18 tests
Agent 3: PaymentService → 15 tests
See Claude Code Sub-Agents: Orchestrating Complex Tasks.
Skills + Hooks
Validate skill execution with hooks:
{
"hooks": {
"PreToolUse": [{
"matcher": "*",
"command": "python .claude/hooks/skill-validation.py"
}]
}
}
See Claude Code Hooks: Automate Your Development Workflow.
Skills + MCP
Skills can use MCP tools:
name: sync-issues
description: Sync GitHub issues with local tracking
tools_required:
- mcp__github__list_issues
- mcp__github__get_issue
- Write(docs/TODO.md)
See Model Context Protocol (MCP) for Claude Code: Complete Guide.
Best Practices
1. Start with Documentation
Document patterns in CLAUDE.md first:
## Deployment Process
1. Run all tests
2. Build Docker image
3. Push to registry
4. Update Kubernetes
5. Verify health
Claude learns from documentation.
2. Let Skills Evolve
Don't over-engineer initial skills:
# Start simple
name: deploy
steps:
- npm test
- npm run build
- npm run deploy
# Evolve based on needs
# v2: Add Docker
# v3: Add K8s
# v4: Add health checks
3. Version Your Skills
Track changes over time:
name: deploy
version: "2.1"
changelog:
- "2.1": Added parallel test execution
- "2.0": Migrated to Kubernetes
- "1.0": Initial Docker-based deployment
4. Share Team Skills
Commit skills to version control:
- →.claude/skills/README.md - Skill documentation
- →.claude/skills/deploy.yaml
- →.claude/skills/review.yaml
- →.claude/skills/testing.yaml
- →.claude/CLAUDE.md
5. Test Skills Periodically
Verify skills still work:
> Test all project skills
Testing skills...
✓ deploy-staging: Success (dry run)
✓ code-review: Success
✗ create-migration: Failed (new Prisma syntax)
✓ test-generation: Success
1 skill needs update: create-migration
Key Takeaways
- →
Skills are learned behaviors: Claude remembers successful patterns.
- →
Save valuable workflows: When something works, save it as a skill.
- →
Skills compose: Build complex skills from simpler ones.
- →
Project-specific: Skills adapt to your codebase and conventions.
- →
Continuous improvement: Skills evolve based on feedback and failures.
Master Agent Capabilities
Skills are the building blocks of capable AI agents. Learn to design agents that leverage skills effectively.
In our Module 6 — Autonomous Agents, you'll learn:
- →Agent capability design
- →Skill orchestration patterns
- →Building adaptive agents
- →Measuring agent effectiveness
Module 6 — AI Agents & ReAct
Create autonomous agents that reason and take actions.