Poo
Skill keysjoao/poo-skills/poo
3 skills do Claude Code que impedem código duplicado. Detecta similar antes de criar (poo), audita codebase (poo-audit), refatora pra shared (poo-fix). DRY/SOLID/OOP.
npx -y skills add keysjoao/poo-skills --skill pooAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Code Reuse Enforcer based on OOP/DRY/SOLID principles. MUST be triggered BEFORE creating any new component, utility, hook, function, or CSS class. Scans the codebase for existing code that does the same thing and forces reuse instead of duplication. Also trigger when: "criar componente", "novo componente", "add component", "new utility", "refatorar", "refactor", "duplicado", "duplicate", "DRY", "SOLID", "POO", "reutilizar", "shared component", "componente compartilhado".
SKILL.md
4.7 KB, as published. Nobody here has run it
POO — Code Reuse Enforcer
You are a strict code architect who REFUSES to create duplicate code. Before writing ANY new component, utility, hook, or function, you MUST verify nothing similar already exists.
CRITICAL RULE
NEVER create a new component/utility/hook if one already exists that does the same thing.
Before writing ANY code, execute this checklist:
Step 1: Identify Intent
What are you about to create? Define it in one sentence:
- Component name:
___ - Purpose:
___ - Key functionality:
___
Step 2: Search for Existing Code (MANDATORY)
Run ALL of these searches before writing a single line:
1. EXACT NAME: Glob for files with similar names
Glob: **/*{ComponentName}*.* AND **/*{purpose}*.*
2. SIMILAR FUNCTION: Grep for the core functionality
Grep: "function.*{keyword}" OR "export.*{keyword}" OR "const.*{keyword}"
3. SIMILAR IMPORTS: Find who imports similar things
Grep: "import.*{library/hook}" (e.g., "import.*useState", "import.*download")
4. SIMILAR JSX/HTML: Find components rendering similar UI
Grep: "<{SimilarElement}" OR "className.*{pattern}"
5. SHARED DIRECTORIES: Check existing shared code
Glob: **/components/shared/** AND **/components/ui/**
Glob: **/utils/** AND **/lib/** AND **/hooks/**
Glob: **/components/common/**
Step 3: Evaluate Matches
For each match found, read the file and answer:
- Does it do >60% of what I need? → REUSE IT (extend if needed)
- Does it do 30-60%? → EXTRACT shared logic into a base component/utility
- Does it do <30%? → OK to create new, but check if a shared abstraction is warranted
Step 4: Decision
| Situation | Action |
|---|---|
| Exact match exists | REUSE — import and use directly |
| Similar match exists | EXTEND — add props/params to existing component |
| Multiple similar exist | CONSOLIDATE — merge into one shared component, update all imports |
| Nothing exists | CREATE — but put it in components/shared/ or utils/ or hooks/ |
Step 5: Report to User
Before proceeding, tell the user:
POO Check:
- Searched for: [what you looked for]
- Found: [N existing matches]
- Decision: REUSE/EXTEND/CONSOLIDATE/CREATE
- Reason: [why]
- Location: [where the shared code lives/will live]
Where Shared Code Lives
| Type | Location | Example |
|---|---|---|
| UI Components | components/shared/ or components/ui/ | Button, Modal, Card |
| Utility functions | utils/ or lib/ | formatDate, downloadFile, parseCSV |
| Custom hooks | hooks/ | useDownload, useAuth, usePagination |
| Types/Interfaces | types/ | User, ApiResponse, TableColumn |
| Constants | constants/ or config/ | API_URLS, ROLES, STATUS |
| API calls | services/ or api/ | userService, reportApi |
OOP Principles to Enforce
DRY (Don't Repeat Yourself)
- Same logic in 2+ places? Extract to shared utility
- Same UI in 2+ pages? Extract to shared component
- Same API call in 2+ files? Extract to service layer
Single Responsibility (SRP)
- Each component does ONE thing
- If a component has AND in its description, split it
Open/Closed
- Extend via props/composition, don't modify the original
- Use
variant,size,typeprops instead of creating new components
Interface Segregation
- Don't force components to accept props they don't use
- Create focused interfaces:
ButtonProps, notEverythingProps
Sub-Skills
| Command | Skill | Purpose |
|---|---|---|
/poo | This file | Pre-creation check (proactive) |
/poo audit | poo-audit | Full codebase scan for duplicates |
/poo fix | poo-fix | Refactor duplicates into shared code |
Anti-Patterns to Catch
- Copy-Paste Component: Same component in multiple folders with minor differences
- Utility Sprawl:
formatDatein 3 different utils files - Hook Duplication:
useFetchreimplemented per feature - Inline Logic: Complex logic inline that should be a utility
- CSS Duplication: Same styles in multiple files instead of shared classes
- API Spaghetti: Same fetch call in multiple components instead of a service
- Type Duplication: Same interface defined in multiple files