Add explanatory summary comments to every file in a codebase
A developer used Cursor's Background Agent with Claude 4 Opus to go through the codebase and add file-top notes on purpose, references, and possible refactors. ·
- What they did
- The developer ran Cursor’s Background Agent with Claude 4 Opus in Max Mode on their repository and pointed it at a prd.md file first so it had the app’s product context. The agent then went through the codebase file by file and inserted one comment block at the top of each file explaining what it does, why it exists, how it works, what it references, possible refactors, and security considerations, with repeated instructions not to change any code; the human merged the separate background instance’s work afterward.
- How it went
- The result was that every file got an executive-summary-style header, which the poster said helped them understand the codebase and architecture better, gave Cursor more context, and would help a future engineer ramp up faster. No quantitative results or failures were given.
- Worth knowing
- The main catch mentioned was cost: a commenter called it a very expensive prompt, and the poster noted the background agent worked in a separate instance that you merge in when it finishes.
Try it yourself with Cursor
Go through every source file in [repo or folder] and add a short comment block at the top of each file covering its purpose, which other files or modules it references or is used by, and any refactors you'd suggest. Do not change any code logic, only add comments, using the comment style for each language. When every file is done, open a pull request for me to review and summarize which files you skipped, such as generated or vendored ones.
Want help getting this working? Join the Vibe Coding Academy ↗ Run by Alex Finn, who also runs this site.
Source: Reddit · Jun 27, 2025
Related use cases
Build a C compiler with a team of parallel agents
Anthropic's engineering write-up on tasking Opus 4.6 agent teams with building a C compiler.
Build a project management tool with a 24-hour agent run
Ran a Cursor agent continuously for 24 hours to build a project management tool; the app fully works but is not production ready.
Extract automation requirements from meeting transcripts
An autonomous coding agent with n8n tooling feeds a meeting transcript into Claude to extract automation requirements and help produce production-ready workflows.
Turn tickets into merged pull requests
Pulls tasks from GitHub Issues or Linear, then runs Claude Code or Codex in isolated Kubernetes pods to carry each one through to a PR.
Hand off coding sessions between agent accounts at usage limits
A developer built an app that tracks usage across multiple Codex and Claude Code accounts and auto-hands-off conversations when one hits its limit.
Refactor a legacy jQuery plugin and fix its bugs
Devin refactored a 2017 jQuery plugin, fixed a popup-not-closing bug and added a debug mode, producing two accepted PRs, though its first code left console.logs in.
Get 5 like this every morning
The best things people got an AI agent to do, each with the prompt to try it.