跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

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 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add whawkinsiv/solo-founder-skills --skill dry

技能说明


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

ModeWhenScopeTime
Quick scanAfter building a feature, or on requestRecent changes vs. existing codebase2-5 minutes
Deep auditCodebase feels bloated, periodic cleanupEntire codebase, all three domains15-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

  1. Identify the change — What files were just created or modified?
  2. Search for siblings — For each new component, function, or query: does something similar already exist?
  3. Decide: reuse or extract — If a near-duplicate exists, reuse it. If two things are now similar, extract a shared version.
  4. 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 — UserList and MemberList that do essentially the same thing with different prop names
  • Reimplemented patterns — Custom dropdown when the component library already has one

How to Fix

  1. Identical components → Delete one, update imports to point to the survivor
  2. Near-duplicates → Extract a shared component with props for the differences
  3. Repeated styles → Extract into shared CSS classes, design tokens, or a utility class
  4. Reimplemented patterns → Replace with the component library version

AI-Tool-Specific Patterns

ToolCommon DuplicationWhy
LovableEach prompt creates new Card/Button/Modal variantsLovable doesn't reference existing components by default
ReplitInline styles duplicated across pagesFast iteration favors copy-paste
CursorSimilar components in different feature foldersFile-scoped context misses cross-feature reuse
Claude CodeUtility components recreated in new feature branchesContext 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 users table and orders table instead of joining
  • Missing foreign keys — IDs stored as plain integers/strings without proper references
  • Repeated column groups — created_at, updated_at, created_by defined 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

  1. Denormalized data → Remove the duplicate column, add a JOIN where needed
  2. Missing foreign keys → Add proper FK constraints with ON DELETE behavior
  3. Repeated column groups → Standardize naming and types across all tables
  4. String enums → Create a lookup table or use a database enum type (for values that won't change)
  5. 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 projects table with owner_name and owner_email instead of owner_id refere
阅读完整来源 ↗