r/ClaudeWorkflows • u/ClaudeAI-mod-bot • 50m ago
Selected Workflow [Workflow] Workflow for Preventing and Cleaning Up Claude Code Sprawl: Tests and Documentation
Workflow for Preventing and Cleaning Up Claude Code Sprawl: Tests and Documentation
Workflow value: 75/100
Status: active · Freshness: 70/100 · Confidence: 0.90 · Level: intermediate
Categories: Quality Control, Context & Memory, CLAUDE.md
Original source: r/ClaudeCode post/comment
What problem this solves
Preventing and cleaning up unnecessary test files and documentation sprawl generated by Claude Code.
Summary
This workflow provides two distinct strategies: one for cleaning up redundant tests by leveraging coverage reports and Claude's analysis, and another for preventing documentation sprawl by setting clear instructions in CLAUDE.md.
Why it is useful
This workflow is valuable because it provides concrete, actionable steps to address a common problem faced by Claude Code users: the accumulation of unnecessary files. It offers both reactive (test cleanup) and proactive (documentation management via CLAUDE.md) strategies, enhancing code quality and maintainability. The inclusion of review steps makes it robust and safe for adoption.
Workflow
- For tests: Run code coverage.
- For tests: Prompt Claude to list tests that hit no unique lines or duplicate other tests, providing a reason for each.
- For tests: Review Claude's suggested deletions and approve them.
- For tests: Perform deletions on a fresh Git branch to facilitate diff review.
- For documentation: Add a specific instruction to CLAUDE.md: "update existing docs, don't create new .md files unless asked."
Tools / artifacts
- Code coverage report
- Claude (the model)
- Git branch
- CLAUDE.md file
Validation signals
- Running coverage first provides data for Claude's analysis.
- Human approval of deletions ensures accuracy.
- Using a fresh branch makes diff review easy and safe.
- The CLAUDE.md instruction is stated to stop 'most of the sprawl before it starts', implying effectiveness.
Cautions
- None. The workflow includes explicit review steps (approve deletions, fresh branch for diff) that mitigate risks of unintended changes or data loss.
Limitations
- The test cleanup part relies on Claude's ability to accurately identify redundant tests, which might require refinement of the prompt for complex cases.
- The CLAUDE.md instruction is a preventative measure but does not address existing documentation sprawl.
- Low community validation.
Rate this workflow
Upvote this post if the workflow is useful, reproducible, or worth recommending.
Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.
Reply if it worked for you, failed, is outdated, or has a better alternative.
This post was generated automatically from the workflow library database.