How to Use Subagents and Skills in Claude Code for Advanced Workflows
I kept seeing the same problem: Claude Code would work on one task, then another, then another - all sequentially. A code review here, a security check there, some refactoring over there. Each took time. Each blocked the next. My coding sessions dragged on.
Then I discovered subagents and skills in Claude Code.
The Direct Answer
Claude Code supports subagents and skills that enable parallel task execution and specialized workflows. Subagents are specialized agents (planner, code-reviewer, security-reviewer, etc.) that handle specific tasks autonomously. Skills are reusable command patterns stored in ~/.claude/skills/ that extend capabilities without repeating instructions.
The key insight? Launch subagents in batches of 2 for independent tasks. Create custom skills for workflows you repeat frequently.
What I Found from the Community
A comment on Reddit (score 2) confirmed my experience: “Since you’re using Claude Code. Sub agents and skills are my best tools. There are great repos on GitHub that have pretty handy agents and skills that you can integrate in your coding workflows.”
Another user shared their workflow: “Anthropic plugin has a code-simplifier agent that you can run after the main agent finishes implementation. After that I typically run a code reviewer agent, etc.”
The pattern became clear: specialized agents in sequence or parallel, skills for repeated commands.
Understanding Subagents
Subagents are specialized AI agents that focus on specific tasks. Instead of one general-purpose agent doing everything, you get specialists.
Here’s a table of the available subagents:
| Agent | Purpose | When to Use |
|---|---|---|
| planner | Implementation planning | Complex features, refactoring |
| architect | System design | Architectural decisions |
| tdd-guide | Test-driven development | New features, bug fixes |
| code-reviewer | Code review | After writing code |
| security-reviewer | Security analysis | Before commits |
| build-error-resolver | Fix build errors | When build fails |
| e2e-runner | E2E testing | Critical user flows |
| refactor-cleaner | Dead code cleanup | Code maintenance |
These agents live in ~/.claude/agents/ as markdown files with instructions, purpose descriptions, and expected outputs.
Understanding Skills
Skills are reusable command patterns. Think of them as macros or shortcuts for common workflows.
Skills are stored in ~/.claude/skills/ as markdown files. Each skill contains:
- Purpose: What the skill does
- Workflow: Steps to execute
- Output Expectations: What you should see
For example, a skill might encapsulate the entire workflow of: run tests, fix failures, format code, commit changes. Instead of repeating these instructions each time, you just invoke the skill.
Skills can be triggered by keywords or slash commands. When Claude Code detects a skill trigger, it loads the skill’s instructions and executes the workflow.
Key Patterns I Use
Pattern 1: Parallel Execution for Independent Tasks
This is the most important pattern I learned. ALWAYS launch agents in parallel for independent tasks.
# GOOD: Launch 3 agents in parallel1. Agent 1: Security analysis of auth.ts2. Agent 2: Performance review of cache system3. Agent 3: Type checking of utils.ts
# BAD: Sequential when unnecessaryFirst agent 1, then agent 2, then agent 3When tasks don’t depend on each other, parallel execution saves significant time.
Pattern 2: Chain Specialized Agents
For dependent tasks, chain agents in sequence:
1. Run code-simplifier agent after implementation2. Then run code-reviewer agent3. Finally run security-reviewer agentEach agent builds on the previous one’s output, creating a thorough review pipeline.
Pattern 3: Skills for Repeated Workflows
I have workflows I repeat constantly:
- Run tests, fix failures, commit
- Format code, run linter, fix issues
- Create PR, add description, request review
Instead of repeating instructions, I create skills. One command triggers the entire workflow.
Common Mistakes I Made
I learned these the hard way:
Sequential execution for independent tasks: Launching agents one by one when they could run in parallel. This wastes time and context.
Not using specialized reviewers: Relying on the main agent for everything instead of using specialized code-reviewer and security-reviewer agents.
Repeating instructions manually: Not creating skills for workflows I run repeatedly. This adds cognitive overhead and introduces inconsistency.
Ignoring skill triggers: Not leveraging the skill system when keywords match. Skills are designed to speed up common workflows.
Running all agents on small tasks: Over-engineering. Simple bug fixes don’t need planner, architect, tdd-guide, and three reviewers. Match the tool to the task size.
Multi-Perspective Analysis
For complex problems, I use split role sub-agents. Instead of one reviewer, I launch multiple perspectives in parallel:
- Factual reviewer: Checks for accuracy
- Senior engineer: Evaluates design
- Security expert: Identifies vulnerabilities
- Consistency reviewer: Ensures codebase alignment
- Redundancy checker: Finds duplicate code
This approach catches issues a single reviewer would miss.
When to Use Which
For complex feature requests, I start with the planner agent. It breaks down the implementation into manageable steps.
After writing or modifying code, I immediately use the code-reviewer agent. It catches issues while context is fresh.
For bug fixes or new features, the tdd-guide agent ensures I follow test-driven development.
Architectural decisions get the architect agent. It evaluates trade-offs and designs.
Summary
In this post, I shared how to use Claude Code’s subagents and skills for more efficient AI coding sessions. The core insight is parallel execution: launch independent tasks in batches, not sequentially. Subagents specialize in specific tasks like planning, reviewing, and testing. Skills encapsulate repeated workflows into reusable commands. Together, they transform Claude Code from a single-threaded assistant into a multi-agent orchestrator.
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