Unlocking Coding Excellence with CodiumAI's /improve Command

Elevate your code quality effortlessly using the power of CodiumAI's "/improve" command. This groundbreaking tool analyzes your PR code changes and provides actionable suggestions to enhance your codebase, leading to refined, efficient, and cleaner code.

Exploring the /improve Command

The "/improve" tool is your gateway to AI-generated suggestions aimed at refining your PR code changes. Whether you seek automated improvements or deeper insights, this command offers flexible modes tailored to your project's specific needs.

Automatic Suggestions:

Invoke the tool with a simple command:


Receive automated suggestions addressing code enhancements directly on your PR.


The Output Structure

The /improve command in PR-Agent generates output with suggestions for improving the PR code changes. The output structure consists of suggestions presented in a clear and informative manner. Let's break down the typical structure of the output:

  • Suggestion Format: Each suggestion is presented in a structured format, starting with the type of suggestion or improvement.
  • Component Information: The suggestion includes details about the specific code component that needs improvement. This could be a function, method, class, or other relevant code entity.
  • Suggested Improvement: The output provides a detailed suggestion for improving the identified code component. This may include recommendations for restructuring, optimizing, or enhancing the code.
  • Contextual Information: Contextual information about why the improvement is suggested or how it can positively impact the codebase is often included. This helps developers understand the rationale behind the suggested changes.
  • Code Diff: The output typically includes a snippet of the code diff, highlighting the specific changes recommended for the identified code component. This makes it easy for developers to visualize the suggested modifications.
  • Extended Mode (Optional): In extended mode, the output may be divided into chunks, especially for large PRs. Each chunk is handled separately, providing more comprehensive suggestions.
  • Ranking (Optional) If enabled, suggestions may be ranked based on their importance. This ranking helps developers prioritize and focus on the most critical improvements.
  • Improved Code (Optional): In some cases, the output may include an improved code implementation corresponding to the suggestion. This can serve as an example or reference for implementing the suggested changes.
  • Additional Parameters (Optional): Depending on the configuration, additional parameters may be provided, such as the number of suggestions per chunk, the maximum number of chunks, and a final clip factor.

Extended Mode for Comprehensive Suggestions:

For a more comprehensive review of larger PRs, use extended mode:

/improve --extended

This mode segments large PRs and generates proportionate suggestions, ensuring comprehensive coverage and addressing token limits.


Configurable Enhancements

Tailor the suggestions to meet your project's requirements with customizable configuration options:

General Options:

  • num_code_suggestions: This parameter determines the number of suggestions provided by the tool.
  • extra_instructions: Provide explicit guidance to the AI model for targeted suggestions.
  • rank_suggestions: When enabled, this option ranks suggestions based on their importance.
  • include_improved_code: Decide whether to include improved code implementations in suggestions.

Parameters for Extended Mode

The /review command in CodiumAI PR-Agent covers essential aspects of PR assessments, including:

  • auto_extended_mode: This parameter automatically enables the extended mode.
  • num_code_suggestions_per_chunk: Specify the number of suggestions per chunk in extended mode.
  • rank_extended_suggestions: Enables ranking for extended mode suggestions.
  • max_number_of_calls: Set the maximum number of chunks.
  • final_clip_factor: This factor removes suggestions with low confidence.

Summarize Mode for Compact Reviews


Automating the /review Command

Streamline your PR footprint with the summarize mode:

/improve --pr_code_suggestions.summarize=true

This mode condenses multiple suggestions into a single compact comment, significantly reducing the PR footprint.

Maximizing AI Suggestions for Optimal Code Quality

While AI-driven suggestions aim to elevate your code, it's crucial to exercise judgment and discretion:

  • Understanding Suggestions: Suggestions aim to provoke thoughts, questions, and ideas, not act as definite solutions.
  • Leveraging Extra Instructions: Use the "extra_instructions" field to guide the AI model towards specific areas of focus within your project.

In Conclusion

Codium AI's "/improve" command is your coding companion, revolutionizing code refinement and enabling efficient PR reviews. Empower your team with AI-driven suggestions tailored to uplift your codebase, one suggestion at a time.

Unlock the potential of your code. Embrace the power of "/improve" today!

Frequently Asked Questions

  • How reliable are the suggestions generated by the "/improve" command?

    While suggestions aim for depth, they may not always be flawless. Exercise discretion and use "extra_instructions" to guide the AI towards relevant suggestions for your project.

  • Can I reduce PR clutter caused by multiple suggestions?

    Use the summarize mode to amalgamate suggestions into a single comment, reducing PR footprint significantly.

  • What is the benefit of the extended mode in "/improve"?

    The extended mode segments large PRs, ensuring more thorough reviews and proportional suggestions.

  • How can I direct the AI model for more relevant suggestions?

    Craft specific and concise directives using the "extra_instructions" field to guide the AI toward your project's specific needs.

Have More Questions?