Use a template to set up Jira Coding Agent automations
Jira Coding Agent in automations works best when you use it on repeatable tasks.
To help you get started quickly, Jira includes templates based on how Atlassian teams use Jira Coding Agent to handle common, repetitive work.
Get started
Choose an automation template
Start with a template, then adjust the trigger, conditions, and prompt so the flow fits your team’s workflow.
To use a template:
In your Jira space, select More actions () next to your space name, then select Space settings.
In the sidebar, select Automation, then navigate to the Templates tab.
Find the Coding agents section.
Select the template to create a flow based on it.
Review the flow details, trigger, condition, and action. Update them as needed.
Select Turn on flow when you’re ready.
Example of a feature flag removal automation template
Here’s an example of how you can use the feature flag removal automation template that uses the Use Jira Coding Agent action.
This automation detects work items that require flag cleanup and applies code changes based on the work item description or a custom prompt. It then opens a draft pull request for review so teams can remove stale feature flags faster with less manual effort.
Part 1: Set up an automation flow based on the template
From the automation templates list select the feature flag removal template.
Review the flow details and update as required.
Select and review the the Work item updated trigger. It has a condition to trigger when a new label called
feature-flag-cleanupis added to the work item.Select the Use Jira Coding Agent action to review the repository settings.
Select a connected repository from the list, or select Infer repository from work item if you will add repository details to your work item descriptions.
Provide a prompt to include additional context or instructions alongside the work item's description. Find an example prompt in the next section.
Select the Code settings icon () next to the Repository field, to specify the branch name, source branch, and other branch options.
Optionally, add another action to add a comment to the work item so that teams get notified when the automation runs and the Jira Coding Agent has finished work.
Save the flow.
Example prompt
This is an example prompt only. You can use it as a starting point and then tailor your own prompt to suit your specific scenario and requirements.
You are a senior software engineer asked to help write code to
clean up a stale feature gate from a code repository.
You implement code, you don’t guide users, you actually implement the code using the “Use Jira coding agent” action.
You MUST Complete below tasks in the following order. You’re authorized to perform the below steps without additional confirmation.
1. Extract feature gate name {gate_name} from Jira ticket title or the field "Feature gate name"
2. Extract the final behaviour {final_gate_value} from "Feature gate Default value" in the Jira ticket description. If it is not provided in the description, infer the default value from the code.
3. Extract the repository {repository_url} from the desired repository
4. Start the feature gate clean up process using the following instructions
<TASK_SUMMARY_TEMPLATE>
For the following code repository: {repository_url}
The feature gate we need to clean up is called: {gate_name}
It now always serves the value {final_gate_value}, meaning this feature is now permanent and should be integrated into the main code path.
Feature Gate Definition Cleanup:
- Remove the feature gate constant/variable definition
- Follow imports/references to find all usage of this feature gate including both production code and test files
- Remove the feature gate from configuration files (e.g., docker-compose, properties)
Feature Gate Usage Cleanup:
For conditional blocks checking this feature gate:
Keep only the {final_gate_value} path code
Remove the conditional wrapper and else blocks entirely
For if/else blocks using the feature gate:
Replace the entire if/else with just the {final_gate_value} code path
Remove any variable assignments that only serve the conditional
When removing feature gate parameters:
Remove the parameter from method/constructor signatures
Find and update ALL calling code by following imports and references
When modifying a class:
Remove the parameter from the constructor
Remove any code blocks using the parameter
Update all class methods and properties that depend on the removed parameter
Update all code that depends on the class’s interface
For test files:
Remove tests that only verify feature gate behavior
Remove ALL feature gate mocking/setup code
Convert parameterized tests that only vary by this gate into regular tests using the {final_gate_value} behavior
Remove the feature gate parameter from test method signatures
Code Quality Guidelines:
Maintain consistent code formatting after removals
Preserve any necessary comments/documentation that aren’t specific to the feature gate
Keep error handling and logging that isn’t specific to feature gate checks
Ensure method signatures remain compatible with their interfaces after parameter removal
Speed Optimisations
If you are trying to search for text in the codebase using a bash tool, I would use “git grep” over “find . -type f -exec grep” because it much faster
The goal is to make the {final_gate_value} behavior permanent by integrating it directly into the code rather than just changing the gate’s default value.
</TASK_SUMMARY_TEMPLATE>Part 2: Create a work item and trigger the automation
Create a work item in your Jira space to clean up a feature flag.
In the work items details, provide the following details:
The feature flag key.
The repository that the Jira Coding Agent should work on. The Jira Coding Agent will use the associated repository if you’ve chosen the Infer repository from work item option.
The final value of the feature flag after rollout.
Add the
feature-flag-cleanuplabel to the work item, so that the Jira Coding Agent can identify the repetitive task and start working on it. Make sure the label matches exactly to what you’ve set in the automation flow.
Once you create the work item, the automation will trigger the flow immediately and create a draft pull request in your repository.
Step 3: Review and merge the pull request created by the Jira Coding Agent
When the flow runs, the Jira Coding Agent makes code changes on a branch and creates a draft pull request in the repository you provided. You can review the pull request directly in the repository, or open the Jira work item and use the repository link under:
the Development section in the Details panel
the Agents section
The Agents section displays all agentic sessions related to that work item, including sessions owned and managed by other users. The connection owner’s Rovo credits are used when the flow runs.
What are connections in Automation?
Find the Jira Coding Agent for sessions you own to review the changes, make any edits you need, then approve and merge the pull request when you’re ready.
Was this helpful?