| .github/workflows | ||
| .idea | ||
| .intellijPlatform | ||
| .run | ||
| gradle/wrapper | ||
| img | ||
| src/main | ||
| .gitignore | ||
| build.gradle.kts | ||
| build.sh | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| README.md | ||
| settings.gradle.kts | ||
AI Code Improver
An IntelliJ IDEA plugin that leverages AI to improve your code. Select code, provide instructions, and let AI enhance it with useful comments, optimizations, and more.
Features
- AI-Powered Code Improvement: Use local AI models via LMStudio to enhance selected code
- Customizable Prompts: Configure system prompts and temperature settings
- Interactive Diff View: Review changes before applying them
- Regeneration Support: Reject and regenerate improvements with feedback
- Easy Integration: Right-click context menu and keyboard shortcut
Prerequisites
- JetBrains IDE (IntelliJ IDEA, PhpStorm, PyCharm, WebStorm, etc.) version 2025.1 or later
- LMStudio running locally with a compatible model loaded
- Java 21+
Compatibility
This plugin works with all JetBrains IDEs based on the IntelliJ Platform 2025.1 or later, including:
- IntelliJ IDEA
- PhpStorm
- PyCharm
- WebStorm
- CLion
- GoLand
- And other JetBrains IDEs
Building from Source
If you want to build the plugin yourself:
Prerequisites
- Java 21 or later - Required for compilation
- Git - For cloning the repository
Installing Java
Ubuntu/Debian:
sudo apt update
sudo apt install openjdk-21-jdk
Arch Linux:
sudo pacman -S jdk-openjdk
macOS:
brew install openjdk@21
Windows: Download and install from Adoptium or Oracle
Build Steps
-
Clone this repository:
git clone https://github.com/CatInBeard/IntelijAiCodeImproverPlugin.git cd intelij-ai-code-imporver-template -
Run the build script:
./build.shOr manually:
./gradlew build -
The plugin JAR will be created in
build/libs/
The build script will check for prerequisites and provide helpful error messages if Java is not installed.
Continuous Integration
The project includes GitHub Actions CI/CD that automatically builds the plugin on every push to the master branch. You can download the latest build artifacts from the Actions tab in the repository.
Installation
- Download the plugin JAR from the releases page or build it from source
- In your JetBrains IDE, go to
File > Settings > Plugins - Click the gear icon and select
Install Plugin from Disk... - Select the downloaded or built JAR file
- Restart your IDE
Configuration
After installation, configure the plugin settings:
- Go to
File > Settings > Tools > AI Code Improver
Configure the following:
- LMStudio URL: Default is
http://localhost:1234/api/v0 - System Prompt: Instructions for how the AI should behave
- Model: Select from available models in LMStudio
- Temperature: Controls randomness (0.0 = deterministic, 1.0+ = creative)
Usage
Basic Usage
- Select code in the editor
- Right-click and choose
AI Improvefrom the context menu
- Enter your improvement instructions
- Review the AI-generated improvements in the diff view
- Choose to apply, reject, or regenerate with feedback
Keyboard Shortcut
Use Ctrl+Alt+I to quickly access the AI improvement feature on selected code.
Regeneration
If you're not satisfied with the result, you can reject and provide feedback for regeneration:
How It Works
The plugin communicates with your local LMStudio instance to:
- Send the selected code and your instructions
- Receive AI-generated improvements
- Display changes in IntelliJ's built-in diff viewer
- Allow you to apply changes directly to your code
Troubleshooting
- Connection Issues: Ensure LMStudio is running and accessible at the configured URL
- No Models Available: Make sure you have downloaded and loaded models in LMStudio
- Plugin Not Loading: Check that you're using a compatible IntelliJ IDEA version
Contributing
Contributions are welcome! Please feel free to submit issues and pull requests.
License
This project is licensed under the MIT License - see the LICENSE file for details.




