Overview
Have Devin build a website with several calculators, then use Ask Devin to plan a refactor that removes duplicated code, and carry it out in small sessions that each end in a draft pull request you review.
Problem or Objective
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Devin
- Prerequisites
- A Devin account (Individual and Teams plans are available; if your company already works with Cognition, request access from your administrator or Cognition) connected to the repository, and a test suite with worked examples.
How It Works
Start with a short spec for the site: the list of calculators, the inputs and formulas for each, and a few worked examples with known answers. Ask Devin to build the first two calculators with tests based on those examples, and review its draft pull request before asking for the rest. When the site has all its calculators and the code has grown, use Ask Devin to search the codebase and outline a refactor: shared input components, one formula module per calculator, a single layout, and removal of unused files and dependencies. Turn the outline into a numbered list of small tasks, each with a clear end and a success check such as all tests passing and the bundle or line count reported before and after. Run one Devin session per task, or a few in parallel when they touch different files. Review each draft pull request, run the calculators in the browser yourself, and merge only when the outputs still match your worked examples.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Devin.
- Connect the toolsConnect the tools this workflow relies on: Devin.
- Check the prerequisitesA Devin account (Individual and Teams plans are available; if your company already works with Cognition, request access from your administrator or Cognition) connected to the repository, and a test suite with worked examples.
- Gather your detailsCollect what the prompt asks for: Repository name, File with worked examples, How to measure size.
- Run the starter promptPaste the starter prompt below into Devin and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at docs.devin.ai before you rely on it.
Practical Starter Prompt: Plan a refactor of the calculator site
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Search the [Repository name] codebase and outline a refactor that reduces duplicated code across the calculators without changing any results. Look for repeated input handling, repeated layouts, unused files and unused dependencies. Propose a numbered list of small tasks, each touching as few files as possible, with a success check for each: all tests pass, the worked examples in [File with worked examples] still give the same answers, and the [How to measure size] before and after is reported. Do not change formulas. Each task should end in a draft pull request for my review; nothing is merged without my approval.Approve the task list first, review and test each draft pull request in the browser, and merge only when every worked example still matches.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. Devin's documentation lists code migrations and refactors among its tasks, says it returns draft pull requests for review and has a browser to test the web apps it builds, and advises splitting large projects into focused sessions with explicit success criteria such as passing tests. No page predicts how much code a refactor will remove; measure the size before and after yourself.
Limitations and Considerations
Calculators are only as good as their formulas, so keep a set of worked examples as tests and rerun them after every refactor step. Removing code can break pages that tests do not cover, so click through every calculator before merging. Devin sessions draw on your plan's usage, so check costs before running several in parallel. Check that each pull request removes code rather than moving it, by comparing the size figures you asked for. Results depend on your setup and were not independently reproduced by Top 200 Repos.
Sources
- Introducing Devin - Devin Docs (opens in a new tab)
Project documentation · docs.devin.ai · Undated · Source checked 26 Nov 2026, 17:27 UTC
What this source supports
- Devin is an autonomous AI software engineer that can write, run and test code.
- Code migrations, refactors, and modernization
- Carving out tasks from your todo list at the start of your day and returning to draft PRs waiting for review.
- Watch Devin browse through documentation, test web applications it builds, download/upload information, and more.
- When to Use Devin - Devin Docs (opens in a new tab)
Project documentation · docs.devin.ai · Undated · Source checked 26 Nov 2026, 17:27 UTC
What this source supports
- For very large projects, split the work into focused sessions that build on each other.
- Good tasks have a clear start and end, plus explicit success criteria (e.g., passing tests, matching an existing pattern, CI green)
- For complex tasks, use Ask Devin to collaboratively scope the work before starting a session.