The /optimize skill
/optimize is the primary command. It spawns a background optimizer agent that runs the codeflash CLI on your code.
Syntax
Examples
| Command | Effect |
|---|---|
/optimize | Let codeflash detect changed files automatically |
/optimize src/utils.py | Optimize all functions in src/utils.py |
/optimize src/utils.py my_function | Optimize only my_function in that file |
/optimize --all | Optimize the entire project |
/optimize src/utils.py my_function
What happens behind the scenes
- The skill (defined in
skills/optimize/SKILL.md) forks context and spawns the optimizer agent - The agent locates your project config (
pyproject.tomlorpackage.jsonorcodeflash.toml) - It verifies the codeflash CLI is installed and the project is configured
- It runs
codeflash --subagentas a background task with a 10-minute timeout - You’re notified when optimization completes with results
The /codeflash:setup command
/codeflash:setup configures auto-permissions so codeflash runs without prompting.
What it does
- Finds
.claude/settings.jsonin your project root - Checks if
Bash(*codeflash*)is already inpermissions.allow - If not, adds it (creating the file and directory if needed)
- Preserves any existing settings
Running
/codeflash:setup multiple times is safe — it’s idempotent. If permissions are already configured, it reports “No changes needed.”