> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Best Practices

> How to structure work for Devin to maximize efficiency and ROI

Identifying the right use case for Devin is key to maximizing efficiency and return on investment (ROI). Below are best practices for selecting a use case that aligns with Devin's strengths.

## Best Enterprise Use Cases

| **Ideal Use Case Criteria**                                                                     |
| :---------------------------------------------------------------------------------------------- |
| Large, high-business-value projects that can be broken into **isolated & repetitive subtasks**. |
| Tasks that require **less than 90 minutes** of manual engineering time.                         |
| **Backwards-compatible tasks** that can be independently validated and merged.                  |

## Devin's Ideal Requirements

| **Requirement**                                 |
| :---------------------------------------------- |
| High volume of **repetitive subtasks** (slices) |
| Tasks of **junior engineer-level** complexity   |
| **Isolated & incremental** tasks                |
| **Objective & verifiable** subtasks             |
| **(Recommended)** Minimal project dependencies  |

If your task meets most or all of these requirements, it is an ideal candidate for Devin.

## Crafting Devin's Work

Selecting the right **task type** is crucial for maximizing Devin's reliability.

| **Scenario**                                                             | **Reliability Concern**       | **Task Type**      |
| ------------------------------------------------------------------------ | ----------------------------- | ------------------ |
| Asking Devin to build complex, **net-new features** (even if repetitive) | Lower reliability at scale    | **Tall & Deep**    |
| Assigning Devin **simple, well-defined tasks**                           | Highly reliable and effective | **Wide & Shallow** |

### Tall & Deep vs. Wide & Shallow

<div style={{ width: '100%' }}>
  <img src="https://mintcdn.com/cognitionai/k89q9Lsp7DOurdC0/images/use-cases/narrow-deep-vs-shallow.png?fit=max&auto=format&n=k89q9Lsp7DOurdC0&q=85&s=0cb1923b1f49d4ca184a2a6597b774d7" alt="Narrow-deep vs Shallow-broad comparison" width="50%" style={{ marginLeft: 'auto', marginRight: 'auto' }} data-path="images/use-cases/narrow-deep-vs-shallow.png" />
</div>

A **large backlog** of simple, **horizontally-scalable** tasks (e.g., resolving SonarQube issues) can generate significant **ROI** when scaled across thousands of iterations.

<img src="https://mintcdn.com/cognitionai/k89q9Lsp7DOurdC0/images/use-cases/horizontal-changes.png?fit=max&auto=format&n=k89q9Lsp7DOurdC0&q=85&s=d310cd031634c6747a29948b7009c3b4" alt="Horizontal changes diagram" width="1916" height="322" data-path="images/use-cases/horizontal-changes.png" />

<Note>
  The simpler the slice, the more **reliable** the overall project.
</Note>

## What to Slice

**Great candidates for Devin:**

* **Migrations**
* **Refactors**
* **Modernizations**
* **Technical debt backlogs**

For instance, when working on a **code migration**, it must be broken down into **isolated slices**, each handled by an individual Devin session.

<img src="https://mintcdn.com/cognitionai/k89q9Lsp7DOurdC0/images/use-cases/slicing-use-cases.png?fit=max&auto=format&n=k89q9Lsp7DOurdC0&q=85&s=860e995f8452a2254af67cde2779e8cb" alt="Slicing use cases illustration" width="2000" height="581" data-path="images/use-cases/slicing-use-cases.png" />

## Verification

A slice should be the **smallest atomic unit** of the project.

| **Example Slices** |
| :----------------- |
| **File**           |
| **Notebook**       |
| **Module**         |

| **Requirement**  | **Details**                                                                                                                                                          |
| :--------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Time Limit**   | Each slice must take **under 90 minutes** of manual engineering work.                                                                                                |
| **Verification** | Must include a way to **validate code changes**, such as: <br /> - Running tests <br /> - Building the code <br /> - CI checks <br /> - A custom verification script |

<Warning>
  Devin must have a clear **success/failure** verification mechanism.
</Warning>

<Tip>
  Avoid tasks with excessive **dependencies** or external systems. Devin excels at **coding tasks**.
</Tip>

<img src="https://mintcdn.com/cognitionai/k89q9Lsp7DOurdC0/images/use-cases/backwards-compatibility.png?fit=max&auto=format&n=k89q9Lsp7DOurdC0&q=85&s=f61b10cfb2c001154e5665f97c97f776" alt="Backwards compatibility diagram" width="1746" height="1332" data-path="images/use-cases/backwards-compatibility.png" />

## Parallel Execution

| **Requirement**        | **Description**                                                                               |
| ---------------------- | --------------------------------------------------------------------------------------------- |
| **Isolation**          | Each slice must be **independent** and **backwards-compatible**.                              |
| **Parallel Execution** | Utilize **Devin's parallelism** to execute slices **simultaneously**.                         |
| **Human Review**       | After each slice is completed, it should undergo **human review** before merging into `main`. |

<img src="https://mintcdn.com/cognitionai/k89q9Lsp7DOurdC0/images/use-cases/parallel-execution.png?fit=max&auto=format&n=k89q9Lsp7DOurdC0&q=85&s=037101d29598ed4efcc626e8d8210bd8" alt="Parallel execution visualization" width="2576" height="872" data-path="images/use-cases/parallel-execution.png" />

## Scaling Considerations

<img src="https://mintcdn.com/cognitionai/k89q9Lsp7DOurdC0/images/use-cases/overall-model.png?fit=max&auto=format&n=k89q9Lsp7DOurdC0&q=85&s=8e2d8ed7a06a2ebbeef75591c57d3c3b" alt="Overall model diagram" width="2216" height="1510" data-path="images/use-cases/overall-model.png" />

| **Principle**               | **Description**                                                                            |
| --------------------------- | ------------------------------------------------------------------------------------------ |
| **Slice-Level Reliability** | Devin is optimized for **maximum reliability** at the **individual slice** level.          |
| **Scaling Consideration**   | When scaling across **thousands of slices**, maintaining **high reliability** is critical. |
| **Error Impact**            | Even a small error rate can compound when executing at scale.                              |

## Best Practices for Task Definition

| **Requirement**           | **Description**                                                     |
| ------------------------- | ------------------------------------------------------------------- |
| **Clear step details**    | Provide **explicit instructions** for each slice.                   |
| **End-to-end reference**  | A **detailed guide or video** helps ensure consistency.             |
| **Before/After examples** | Offer multiple **before/after code examples** (input/output pairs). |
| **Dependency access**     | Ensure Devin has **all necessary dependencies** for the task.       |

Devin excels in ongoing **technical debt** tasks (e.g., **PR reviews, QA automation**) when they are properly **sliced and structured**.

<Note>
  Migrations, modernizations, and refactors are strong use cases **if they can be tackled incrementally**.
  For example, a full-repository migration requiring **all changes at once** is **not recommended**.
</Note>

**Case Study:** [Nubank Migration Case Study](https://devin.ai/customers/nubank)
