atomico-app-patterns

Manage Atomico component state and events with composition and context.

1.3k|44|Updated Aug 25, 2018
One-click install
npx skills add https://github.com/atomicojs/atomico --skill atomico-app-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: atomico-app-patterns
Source: https://github.com/atomicojs/atomico/tree/main/.agents/skills/atomico-app-patterns
Command: npx skills add https://github.com/atomicojs/atomico --skill atomico-app-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Helps developers design and implement multi-component Atomico web applications by providing clear patterns for component composition, parent-child communication, shared state, and project structure so teams avoid ad-hoc architectures and fragile event flows.

Core Features & Use Cases

  • Component composition: guidance for organizing components (one component per file) and centralizing or co-locating registration.
  • Communication patterns: examples for props, event-driven child-to-parent messaging, cross-tree context providers/consumers, and sibling coordination via shared parent state.
  • Project scaffolding & TypeScript setup: recommended folder layout, registration patterns, and a compatible tsconfig for Atomico applications.
  • Real-world use case: a complete Todo app demonstrating TodoApp, TodoForm, and TodoTask with useProp state, event dispatching, reflected attributes, and centralized registration.

Quick Start

Create a TodoApp with TodoForm and TodoTask using Atomico: define each component, use event props for child-to-parent updates, manage the tasks array with useProp, and register components at your app entry point.

Frequently Asked Questions about atomico-app-patterns

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

FAQPage Schema
How do I manage shared state across nested Atomico web components?

Manage shared state across nested Atomico web components by using context providers and consumers for cross-tree coordination, and useProp to hold parent state that siblings interact with. This pattern avoids fragile event chains and ad-hoc architectures.

What is the best way to handle child-to-parent communication in Atomico?

Handle child-to-parent communication in Atomico using event-driven props and the event() utility to dispatch updates. This allows child components to send data upward without tight coupling, keeping component hierarchies scalable and maintainable.

How do I structure a scalable Atomico TypeScript application?

Structure a scalable Atomico TypeScript application by organizing one component per file, co-locating or centralizing component registration at the app entry point, and configuring a compatible tsconfig to support reflected attributes and strict typing.

Does Atomico work with TypeScript for event-driven component patterns?

Atomico works seamlessly with TypeScript for event-driven component patterns, providing typed support for event(), useProp, and context providers. This enables strongly typed inter-component communication and reflected attributes in complex web component hierarchies.

How do I coordinate sibling components in an Atomico app?

Coordinate sibling components in an Atomico app by lifting shared state to a common parent using useProp and passing event-driven props down. This shared parent state pattern allows siblings to react to each other's changes without direct dependencies.

When should I use context providers instead of props in Atomico web components?

Use context providers instead of props in Atomico web components when you need cross-tree state coordination that bypasses intermediate components. Context is ideal for deep hierarchies where passing props through every layer becomes fragile and unmanageable.