feature-composition

Create self-contained Angular dashboard features with lazy-loaded routes and feature guards.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/Zoppy-crm/.github --skill feature-composition
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: feature-composition
Source: https://github.com/Zoppy-crm/.github/tree/main/skills/frontend/feature-composition
Command: npx skills add https://github.com/Zoppy-crm/.github --skill feature-composition

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

New frontend features often become entangled across folders, causing poor encapsulation, prop-drilling, duplicated state logic, and hard-to-maintain code. This Skill prescribes a composition pattern that keeps a feature self-contained with a smart container, focused sub-components, an optional feature state service, and dedicated routes so features remain isolated, testable, and lazy-loadable.

Core Features & Use Cases

  • Single-folder feature roots: Everything for the feature lives under src/core/pages/dashboard/<feature-name>/ to avoid leakage into global folders.
  • Smart container vs sub-components: The container handles data loading, navigation, and provides the feature state service while sub-components focus on presentation and inject state directly when needed.
  • Routing and lazy loading: Register features with loadComponent or loadChildren and protect them with feature guards for on-demand loading and route-level control.
  • Styling and performance rules: Use Tailwind only, adhere to ChangeDetectionStrategy.OnPush, and keep component files small (~150 lines) to maintain clarity and performance.
  • Use case: Add a multi-step create-product flow that provides a CreateProductStateService to nested components, lazy-loads the route, and keeps all assets and tests inside the feature folder.

Quick Start

Create a new feature folder under src/core/pages/dashboard/<feature-name> and implement a smart container, focused sub-components, an optional feature state service, and a lazy-loaded route following the composition rules.

Frequently Asked Questions about feature-composition

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

FAQPage Schema
How do I isolate Angular dashboard features to avoid prop-drilling and duplicated state logic?

Isolate Angular dashboard features by applying a composition pattern under src/core/pages/dashboard/<feature-name> with a smart container, focused sub-components, and an optional feature state service. This keeps components encapsulated, testable, and lazy-loadable.

What is the best way to structure lazy-loaded routes for new Angular dashboard pages?

The best way to structure lazy-loaded routes is registering features with loadComponent or loadChildren and protecting them with feature guards. This enables on-demand loading and route-level access control for new dashboard pages.

How do I manage state in a multi-step Angular flow without global folders?

Manage state in a multi-step Angular flow by creating a feature state service injected by the smart container. Focused sub-components inject this state service directly to avoid global folder leakage and duplicated logic.

Does this Angular feature composition pattern work with ChangeDetectionStrategy.OnPush and Tailwind?

Yes, this feature composition pattern works with ChangeDetectionStrategy.OnPush and Tailwind. It enforces Tailwind-only styling and OnPush change detection to maintain clarity and rendering performance.

Why should I keep Angular component files around 150 lines when building dashboard features?

Keep Angular component files around 150 lines to maintain clarity and performance. This component size limit ensures sub-components stay focused on presentation while the smart container handles data loading and navigation.

When do I need a feature guard for Angular lazy-loaded routes?

You need a feature guard for Angular lazy-loaded routes when adding new dashboard pages or multi-step flows that require route-level access control. Guards protect loadComponent or loadChildren routes for on-demand loading.