Claude Commands Are Buttons, Agents Are Functions, Skills Are Mixins

Claude Code has three extension mechanisms that initially seem confusing: slash commands, subagents, and skills. The mental model that makes them clear is simple: commands are buttons, subagents are functions, and skills are mixins.

Commands are buttons you click to trigger predefined prompts. They live in .claude/commands/ as markdown files. When you type /review-pr, Claude receives that file's text as its prompt. They're perfect for team-wide standardized workflows: commit them to your repo and everyone gets the same code review checklist or testing procedure. But like buttons, they're static—no parameters, no conditional logic, just text expansion.

Subagents are function calls that accept input parameters and return values. They're explicitly invoked in prompts—the main agent deliberately calls them by name to delegate specific work. When invoked, the main agent describes the task (the input), the subagent executes autonomously with access to tools (Read, Edit, Bash, etc.), then reports back its results (the return value). The Explore subagent searches codebases, the general-purpose subagent handles complex multi-step work—each is a specialized function with its own signature and behavior. Note that subagents cannot access skills—skills are only available to the main agent, not to spawned subagents.

Skills are mixins that add reusable functionality without inheritance. Unlike subagents which are explicitly invoked, skills are implicitly loaded based on context—Claude automatically activates them when their description matches the current task. Just as a ThreadingMixIn class adds threading behavior to Python's TCPServer without making it "a kind of" threading server, Claude Skills are packages of "instructions, scripts, and resources that Claude can load when needed." They compose automatically—multiple skills activate together when relevant—and work across Claude apps, Claude Code, and the API. Skills like Excel manipulation or PDF generation inject specialized capabilities into Claude's base functionality, exactly like mixins inject methods into classes.

Understanding this model clarifies when to use each: commands for repeated user invoked prompts, subagents for explicity invoked complex tasks to limit context size and scope, and skills for implicity invoked adding of domain-specific expertise in the main agent that composes across different use cases.

social