patternscomposite

Composite Pattern pattern for C development

⭐1stars🔀0forks📁View on GitHub🕐Updated Jan 4, 2026

When & Why to Use This Skill

This Claude skill facilitates the implementation of the Composite Pattern in C development, enabling developers to compose objects into tree structures while treating individual objects and compositions uniformly. It is designed to enhance software architecture by providing a standardized approach to managing complex hierarchies and recursive structures in low-level programming.

Use Cases

  • Developing modular UI layer systems where various components like scrollbacks, separators, and inputs are managed through a single rendering interface.
  • Implementing recursive data structures such as file systems, organizational charts, or nested message threads in C-based applications.
  • Designing rendering engines that iterate through complex object trees without needing to distinguish between simple and composite elements.
  • Building extensible tool result trees or nested component architectures that allow for adding new types without modifying existing logic loops.
namepatterns/composite
descriptionComposite Pattern pattern for C development

Composite Pattern

Compose objects into tree structures. Individual objects and compositions treated uniformly through common interface.

ikigai Application

Layer system: Layers (scrollback, separator, input, spinner) compose into layer stack. Each implements same render interface:

typedef struct {
    void (*render)(void *layer, ik_render_ctx_t *render);
    void (*resize)(void *layer, int width, int height);
} ik_layer_vtable_t;

Rendering: REPL iterates layers, calls render on each. Doesn't care if layer is simple or composite.

Future uses:

  • Nested UI components
  • Tool result trees
  • Message threading/nesting

Benefit: Add new layer types without changing render loop.