/shortcuts. Droid scans a pair of .factory/commands folders, turns each file into a command, and pipes the result straight into the conversation or your terminal session.
1 · Discovery & naming
| Scope | Location | Purpose |
|---|---|---|
| Workspace | <repo>/.factory/commands | Project-specific commands shared with teammates. Overrides any personal command with the same slug. |
| Personal | ~/.factory/commands | Always scanned. Stores private or cross-project shortcuts. |
- Only Markdown (
*.md) files and files with a leading shebang (#!) are registered. - Filenames are slugged (lowercase, spaces →
-, non URL-safe characters dropped).Code Review.mdxbecomes/code-review. - Invoke commands from chat with
/command-name optional arguments. Slash suggestions use the description pulled from the file. - Run
/commandsto open the Custom Commands manager UI for browsing, reloading (R), or importing commands. - Commands must live at the top level of the
commandsdirectory. Nested folders are ignored today.
2 · Markdown commands
Markdown files render into a system notification that seeds droid’s next turn. Optional YAML frontmatter controls autocomplete metadata.| Frontmatter key | Purpose |
|---|---|
description | Overrides the generated summary shown in slash suggestions. |
argument-hint | Appends inline usage hints (e.g., /code-review <branch-name>). |
allowed-tools | Reserved for future use. Safe to omit. |
$ARGUMENTS expands to everything typed after the command name. If you do not reference $ARGUMENTS, the body is sent unchanged.
Markdown output is wrapped in a system notification so the next agent turn
immediately sees the prompt.
Positional placeholders like
$1 or $2 are not supported yet—use
$ARGUMENTS and parse inside the prompt if you need structured input.3 · Executable commands
Executable files must start with a valid shebang so the CLI can call the interpreter.- The executable receives the command arguments (
/deploy feature/login→$1=feature/login). - Scripts run from the current working directory and inherit your environment, so they have the same permissions you do.
- Stdout and stderr (up to 64 KB) plus the script contents are posted back to the chat transcript for transparency. Failures still surface their logs.
4 · Managing commands
- Edit or add files directly in
.factory/commands. The CLI rescans on launch; pressRinside/commandsto reload without restarting. - Import existing
.agentsor.claudecommands: open/commands, pressI, select entries, and they copy into your Factory directory. - Remove a command by deleting its file. Since workspace commands win precedence, deleting the repo version reveals the personal fallback if one exists.
5 · Usage patterns
- Keep project workflows under version control inside the repo’s
.factory/commandsso teammates share the same shortcuts. - Build idempotent scripts that are safe to rerun; document any cleanup steps in the file itself.
- Use Markdown templates for checklists, code review rubrics, onboarding instructions, or context packets you frequently provide to droid.
- Review executable commands like any other source code—treat secrets carefully and prefer referencing environment variables already loaded in your shell.
6 · Examples
Code review rubric (Markdown)
/review feature/login-flow to seed droid with a consistent checklist before it inspects the diff.
Daily standup helper (Markdown)
/standup after droid reviews your git history or TODO list to generate a polished update.
Regression smoke test (Executable)
smoke.sh, this shows up as /smoke. Pass a path (/smoke src/widgets/__tests__/widget.test.tsx) to constrain the checks and share the aggregated output with everyone on the thread.
Once set up, custom slash commands compress multi-step prompts or environment setup into a single keystroke, keeping your focus on guiding droid instead of repeating boilerplate.