A minimal Claude Code plugin that runs Codeflash as a background agent to optimize Python, Java, JavaScript, and TypeScript code for performance.
- Claude Code v2.1.38 or later
- Python projects: codeflash installed in a virtual environment, configured via
[tool.codeflash]inpyproject.toml - Java projects: codeflash installed (
pip install codeflash), configured via[tool.codeflash]incodeflash.toml - JS/TS projects: codeflash installed as a dev dependency (
npm install --save-dev codeflash), configured via a"codeflash"key inpackage.json
Add the plugin marketplace and install:
/plugin marketplace add codeflash-ai/codeflash-cc-plugin
/plugin install codeflashgit clone https://github.com/codeflash-ai/codeflash-cc-plugin.git
/plugin marketplace add ./codeflash-cc-plugin
/plugin install codeflashBy default, plugins are installed at the user level (available across all projects). You can change this:
/plugin install codeflash --scope project # shared with team via .claude/settings.json
/plugin install codeflash --scope local # this project only, gitignoredRun /plugin to open the plugin manager and confirm codeflash appears under the Installed tab.
/optimize src/utils.py
/optimize src/main/java/com/example/Fibonacci.java
/optimize src/utils.py my_function
/optimize src/main/java/com/example/Fibonacci.java fibonacci
/optimize --all
/optimize src/utils.py --no-pr # Skip PR creation
/optimize src/utils.py --effort high # Set optimization effort level
When you make a git commit that includes Python, Java, JavaScript, or TypeScript file changes, the plugin suggests running /optimize on those files.
codeflash-cc-plugin/
├── .claude-plugin/
│ ├── marketplace.json # Marketplace manifest
│ └── plugin.json # Plugin manifest
├── agents/
│ └── optimizer.md # Background optimization agent
├── commands/
│ └── setup.md # /setup command for auto-allow permissions
├── hooks/
│ └── hooks.json # Stop hook for commit detection
├── scripts/
│ ├── find-venv.sh # Shared helper: find and activate a Python venv
│ └── suggest-optimize.sh # Detects Python/Java/JS/TS changes, suggests /optimize
├── skills/
│ └── optimize/
│ └── SKILL.md # /optimize slash command
└── README.md
The plugin is a thin wrapper around the codeflash CLI:
/optimizespawns a background optimizer agent- Verifies codeflash is installed (
pip install codeflashfor Python/Java,npm install --save-dev codeflashfor JS/TS) and configured - Runs the
codeflashCLI with the appropriate flags - Reports results (optimizations found, PRs created)
Codeflash handles everything else: analysis, benchmarking, test generation, and PR creation.
| Language | Config File | Project Markers |
|---|---|---|
| Python | pyproject.toml |
pyproject.toml, setup.py |
| Java | codeflash.toml |
pom.xml, build.gradle |
| JavaScript | package.json |
package.json |
| TypeScript | package.json |
package.json, tsconfig.json |