GitLab Well Architected
Cookbook navigation
Flows / software-development-flow

Develop iteratively with Duo in your IDE

On this page
Human in the loopSoftware developmentRefactoringReactTestingGitLab 19.5

Investigate a code change, review the plan, and use each implementation's code and tests to direct the next increment.

Type
Foundational flowOfficial guide
ScopeSingle project
Flow schemav1
Technical configuration0 triggers · 6 privileges
TriggersNone
Privilegesread_write_filesread_only_gitlabread_write_gitlabrun_commandsrun_mcp_toolsuse_git

You have a change in mind, and some decisions will become clearer when you see the code. A small first implementation gives you something to inspect: does the approach fit the project, preserve the behavior you care about, and make the next change easier?

GitLab Duo Agent Platform's Software Development Flow lets you investigate a task, review a plan, and implement a change in your editor. Use the result to decide what comes next. You might refine the approach, extend it to another part of the application, or add a test that answers a question raised by the review.

TL;DR

Ask Duo to investigate and propose a first change you can review on its own. Refine the plan before approving, then inspect the code and run the relevant checks. Let what you learn shape the next request, and review the combined result before opening a merge request.

The worked example provides a sample React billing app with duplicated renewal-status logic. You'll try a shared calculation in one component, review it, and then decide how to update the remaining components. Follow it with the supplied runnable files, or apply the same development workflow to a change in your own project.

Get your editor ready

Software Development Flow supports both VS Code and JetBrains IDEs. This walkthrough uses VS Code's menus and controls.

You'll need a project in a GitLab group, Developer access or higher, and the Duo Agent Platform prerequisites, including access to GitLab Credits. This guide targets GitLab 19.5. Check the instance and AI Gateway setup with your administrator if you use Self-Managed or Dedicated.

In VS Code, open the project and install the GitLab extension. Select GitLab in the Activity Bar and follow its sign-in prompts. You can also run GitLab: Authenticate from the Command Palette. The Flow documentation lists supported extension versions.

Use a checkout with a Git remote pointing to that GitLab project. In the checkout's terminal, run:

git remote -v

Confirm that a remote points to the intended GitLab project and that the extension recognizes the project. You can connect your own project to GitLab or create a practice project for the sample billing app. Seeing Default namespace in Duo doesn't confirm a project connection: the Duo namespace determines feature, model, and credit access.

After authenticating, look for the separate GitLab Duo Agent Platform icon in the Activity Bar. If it wasn't visible before signing in, check the Activity Bar again now. Select it to open the Duo panel. If your extension shows a view without tabs, select Use classic layout in the panel's title bar to reveal Flows. GitLab documents the layout switch. If the panel is disabled, check Extensions > GitLab > GitLab Duo in VS Code settings and enable GitLab › Duo Agent Platform: Enabled.

The Flow works in your local workspace using your GitLab identity and can read ignored and untracked files. Open a checkout that contains only material you're permitted to share, following your organization's editor-extension security requirements.

Investigate and choose a first increment

Choose a change whose result you can assess: a bug you can reproduce, a small feature with a clear expected behavior, or a refactor of code you understand. Start on a branch with a clean working tree and run the relevant existing checks so you know the starting state.

Give Duo the goal, relevant files, and behavior that matters. Ask it to explain the current implementation and tests before proposing a change. In GitLab Duo Agent Platform > Flows, enter a request such as this, replacing the bracketed details with your task, then select Start:

I want to [describe the change and expected behavior]. Read [relevant files]
and the tests that cover them. Explain how the current code works and propose
an approach, with a first implementation small enough for me to review on its own.

Identify what that first change would touch, what should stay the same, and
which checks would help me assess it. Present the plan before editing files
or running commands, and wait for me to select Approve plan.

Choose the first increment for what it will help you learn. Trying a helper in one caller can show whether its interface is useful. Implementing one path through a feature can show whether the behavior and tests fit together. The next increment can build on that result.

In the sample billing app, the analysis request asks Duo to investigate three components that calculate the same renewal status. It proposes sharing the calculation and trying it in Summary first. The other two components stay as they are until you've reviewed that approach.

Review the plan before approving

The Flow presents an Approve plan button and a field for requesting refinements. Read the proposal beside the files it names. Check whether it addresses the goal, preserves the behavior that matters, and gives you a first result you can use to judge the approach.

Use the refinement field to resolve a mistaken assumption or narrow an oversized first step. For the sample app, the plan-refinement request brings a plan that changes all three callers back to the shared helper and one component. The point is to see how the helper works in use before extending it.

Agree on the checks for that first change and where Duo should stop. Ask it to finish with the changed files and actual check results, leaving commits, pushes, and merge-request creation for your review. Check Source Control before approving; the investigation should have left the files unchanged.

Implement and inspect the first result

Select Approve plan when the proposed increment fits. Review any command approval requests, let Duo complete the change, then inspect the result in Source Control. Read the changed code in context as well as the diff.

Run the relevant tests and other project checks. Compare their output with the behavior you expected, and inspect the working tree:

git status --short
git --no-pager diff
git --no-pager diff --cached

Open new files separately; git diff doesn't include untracked files. A passing check helps establish that the change works, while reading the code helps you judge whether the approach is one you want to carry forward.

In the billing exercise, this first result is a shared hook used by Summary. The exercise supplies the test and review steps. The remaining duplication gives you a useful decision point: refine the helper or extend it to the other callers.

Let the result shape the next request

Describe what you learned from the first result. If a change is harder to understand than the original, or a check exposes a behavior you wanted to preserve, ask Duo to address that before expanding the work. Make the feedback specific enough that you can recognize a useful correction.

For example, the sample app reads its renewal warning period from configuration. If the new helper captures that value too early, ask Duo to keep reading it when called, and review that correction before updating more components. The billing walkthrough carries this decision through the supplied code.

When the first result fits, use the Flow's message field to request the next increment. Ask Duo to read the current files and propose its next plan. Explain which part of the reviewed approach to reuse and what you want to accomplish next. The sample's continuation request extends the shared helper to the two remaining components.

Review the new plan before selecting Approve plan, then inspect the next implementation and its checks. A new question may call for a focused test or another correction. Continue while each request moves the code toward the intended result; you decide when the work is complete.

If you need to interrupt work, select Stop and inspect any partial changes. Send a new message to continue, asking Duo to read the current files and propose the next step. If a command session becomes unresponsive, finish the checks in your own terminal. Using git --no-pager keeps diff review from waiting for keyboard input.

Review the whole change and hand it off

Compare the cumulative diff with the starting point and the original goal. Check that the increments work together, that the tests cover the behavior you intended, and that unrelated changes haven't crept in. Run the complete relevant checks, including your project's existing security scans where they apply.

When you're satisfied, commit the reviewed work, push the branch, and open a merge request explaining the result and the checks that ran. Your team's normal review and approval process still decides whether to merge.

To practice the workflow, follow the sample billing app exercise. It includes the project files, prompts, and checks for each increment. After completing it, the optional exercises provide further practice with incomplete context and misleading repository text.

Flow files

Select a file to preview it here, or open the viewer for a larger copyable version.

Download example
Files17
  • evals14
    • fixtures13
      • project12
        • app5
          • components3
            • billing3
        • tests1
      • requests1
    • templates1
  • examples3
examples/analyze-renewal-logic.txttext · 26 lines
I'm refactoring the billing renewal display. Investigate these files:
- app/components/billing/Summary.tsx
- app/components/billing/PlanRow.tsx
- app/components/billing/RenewalNotice.tsx
- app/billingConfig.ts
- tests/billing.test.tsx

Explain the common renewal-date calculation, how the configured warning period
affects it, and what the tests protect. Outline an approach to sharing the logic.

For the first implementation increment, extract useRenewalStatus() and use it
only in Summary.tsx. Leave PlanRow.tsx and RenewalNotice.tsx for a later request
so I can review the approach in one component first.

Present the plan before editing or running commands. Wait for me to select
Approve plan. After I approve, implement only that first increment and run:
  npm run test -- billing
  npm run lint
Review the diff with git status --short, git --no-pager diff, and
git --no-pager diff --cached; open the new hook separately if it is untracked.
Finish with the change and check results so I can decide the next step.

Keep the existing props, rendered output, UTC handling, and configurable warning
period. Preserve existing test assertions. Leave charge calculation, config,
dependencies, CI, and unrelated files alone. Don't commit, push, or create an MR.

Source file

File