Lesson
Automate Tasks in Claude Code with Slash Commands
Concatenate large code areas with repomix and turn long CLI invocations into reusable slash commands you can run from chat.
- Access
- Included
- Transcript
- Needs source
Automating Claude Code tasks starts with reusable commands. Use repomix to bundle big context, then wrap it in a slash command so the workflow runs with a single trigger.
Ad-hoc: run repomix from chat
! repomix --include "src" --stdout --output-show-line-numbers
Follow with a prompt:
Given the bundled code above, outline the module boundaries and list obvious seams for refactoring.
Make it reusable: a custom slash command
Create .claude/commands/repomix.md:
---
allowed-tools: Bash(repomix:*)
argument-hint: [glob pattern] [user prompt]
---
!`repomix --include "$1" --stdout --output-show-line-numbers`
Use it:
/repomix src "Summarize the codebase and propose a dependency graph."
Why this pattern works
- Abstraction: Hide flags and syntax you’ll forget.
- Speed: One command, big context.
- Consistency: Teammates can reuse your command, too.