Search⌘ K
AI Features

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.

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 $ARGUMENTS placeholder 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.md file and control whether the developer, Claude, or both can invoke it.

  • Explain what allowed-tools does 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?

.claude/commands/

Project-shared

/name

Yes

~/.claude/commands/

User-global

/name

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 conditionals
2. Safety: SQL injection, command injection, path traversal, unvalidated input
3. Style: violations of the project conventions in CLAUDE.md
4. Test coverage: functions added or changed without corresponding test changes
For 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}
Saved at .claude/commands/review.md. Invoked with /review. Claude reads the current git diff and outputs one JSON object per finding plus a summary line. The output format is machine-readable so a CI script can parse it.
  • 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.

  • ...