dry
Use this skill to find and eliminate duplication across your codebase — UI components, database schema, and workflow logic. Also use when the codebase feels bloated, features take longer to build, changes break in unexpected places, or after significant AI-assisted development. Covers code deduplication, component reuse, database normalization, and modular architecture.
whawkinsiv · AI review on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add whawkinsiv/solo-founder-skills --skill dryAbout this skill
name: dry description: "Use this skill to find and eliminate duplication across your codebase — UI components, database schema, and workflow logic. Also use when the codebase feels bloated, features take longer to build, changes break in unexpected places, or after significant AI-assisted development. Covers code deduplication, component reuse, database normalization, and modular architecture."
Don't Repeat Yourself
Find and eliminate duplication across your codebase. Every duplicate is a future bug — when you fix something in one place but forget the copy, users hit the unfixed version.
This skill audits and refactors. For building features, use build. For general performance optimization, use optimize. For database schema design from scratch, use database. For UI component selection, use ui-patterns.
Two Modes
| Mode | When | Scope | Time |
|---|---|---|---|
| Quick scan | After building a feature, or on request | Recent changes vs. existing codebase | 2-5 minutes |
| Deep audit | Codebase feels bloated, periodic cleanup | Entire codebase, all three domains | 15-30 minutes |
Choose quick scan after implementing features, adding new pages, or building new API endpoints. Choose deep audit when the codebase has grown through many rounds of AI-assisted iteration, or quarterly as hygiene.
Quick Scan Workflow
Run this after building or modifying a feature.
Quick DRY scan:
- [ ] Identify what was just built or changed
- [ ] Search for similar patterns in existing codebase
- [ ] Flag any duplication with specific file locations
- [ ] Refactor: extract shared code, reuse existing components
- [ ] Verify nothing broke after refactoring
Process
- Identify the change — What files were just created or modified?
- Search for siblings — For each new component, function, or query: does something similar already exist?
- Decide: reuse or extract — If a near-duplicate exists, reuse it. If two things are now similar, extract a shared version.
- Refactor — Make the change, run build and tests.
What to Search For
- New component created → search for components with similar props, layout, or purpose
- New utility function → search for functions with similar signatures or logic
- New API endpoint → search for endpoints with similar query patterns or response shapes
- New database query → search for queries hitting the same tables with similar conditions
Deep Audit Workflow
Run this for comprehensive deduplication across the full codebase.
Deep DRY audit:
- [ ] Audit UI components for duplication
- [ ] Audit database schema for normalization issues
- [ ] Audit workflow logic for duplicate functions and patterns
- [ ] Generate findings with specific refactoring actions
- [ ] Apply fixes domain by domain, testing after each
See AUDIT-CHECKLIST.md for detailed search patterns and refactoring recipes per domain.
Domain 1: UI Components
What to Find
- Near-duplicate components — Two card components, two modal wrappers, two form layouts with slight differences
- Repeated inline styles — Same padding, colors, or layout CSS copied across components instead of using shared tokens or classes
- Same-purpose components —
UserListandMemberListthat do essentially the same thing with different prop names - Reimplemented patterns — Custom dropdown when the component library already has one
How to Fix
- Identical components → Delete one, update imports to point to the survivor
- Near-duplicates → Extract a shared component with props for the differences
- Repeated styles → Extract into shared CSS classes, design tokens, or a utility class
- Reimplemented patterns → Replace with the component library version
AI-Tool-Specific Patterns
| Tool | Common Duplication | Why |
|---|---|---|
| Lovable | Each prompt creates new Card/Button/Modal variants | Lovable doesn't reference existing components by default |
| Replit | Inline styles duplicated across pages | Fast iteration favors copy-paste |
| Cursor | Similar components in different feature folders | File-scoped context misses cross-feature reuse |
| Claude Code | Utility components recreated in new feature branches | Context window doesn't always include existing shared components |
Tell AI (for other tools):
Search my codebase for duplicate UI components:
- Find components with similar JSX structure or props
- Find repeated inline styles or CSS classes
- Find components that render the same kind of data differently
For each duplicate: show both versions side-by-side and propose a single shared component.
Domain 2: Database Schema
What to Find
- Denormalized data — User's email stored in both
userstable andorderstable instead of joining - Missing foreign keys — IDs stored as plain integers/strings without proper references
- Repeated column groups —
created_at,updated_at,created_bydefined inconsistently across tables - Enum values in columns — Status strings like
'active','inactive'repeated instead of using a lookup table - Duplicate lookup data — Category names stored as strings in every row instead of referencing a categories table
How to Fix
- Denormalized data → Remove the duplicate column, add a JOIN where needed
- Missing foreign keys → Add proper FK constraints with ON DELETE behavior
- Repeated column groups → Standardize naming and types across all tables
- String enums → Create a lookup table or use a database enum type (for values that won't change)
- Duplicate lookup data → Extract into a reference table, replace with foreign key
Red Flags in AI-Generated Schemas
AI tools often create self-contained tables per feature. Watch for:
- A
projectstable withowner_nameandowner_emailinstead ofowner_idrefere