Composition Data Modeling

Design and validate composition data structures for hierarchical product relationships.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/nategarelik/composition --skill composition-data-modeling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Composition Data Modeling
Source: https://github.com/nategarelik/composition/tree/main/.claude/skills/composition-data
Command: npx skills add https://github.com/nategarelik/composition --skill composition-data-modeling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides patterns for modeling composition data — the hierarchical structure from product to elements — to support schemas, databases, APIs, and transformations.

Core Features & Use Cases

  • TypeScript types & Prisma schema: Clear patterns for types and schema how they map to a composition.
  • Flattening & transforms: Helpers to flatten trees and calculate element totals.
  • Use Case: Design a Composition API response that returns flattened node arrays and depth totals.

Quick Start

Start by integrating the provided TypeScript types into your project, then create a sample Composition object and verify flattening and totals functions.

Frequently Asked Questions about Composition Data Modeling

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

FAQPage Schema
How do I model hierarchical product and component relationships in TypeScript and Prisma?

Design composition data structures using TypeScript types that represent hierarchical relationships from product to elements, then map them to Prisma schemas. This approach enforces structured typing, metadata capture, and confidence levels to support reliable querying and consistent rendering across your API and database.

Can I flatten hierarchical composition trees and calculate element totals?

Yes. The Skill provides transform helpers to flatten tree structures into node arrays and compute depth totals, enabling you to return optimized Composition API responses with both hierarchical context and aggregated element data in a single payload.

What's the best way to design a Composition API response that handles product hierarchies?

Structure your API response to return flattened node arrays alongside depth totals and source tracking metadata. This pattern supports researchability and allows clients to render compositions consistently without repeatedly traversing the hierarchy.

How do I handle composition data transformations between TypeScript types and API formats?

Apply the Skill's transformation patterns to convert between TypeScript type definitions, Prisma schema representations, and JSON-serialized composition graphs. This ensures type safety and consistent data structure handling across your entire data pipeline.

Do I need composition data modeling when working with nested product or material structures?

Yes, if you're designing schemas or APIs for hierarchical data like products containing components containing materials. Composition data modeling enforces structured validation, source tracking, and visual configuration to prevent inconsistent representation across systems.

What should I track when modeling composition relationships beyond the hierarchy itself?

Capture metadata including confidence levels, source attribution, and visual configuration alongside the hierarchical structure. This metadata supports reliable querying, audit trails, and consistent rendering when composition data moves between systems or formats.