Commands, Skills, and Reusable Workflows
Explore how to build reusable Claude Code workflows with commands and skills. Learn where they live, how arguments work, how skills are invoked by a developer or by Claude, how to control the tools a skill can use, and how to choose between CLAUDE.md, skills, hooks, and subagents. The lesson also covers commands that produce structured output for CI pipelines.
We'll cover the following...
- Where commands live
- Writing a command file
- The $ARGUMENTS placeholder
- Structured output for CI pipelines
- User commands for personal workflows
- Project vs. user commands: The decision rule
- From commands to skills
- Writing a skill
- Who can invoke a skill
- Controlling tool use in a skill
- Choosing the right reusable mechanism
- Putting it together: A reusable review workflow
- Exercise: Design the right command
- What’s next?
A Claude Code command is a Markdown file that Claude Code loads as a prompt template when a developer types its slash name in chat. Instead of pasting the same review instructions into every session, the team writes them once in a command file, commits it to the repository, and each developer invokes it the same way. This lesson starts with command files, then moves to skills, the newer format that commands have been merged into, and ends with how to choose the right reusable mechanism for a workflow. By the end of this lesson, we will be able to:
Create a project command file and explain where it must be placed to be available to the team.
Use the
$ARGUMENTSplaceholder to pass runtime input into a command prompt.Design a command that produces structured output for use outside the interactive session.
Explain the difference between project commands and user commands.
Write a skill with a
SKILL.mdfile and control whether the developer, Claude, or both can invoke it.Explain what
allowed-toolsdoes and does not do.Choose between CLAUDE.md, a skill, a hook, and a subagent for a reusable workflow.
Where commands live
Commands are Markdown files stored in specific directories. Their location determines who can invoke them:
Directory | Scope | Invoked As | Version Controlled? |
| Project-shared |
| Yes |
| User-global |
| No |
A file at .claude/commands/review.md is invoked as /review. A file at ~/.claude/commands/summarize.md is invoked as /summarize. Subdirectories are allowed and create namespaced commands: .claude/commands/db/migrate.md is invoked as /db:migrate.
The project commands directory is committed to the repository alongside CLAUDE.md and .claude/settings.json. Every developer who clones the repository gets the same commands without any personal setup.
Writing a command file
A command file is a Markdown prompt. Claude Code reads the entire file content and sends it as the user turn when the command is invoked. The file can contain any instructions, context, or structure that a regular prompt can contain. Here is a code review command for a Python project:
Review the changes in the current git diff for the following:1. Correctness: logic errors, off-by-one errors, incorrect conditionals2. Safety: SQL injection, command injection, path traversal, unvalidated input3. Style: violations of the project conventions in CLAUDE.md4. Test coverage: functions added or changed without corresponding test changesFor each finding, output a JSON object on its own line:{"file": "<path>", "line": <n>, "severity": "error|warning|suggestion", "message": "<one sentence>"}After all findings, output a summary line:{"summary": true, "errors": <n>, "warnings": <n>, "suggestions": <n>}If there are no findings, output:{"summary": true, "errors": 0, "warnings": 0, "suggestions": 0}
Numbered review criteria: Explicit numbered steps reduce the chance that Claude skips a category. “Review the changes” with no structure produces inconsistent coverage across invocations.
...