Overview
Have Claude Code read a long-untouched Node backend, record its conventions, add Vitest tests on a branch and change source code only for failures you agree are real.
Problem or Objective
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code · Vitest · Node.js
- Prerequisites
- Claude Code, Node and a copy of the repository. The Vitest README states that Vitest requires Vite >=v6.4.0 and Node >=v22.12.0. Check what your plan allows.
How It Works
Create a branch, install the project as it is and check that your Node and Vite versions meet what Vitest requires. Write down how to install, run and test the project in AGENTS.md or CLAUDE.md; the overview says Claude Code can read an existing AGENTS.md in place of a CLAUDE.md. Ask Claude Code to map the modules and propose which behaviour to cover first, and approve that plan. Let it add Vitest and write tests in small groups, running them as it goes. For each failure, have it say whether the test or the code appears wrong, with evidence. Approve source fixes one at a time, keep test and fix changes separate, and read the diff before you commit.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code, Vitest, Node.js.
- Check the prerequisitesClaude Code, Node and a copy of the repository. The Vitest README states that Vitest requires Vite >=v6.4.0 and Node >=v22.12.0. Check what your plan allows.
- Gather your detailsCollect what the prompt asks for: How long it has been idle, Project instructions file, Area to cover first.
- Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.
Practical Starter Prompt: Add Vitest tests to an old backend
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
This Node backend has not been touched for [How long it has been idle]. Read [Project instructions file] and the code without changing anything, then propose a test plan starting with [Area to cover first] and list version or dependency problems. Wait for my approval. Then add Vitest and write tests in small groups, running them each time. Do not change source code without asking: for each failure say whether the test or the code looks wrong. Never connect to production, commit or push without my approval.Approve the plan, then approve each source fix and the final commit after reading the diff.
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. The overview names writing tests for untested code among the work Claude Code handles, and the Vitest README describes the testing framework and its version requirement. Neither says anything about your backend or what coverage you will reach. Top 200 Repos did not run this.
Limitations and Considerations
An old project may have outdated or vulnerable packages and a Node version that the test tool no longer supports, so upgrade deliberately and separately. Tests written from existing code can lock in bugs: check expected values against what the software is meant to do. Point tests at fakes or a disposable database, never production services, and keep real credentials out of the test environment. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Tool Repository
A tool this workflow relies on.
Official Website
The official site of the main tool or project in this use case.
Visit Website (opens in a new tab)code.claude.com
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Overview - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- Claude Code handles the tedious tasks that eat up your day: writing tests for untested code, fixing lint errors across a project, resolving merge conflicts, updating dependencies, and writing release notes.
- If your repository already has an AGENTS.md for other coding agents, Claude Code can read that in place of a CLAUDE.md.
- Claude Code is an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools.
- vitest-dev/vitest README (opens in a new tab)
Project documentation · github.com · Undated · Source checked 2 Dec 2026, 13:21 UTC
What this source supports
- Next generation testing framework powered by Vite.
- Vitest requires Vite >=v6.4.0 and Node >=v22.12.0

