What are Commands?
Commands are slash commands (e.g.,/ct-check) that provide quick entry points to specific workflows. They parse arguments, validate inputs, and invoke skills or agents with the right context.
Command Structure
Commands are markdown files in thecommands/ directory with YAML frontmatter:
Frontmatter Format
command-name.md
Frontmatter Fields
string
required
Command name with optional namespace. Format:
namespace:command-name or just command-name.Examples:trailofbits:ct-check(namespaced)scan-apk(no namespace)
string
required
Brief description shown in command palette and help text.
string
Argument syntax shown to users. Use angle brackets for required args, square brackets for optional.Example:
"<source-file> [--warnings] [--json] [--arch <arch>]"array
List of tools the command can use. Same as skill
allowed-tools.Command Body
The markdown body contains instructions for Claude on how to handle the command:command-name.md
Use
$ARGUMENTS to reference the arguments passed by the user.Argument Parsing Patterns
Simple Arguments
Complex Arguments with Validation
Multiple Argument Forms
Invoking Skills
Commands typically invoke skills to perform the actual work:ct-check.md:
Invoking Agents
Commands can also launch autonomous agents:Real Examples
ct-check (Simple Skill Invocation)
ct-check (Simple Skill Invocation)
diff-review (Agent Launcher)
diff-review (Agent Launcher)
entry-points (Multiple Forms)
entry-points (Multiple Forms)
audit-context (Complex Workflow)
audit-context (Complex Workflow)
Command Naming
Use Namespaces
For organization-wide plugins:
trailofbits:ct-checkFor personal/project plugins:scan-apkBe Descriptive
Good:
diff-reviewentry-pointsaudit-context
drepcheck
Use Verbs
Good:
scan-apkanalyze-contractreview-diff
apkcontractdiff
Keep It Short
Good:
ct-check(constant-time check)diff-review
constant-time-analysis-checkdifferential-security-review
Argument Hint Best Practices
Argument hints show users the expected syntax. Follow these conventions:- Required Arguments
- Optional Arguments
- Flags
- Flag Values
Use angle brackets:
<argument-name>Command Discovery
Users discover commands through:- Command palette - Shows all available commands with descriptions
- Autocomplete - Typing
/shows command suggestions - Help text -
--helpflag shows argument hints
description and argument-hint are clear and informative.
Error Handling
Provide clear error messages when arguments are invalid:Testing Commands
1
Test with minimal arguments
2
Test with all arguments
3
Test error cases
4
Test edge cases
Best Practices
Keep It Simple
Most commands should just parse arguments and invoke a skill or agent.
Validate Early
Check arguments before invoking expensive operations.
Provide Defaults
Make optional arguments truly optional with sensible defaults.
Clear Errors
Show helpful error messages with usage examples.
Next Steps
Skills
Learn how skills provide the logic commands invoke
Agents
Understand autonomous agents launched by commands
Create a Command
Learn how to author custom commands
Command Examples
Browse real command implementations