# Poo

> >

- **Type:** Skill
- **Install:** `agentstack add skill-keysjoao-poo-skills-poo`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [keysjoao](https://agentstack.voostack.com/s/keysjoao)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [keysjoao](https://github.com/keysjoao)
- **Source:** https://github.com/keysjoao/poo-skills/tree/main/poo

## Install

```sh
agentstack add skill-keysjoao-poo-skills-poo
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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: "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`, `type` props instead of creating new components

### Interface Segregation
- Don't force components to accept props they don't use
- Create focused interfaces: `ButtonProps`, not `EverythingProps`

## 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

1. **Copy-Paste Component**: Same component in multiple folders with minor differences
2. **Utility Sprawl**: `formatDate` in 3 different utils files
3. **Hook Duplication**: `useFetch` reimplemented per feature
4. **Inline Logic**: Complex logic inline that should be a utility
5. **CSS Duplication**: Same styles in multiple files instead of shared classes
6. **API Spaghetti**: Same fetch call in multiple components instead of a service
7. **Type Duplication**: Same interface defined in multiple files

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [keysjoao](https://github.com/keysjoao)
- **Source:** [keysjoao/poo-skills](https://github.com/keysjoao/poo-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-keysjoao-poo-skills-poo
- Seller: https://agentstack.voostack.com/s/keysjoao
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
