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.
What this skill does
# 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 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](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 | 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 `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` referencing `users` - An `invoices` table with `customer_name`, `customer_email`, `customer_address` instead of `customer_id` - Multiple tables with their own `status` VARCHAR column using the same string values **Tell AI (for other tools):** ``` Audit my database schema for normalization issues: - Find columns that store data already available in another table - Find ID columns without foreign key constraints - Find string columns that should be lookup tables - Find inconsistent column naming across tables For each: explain the problem and write the migration to fix it. ``` --- ## Domain 3: Workflow Logic ### What to Find - **Duplicate utility functions** — Two `formatDate()` functions in different files - **Repeated API patterns** — Same fetch-try-catch-error-handle boilerplate across endpoints - **Copy-pasted validation** — Email validation logic in signup, settings, and invite flows - **Duplicate business logic** — Price calculation in checkout, invoice generation, and dashboard - **Repeated data transforms** — Same array mapping/filtering logic in multiple components ### How to Fix 1. **Duplicate utilities** → Keep one, move to a shared `utils/` or `lib/` directory, update all imports 2. **API boilerplate** → Extract a shared API client or wrapper function 3. **Repeated validation** → Create a shared validation module (e.g., `lib/validators.ts`) 4. **Business logic** → Extract into a service or domain module (e.g., `lib/pricing.ts`) 5. **Data transforms** → Extract into named functions near the data type they operate on ### Search Strategy ``` Find duplicate logic: 1. Search for functions with identical or near-identical bodies 2. Search for repeated import patterns (same 3+ imports in multiple files) 3. Search for similar try/catch blocks around API calls 4. Search for the same regex or validation pattern in multiple files 5. Search for string literals used in more than 2 files (often config that should be a constant) ``` **Tell AI (for other tools):** ``` Audit my codebase for duplicate workflow logic: - Find functions with similar names or identical logic in different files - Find repeated error handling patterns - Find validation logic that appears in more than one place - Find business calculations done in more than one place For each: show all locations and propose a single shared implementation. ``` --- ## What NOT to Deduplicate Not all duplica
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.