This topic describes common use cases for custom extension commands, such as code style check, variable naming convention, and API reference generation. This feature expands personalization capabilities for enterprises and simplifies how their developers use AI Chat.
To learn how to create and use a custom extension command, see Manage extensions.
Sample scenarios
Scenario 1: Code style checks
Use case
Traditionally, code is scanned for issues after submission, a slow and costly process. You can check code earlier by providing the AI model with technical and business context, along with custom coding standards. This allows the model to analyze your code and provide immediate feedback. The following example shows a Java code style check for a financial services application.
Command configuration
|
Command name |
code style check |
|
Command name (English) |
my code scan |
|
Icon |
Any icon |
|
Description |
Performs a code style check and outputs the results. |
|
Access control |
Select an option based on your requirements. |
|
Prompt |
|
|
Context configuration |
There are five available context variables: Check the following code in |
Scenario 2: API reference generation
Use case
In distributed systems and service-oriented architectures (SOA), development is API-driven. After developing an API, you must provide an API reference to help consumers quickly integrate and debug their implementation.
Command configuration
|
Command name |
API reference generation |
|
Command name (English) |
generate api docs |
|
Icon |
Any icon |
|
Description |
Generates an API reference for a newly developed API. |
|
Access control |
Select an option based on your requirements. |
|
Prompt |
|
|
Context configuration |
There are five available context variables: Generate an API reference for the following code in |
Scenario 3: Variable naming conventions
Use case
During development, naming variables is a constant task. A descriptive, readable, and compliant variable name is a hallmark of a professional developer and high-quality code. Good naming conventions improve code maintainability, enhance readability, and promote effective team collaboration.
Command configuration
|
Command name |
variable naming convention |
|
Command name (English) |
variable naming assistant |
|
Icon |
Any icon |
|
Description |
Generates suitable variable names based on a user's description that adhere to company and team coding standards. |
|
Access control |
Select an option based on your requirements. |
|
Prompt |
|
|
Context configuration |
Select the userInput variable. Leave the other variables (selectedCode, file, gitCommit, and codeChanges) unselected. Set all context variables as optional. Usage: Run the custom command |
How it works
When you trigger a custom extension command by typing / and the command name, the following process occurs:
-
The context configured for the command, such as a selected code snippet or user input, is captured. The command's prompt and template are then applied.
-
The prompt instructs the model to analyze the context, generating results such as code style suggestions, API references, or variable name recommendations. These results are then returned to you.