This topic covers the common use cases for custom extension commands, like code style checks, variable naming conventions, and automatic API reference generation. This makes it easier for developers to leverage AI Chat to meet their personalized needs.
Sample scenarios
Scenario 1: Code style checks
Scenario
In the past, code was checked for problems after it was submitted, which was a slow and costly process. Now, you can check code based on the model technical and business contexts, along with your code style and guidelines. Here is an example of checking Java code in a financial business scenario.
Command configuration
The following table lists the details of a command.
Command name | Code style checks |
Icon | Any icon |
Description | The command checks the code style and returns the results. |
Access control | Set the access control based on your business requirements. |
Prompt |
|
Context configuration | Check the code in |
Effect
After you save and turn on the command in the console, you can use it in the plugin. Type the command and Lingma will check your code.
Scenario 2: API reference generation
Scenario
API development is essential in distributed systems and Service-Oriented Architectures (SOAs) where frontend and backend services work separately. Once API development is complete, clear API documentation will help users quickly develop APIs for system integration.
Command configuration
The following table lists the details of a command.
Command name | API reference generation |
Icon | Any icon |
Description | The command generates API references after API development is complete. |
Access control | Set the access control based on your business requirements. |
Prompt |
|
Context configuration | Generate an API reference in Markdown format based on |
Effect
After you save and turn on the command in the console, you can use it in the plugin. Type the command and Lingma will generate API references.
Scenario 3: Variable naming conventions
Scenario
During daily development, it is important to use good variable names. A clear and simple variable name that follows the convention shows the developer's skill and the code quality. Good names make code easier to read and maintain, and facilitate team collaboration.
Command configuration
The following table lists the details of a command.
Command name | Variable naming conventions |
Icon | Any icon |
Description | The command generates a variable name that follows both company and team coding rules, based on the user's business requirements. |
Access control | Set the access control based on your business requirements. |
Prompt |
|
Context configuration | Use the |
Effect
After you save and turn on the command in the console, you can use it in the plugin. Type the command and Lingma will generate variable names.
How to run a command
To run a command, type a leading slash (/)
and select the desired code. Here's how a command runs:
Get the selected code, place it in the context environment, then choose a template and prompt based on the command type.
Use the prompt to ask the model to check code and perform an inference.
The model will then generate code suggestions, API references, or variable naming suggestions that fit the rule, and send the results back to you.
For more information on how to create and use custom extension commands, see Extensions management.