Skip to main content

Quick Command IDE Examples

Example 1. Create a Translation Quick Command

I want to select a line of code in Portuguese and translate it to English.

Step 1. Access the StackSpot AI Portal. On the left side menu, click ‘Quick Command’

Step 2. Click on the ‘Create Quick Command IDE’ button

Step 3. Click ‘Start’ and then click the Prompt option. Fill out the fields:

  • Prompt name: translate-eng
  • Insert your prompt: Translate the following extract (do not explain, do not add examples, only translate to English). Add:
{{selected_code}}

Don’t select ‘Use the current stack to generate code’. You want a text translation.

  • Click ‘End’

Step 4. On the Quick Command utilization section, choose:

  • Replace the selected code: This option shows how the users will see/interact with the Quick command.
  • Final result: The result of the prompt you just added. Select: translate-eng. Then add .answer. Just like the example below:
{{translate-to-en.answer}}

Step 5. Click ‘Finish flow’.

Step 6. Access your IDE and test it: Select a text in English Right-click with your mouse, then choose StackSpot AI > My quick commands > Translate


Example 2. Create a GitHub Issue Quick Command

Follow the steps to create a Quick Command that opens a GitHub issue.

Step 1. Access the StackSpot AI Portal. On the left side menu, click ‘Quick Command’

Step 2. Click on the ‘Create Quick Command IDE’ button

Step 3. Click on the Prompt option and insert the following:

  • Prompt name: codereview

  • Insert your prompt: I want you to act as a senior software engineering leader with rich experience in leading and mentoring teams of software engineers for decades. You will respond in a direct, helpful, concise, and non-repetitive manner. You will be shown the source code I have written, which I want you to comment on based on both software engineering best practices (such as SOLID principles, clean code, and everything similarly well-known) and our policy that I will provide you. Return the answer in the "GitHub-issue" format. In bullets, the body field must be filled in with the response in Markdown format that is compatible with the GitHub issue format. The title field must be filled in with an objective response summary. The labels field must have the value "bug".

  • Code:

{{selected_code}}

Step 4. Click ‘Web Request’ and fill out the fields:

{
"Accept": "application/vnd.github+json",
"Authorization": "Bearer <ADD_YOUR_TOKEN>",
"X-GitHub-Api-Version": "2022-11-28"
}
  • Body: The body gets the code review prompt answer you added before and replaces JSON using Jinja to perform actions:
{{ codereview.answer | replace("json","") | replace("```","")}}

Step 5. Click ‘End > Finish Flow.’ Add the code below in the final result step. This code is to add the GitHub’s issue URL:

Return type: CHAT
Issue created on github!
{{github-issue.json.html_url}}

Step 6. Access your IDE and test it:

  • Choose a code you want to open a GitHub issue
  • Right-click with your mouse, then choose StackSpot AI > My quick commands > GitHub Issue

Learn more