Skip to main content

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.
Commands are the user-facing API for your plugin. They should be memorable, concise, and clearly describe what they do.

Command Structure

Commands are markdown files in the commands/ 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

/entry-points [file-path]
/entry-points [directory] —recursive
/entry-points —package [package-name]

Invoking Skills

Commands typically invoke skills to perform the actual work:
Example from ct-check.md:

Invoking Agents

Commands can also launch autonomous agents:

Real Examples

Command Naming

Use Namespaces

For organization-wide plugins:trailofbits:ct-checkFor personal/project plugins:scan-apk

Be Descriptive

Good:
  • diff-review
  • entry-points
  • audit-context
Bad:
  • dr
  • ep
  • check

Use Verbs

Good:
  • scan-apk
  • analyze-contract
  • review-diff
Bad:
  • apk
  • contract
  • diff

Keep It Short

Good:
  • ct-check (constant-time check)
  • diff-review
Avoid:
  • constant-time-analysis-check
  • differential-security-review

Argument Hint Best Practices

Argument hints show users the expected syntax. Follow these conventions:
Use angle brackets: <argument-name>

Command Discovery

Users discover commands through:
  1. Command palette - Shows all available commands with descriptions
  2. Autocomplete - Typing / shows command suggestions
  3. Help text - --help flag shows argument hints
Make sure your 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