This repository was archived by the owner on Apr 14, 2026. It is now read-only.
Clean Architecture toolkit: four tools for gradual transformation#318
Draft
Clean Architecture toolkit: four tools for gradual transformation#318
Conversation
svarlet
commented
Feb 17, 2026
Collaborator
Author
There was a problem hiding this comment.
Note: see if this can utilise any/all of:
Meanwhile, this script still introduces a quick feedback loop to Claude.
Four tools to enforce and apply the Clean Architecture dependency rule incrementally, without a big-bang rewrite: 1. /rework skill — analyze a feature, diagnose anti-patterns (sealed classes in providers, state machines in Notifiers, I/O in Notifiers), and propose a scoped refactoring with domain enrichment, use case extraction, and provider thinning. Includes comprehension cost metrics and a full test transformation plan. 2. /rework-sharpen skill — evaluate developer feedback about the toolkit against Clean Architecture principles. Patch tools if a genuine gap; educate if a misunderstanding. 3. Claude hooks — architecture-lint.sh runs on file writes to detect domain types defined outside lib/core/domain/ and flag violations. 4. Architect agent — enforces the dependency rule when building new features by consulting TARGET.md and ANALYSIS.md. Supporting artifacts: - PLANS/0006-clean-architecture/ — ADR, analysis, target architecture, and tool specifications - CLAUDE.md — Clean Architecture rules for providers, domain, use cases - diagnosis-checklist.md — 10-point checklist for provider anti-patterns Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41a4b3e to
601ca64
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why a toolkit, not a roadmap
The codebase has 62 Riverpod providers across 22 files. Providers absorbed
domain responsibilities — sealed classes, state machines, business logic —
rather than serving as thin glue. The root cause: Claude's default
decomposition strategy optimizes for local correctness ("one concern = one
file") over global cohesion.
A rigid refactoring roadmap would go stale when priorities shift. Instead,
this PR introduces four tools that codify architectural judgment so any
developer can apply the Clean Architecture dependency rule on demand, at
the moment it matters.
The four tools
/rework <feature>claude --agent architectsealed classin providers, oversized files, and state machine signals the moment Claude writes them. Non-blocking feedback via Claude hooks./rework-sharpen <feedback>What's in the box
Analysis & design (read these first):
PLANS/0004-clean-architecture/ADR.md— the decision and rationalePLANS/0004-clean-architecture/ANALYSIS.md— provider inventory, diagnosisPLANS/0004-clean-architecture/TARGET.md— concrete before/after transformationsPLANS/0004-clean-architecture/SPEC.md— specifications for all four toolsTools:
.claude/skills/rework/— the/reworkskill + diagnosis checklist.claude/agents/architect.md— the architect agent.claude/hooks/provider-lint.sh+.claude/settings.json— the lint hook.claude/skills/rework-sharpen/— the/rework-sharpenskillRules:
CLAUDE.md— updated with Clean Architecture provider constraintsAll tools share one source of truth
The Clean Architecture dependency rule from Uncle Bob's blog post.
Every tool eagerly reads it at execution time to stay grounded in
principles, not just local conventions. TARGET.md is illustrative but
the principles are enduring.
Test plan
/rework quiz— verify it diagnoses sealed classes and state machine inquiz_provider.dart/rework-sharpen "the hook flagged a comment mentioning sealed class"— verify it recognizes the hook already strips commentsclaude --agent architectwith a simple feature spec — verify it walks through the steps conversationally🤖 Generated with Claude Code