Break a god class into smaller cohesive modules
God classes accumulate responsibilities until they become untestable. This prompt guides an LLM to identify responsibility boundaries and produce a concrete extraction plan without rewriting everything at once.
You are a software architect focused on maintainability. I have a class that has grown too large and handles too many concerns.
Language: {{LANGUAGE}}
Class code:
```
{{CLASS_CODE}}
```
Existing test coverage summary (describe what is and isn't tested, or paste test file):
{{TEST_COVERAGE_SUMMARY}}
Complete these steps:
1. List every distinct responsibility you can identify in this class. A responsibility is a reason the class might change independently of the others.
2. Group methods and fields by responsibility. Show which methods belong to which group.
3. Propose new class or module names for each group. Apply the Single Responsibility Principle — each proposed unit should have one reason to change.
4. Identify dependencies between the proposed units. Draw a simple dependency list (A depends on B) to surface any circular dependencies before they are created.
5. Recommend an extraction order that keeps the code functional at every step. Prioritize extracting units that are already well-tested.
6. For the first extraction in your recommended order, write the new class/module interface (method signatures and a one-line doc comment per method). Do not write the full implementation unless asked.
7. Flag any shared mutable state that would make extraction risky. {{LANGUAGE}}{{CLASS_CODE}}{{TEST_COVERAGE_SUMMARY}}
How to use this prompt
- Copy the prompt above (Copy button on the top-right).
- Replace each
{{VAR}}with your own value. Variables:{{LANGUAGE}}{{CLASS_CODE}}{{TEST_COVERAGE_SUMMARY}}. - Paste it into one of the recommended tools below.
- Iterate: tighten constraints in the prompt if the output is generic.
Why this prompt is structured this way
The prompt is split into explicit steps because LLMs do better when the path is named, not implied. Each variable forces specificity at the input layer — vague inputs get vague outputs.
Pair this prompt with a tool
Cursor
$20/moAI-first code editor forked from VS Code.
Cursor is VS Code with first-class LLM integration. Multi-file edits, codebase Q&A, autocomplete that's actually useful. The default IDE for many shipping engineers in 2026.
Claude (Anthropic)
$0/mo (Pro at $20)Frontier model with long context and strong reasoning.
Claude (Opus / Sonnet / Haiku tiers) is the assistant favored by writers and engineers who care about reasoning quality and tone. 1M token context on Opus.
ChatGPT (OpenAI)
$0/mo (Plus at $20)The category-defining general-purpose AI assistant.
ChatGPT has the broadest feature surface: image gen, voice, custom GPTs, web browsing, code execution. Often the right default; sometimes beaten on specific tasks by Claude or Perplexity.
The PlaybookPrompts weekly
One short email per week. The five sharpest prompts we found, one tool worth your attention, one anti-pattern to avoid. Unsubscribe in one click.
Newsletter signup is not configured. Set PUBLIC_NEWSLETTER_USERNAME in the build env.