LLM Prompts I Run to Continuously Improve My Codebase

Published: (December 13, 2025 at 01:41 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Cover image for LLM Prompts I Run to Continuously Improve My Codebase

Instead of asking LLMs to generate large chunks of code, I use them as codebase janitors: small, focused tasks that run often and compound over time.

Below are copy‑pasteable prompts I regularly use.

Prompts

1. Remove Dead Code

Find unused files, functions, exports, imports, and variables.  
Explain why each is safe to remove and note any risk.

2. Improve Naming

Rename variables, functions, and classes to better reflect intent.  
Optimize for clarity and readability, not brevity.

3. Reduce Cyclomatic Complexity

Identify overly complex functions and simplify logic.  
Prefer early returns, smaller functions, and clearer control flow.

4. Close Coverage Gaps

Scan test coverage output.  
Find uncovered lines and write focused unit tests that validate behavior.

5. Document the Why

Add documentation explaining *why* this code exists and what tradeoffs were made.  
Do not describe what the code does line‑by‑line.

6. Identify Responsibility Leaks

Find functions or components doing more than one job.  
Suggest how to split responsibilities cleanly.

7. Improve Error Handling

Review error handling paths.  
Ensure errors are meaningful, actionable, and consistently handled.

8. Normalize Patterns

Identify inconsistent patterns (naming, structure, async handling).  
Recommend a single, consistent approach.

9. Flag Hidden Coupling

Detect tight coupling between modules or layers.  
Suggest abstractions or boundaries to reduce blast radius.

10. Improve Readability Without Refactors

Improve formatting, ordering, and small structure changes only.  
No architectural rewrites.

Why This Works

These prompts are:

  • Small
  • Repeatable
  • Low risk
  • High leverage

This turns LLMs into continuous improvement agents, not code generators.

A Note on Code Review

When generating changes like this, commit frequently and keep each change small. This makes reviews easier, limits blast radius, and ensures you can always roll back to a known‑good state if something goes wrong.

Agents with GitHub

GitHub is moving in this exact direction—surfacing agent‑based workflows directly from their homepage and integrating them across issues, PRs, and code review.

Code Acceleration

The pace of development is accelerating. To keep up, we need to reduce friction wherever possible. As the volume of code we write and review skyrockets, readability becomes non‑negotiable—and these prompts help reinforce it.

Back to Blog

Related posts

Read more »