⌨️ HN #1 thread topic

Claude Code Slash Commands — 8 Built-ins Plus Custom, in One Reference

/init /review /compact /cost /loop /schedule /plugin /help — the full list. Plus custom commands at .claude/commands/ with project and personal scopes.

8 Built-in Slash Commands

1) **/init** — initialize a project (write CLAUDE.md + .claude/ dir) 2) **/review** — run code review via the active plugin's review skill 3) **/compact** — compress the current conversation context; power users invoke this every 20-30 min of active work 4) **/cost** — token usage and cost estimate for the current session 5) **/loop** — poll-execute a prompt / command on a schedule (deploy monitoring) 6) **/schedule** — create a Routine (see our Routines guide) 7) **/plugin** — browse / install / disable plugins (shows projected context cost) 8) **/help** — command list

/compact Is the Most-Used Command

Experienced Claude Code users report running /compact every 20-30 minutes of active work to ward off the quality degradation that creeps into long sessions. Compact summarizes the current conversation, keeps key artifact paths, and drops intermediate churn. Combined with /plugin's projected context cost display, you can precisely manage your token budget. Versus starting a new session: working memory and subagent state are preserved.

Custom Slash Commands — Project vs Personal

Custom commands live as markdown files; the filename becomes the command and the body is the prompt injected to Claude. Two scopes: - **Project**: `<repo>/.claude/commands/<name>.md` — shared with the team, committed to git - **Personal**: `~/.claude/commands/<name>.md` — your machine only, applies across projects Example: `.claude/commands/deploy-staging.md` containing 'run staging deploy per .deploy.yml, restart, sleep 15s, curl health' — anyone on the team runs /deploy-staging.

Relation to Hooks, Subagents, and Plugins

**Hook**: event-driven side effect (PostToolUse / PreCommit), not user-callable. **Subagent**: dispatchable task unit. **Plugin**: client feature bundle (may contain hooks + skills + slash commands). **Slash command**: user-callable shortcut. One plugin can contribute multiple slash commands. Before writing a custom command, decide: is this a command (/x), automation (hook), or task (subagent)?

FAQ

How do I distribute team slash commands to new members?

Commit `.claude/commands/` to git. New members clone the repo and the commands are immediately available. `~/.claude/commands/` is personal — each person maintains their own.

Can slash commands take arguments?

Yes — use `{{ARGS}}` in the command file to capture additional text from `/cmd arg1 arg2`. Claude substitutes and injects the full prompt. See Claude Code docs for details.

Does Codex have similar slash commands?

Yes — Codex CLI has `/goal`, `/mcp`, and others. Semantics and extension mechanisms differ. Codex's custom-command system is currently less flexible than Claude Code's.

Unlock Full Claude Code Capability via QCode

Transparent access to Claude from China; all slash commands, custom commands, and plugins work identically to overseas users.

Start Your QCode Plan