Skip to main content
Back to Exercises
Foundations beginner 15 min

Identify Duplication

Find repeated patterns in code and propose unification strategies.

Objectives

  • Recognize structural duplication in component code
  • Distinguish essential similarity from coincidental
  • Propose a unified abstraction

Beads Tasks

Create these tasks in Beads before starting. You learn Beads by using Beads.

bd create "Praxis: Identify duplication in [target]" --type=task--labels=learn,foundations
bd create "Document 3+ duplication patterns found" --type=task--labels=learn
bd create "Propose unified abstraction" --type=task--labels=learn

Claude Code Prompt

Copy this prompt into Claude Code to build YOUR own version:

## Setup: Track this exercise with Beads

```bash
bd create "Praxis: Identify duplication in [target]" --type=task --labels=learn,foundations
bd create "Document 3+ duplication patterns found" --type=task --labels=learn
bd create "Propose unified abstraction" --type=task --labels=learn
```

---

Help me identify duplication patterns in my codebase and create MY unification strategy.

I'm building my own DRY discipline. Analyze [FILE_OR_DIRECTORY] for:

1. **Structural duplication**: Similar component patterns, repeated prop interfaces
2. **Logic duplication**: Copy-pasted conditionals, repeated data transforms
3. **Essential vs. coincidental**: Which similarities are fundamental vs. accidental?

For each pattern found:
- Show me the duplicated code
- Explain why it's duplication (or why it's not)
- Propose a unified abstraction

End with MY DRY principle: a one-sentence rule I can apply to future code.

The target I want to analyze: [YOUR_FILE_OR_DIRECTORY]

Your Solution

Write code that addresses the objectives above. Apply the principles from the Foundations path.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15