Philosophy — Composition Over Invention

Apply the rule of three to reuse existing code patterns.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/bytetalent/docs --skill philosophy-composition-over-invention
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Philosophy — Composition Over Invention
Source: https://github.com/bytetalent/docs/tree/main/skills/meta/philosophy-composition-over-invention
Command: npx skills add https://github.com/bytetalent/docs --skill philosophy-composition-over-invention

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of balancing code maintainability and reusability by advocating for the use of existing solutions and small glue code over unnecessary new abstractions.

Core Features & Use Cases

  • Composition of Skills: Encourages combining existing skills and patterns to cover most feature needs, avoiding unnecessary abstractions.
  • Rule of Three: Provides the "rule of three" principle, suggesting to only create new abstractions after three instances of similar features have been observed.
  • Glue Code: Allows for the writing of "glue code" to connect existing patterns, rather than wrapping everything in a new hook or component.

Quick Start

Integrate this philosophy into your project by following the 'rule of three' and prioritizing composition over invention in your code design.

Frequently Asked Questions about Philosophy — Composition Over Invention

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent technical debt from unnecessary code abstractions in software design?

To prevent technical debt from unnecessary abstractions, prioritize reusing existing code patterns and writing small glue code over creating new hooks or components before they are truly needed.

What is the rule of three in code reuse?

The rule of three in code reuse suggests creating a new abstraction only after observing three instances of similar features, ensuring you avoid premature generalization and maintain better codebase maintainability.

How do I balance code maintainability and reusability when adding new features?

Balance code maintainability and reusability by composing existing project patterns and using glue code to connect them, deliberately avoiding wrapping everything in new components unless duplicated three times.

When should I write glue code instead of creating a new component?

Write glue code instead of creating a new component when connecting existing patterns covers your feature needs, actively avoiding unnecessary abstractions to optimize the codebase and reduce technical debt.

Does prioritizing composition over invention work for large software engineering teams?

Yes, prioritizing composition over invention works for software engineering teams aiming to improve code maintainability by applying the rule of three to make thoughtful design decisions and reduce technical debt.