Index of every page on this site: llms.txt
All skills
github avatar

/react-container-presentation-component

@f10fdb8 official
by githubgithub/awesome-copilot42k stars
5,426
Run it yourself

Create a React component using the Container/Presentation pattern in src/components by asking for the component name and type (ui or features), then scaffold files that follow this repository's TypeScript, Storybook, and SCSS conventions. Use when the user explicitly asks for a Container/Presentation-based component or runs /react-container-presentation-component.

Use this Skill: https://skilld.dev/gh/github/awesome-copilot/react-container-presentation-component

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescomponent-architecture.md

≈1.3k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Component Architecture Reference

This reference defines classification, file layout, and dependency direction in src/components.

Design Intent and Principles

The goal of this skill is not only to add React components, but to apply the Container/Presentation pattern consistently with clear separation of responsibilities and dependency direction.

This reference does not define full application-wide architecture. It focuses on design quality at the component boundary.

  • Separate rendering responsibilities from logic responsibilities.
  • Do not place state management, side effects, or business decisions in the presentation layer.
  • Avoid mixing responsibilities across boundaries and keep dependency direction explicit.

Classification

  • Place all components under src/components.
  • Use only two categories:
    • ui: render-only, stateless components.
    • features: components that include logic.

Reclassification Rule

If the user requests ui but the implementation contains any of the following, treat it as features and ask for confirmation before creating files:

  • useState, useReducer, or useEffect.
  • Async behavior (API calls, timers, subscriptions).
  • Reading from or writing to context/store.
  • Business/data transformation logic.

Ask using these options:

  • Create as features
  • Keep ui and move logic/state to parent or features

Layer Responsibilities

This skill defines layers in two stages.

1. Component Type Layer

Type Responsibility
ui Reusable render-only component. Must not include business logic, side effects, or state management.
features Use-case-oriented component. Handles state transitions, event interpretation, and async orchestration.

2. Internal Layer in features

Layer Responsibility Primary files
container Handles state management, side effects, event handling, and data fetching. index.tsx, use<ComponentName>.tsx, types.ts
presentation Receives props and renders UI only. Must not perform external I/O or state updates. presentation.tsx, presentation.module.scss, presentation.stories.tsx

Notes:

  • ui is composed of presentation only.
  • features must separate container and presentation.

Implementation Rules

ui

  • Keep components stateless.
  • Accept data and callbacks via props.
  • Do not add side effects or data fetching.
  • Prefer primitives from Mantine or other UI libraries first; use custom JSX/SCSS only when needed.

features

  • Use the Container/Presentation pattern.
  • Keep logic in use<ComponentName>.tsx.
  • Follow Container/Presentation Separation Rules (Anti-patterns and Decision Examples) below for detailed responsibility boundaries and anti-patterns.

Container/Presentation Separation Rules (Anti-patterns and Decision Examples)

Principles:

  • Container is responsible for state management, side effects, event interpretation, and async processing.
  • Presentation is responsible only for rendering from received props.
  • Keep business decisions and data transformation in container-side code, not in presentation.

Placement rules:

  • Place in container: useState / useReducer / useEffect, API calls, context/store read-write, business rule application.
  • Place in presentation: JSX rendering and display-only branching (for example: empty, loading, error views).
  • Use types.ts to define I/O contracts between container and presentation.

Anti-patterns:

  • Calling APIs or mutations from presentation.
  • Updating context/store directly from presentation.
  • Implementing business decisions (authorization checks, state transition decisions, data shaping) in presentation.
  • Splitting files formally while keeping practical logic in presentation.

Good / Bad examples:

  • Bad: presentation.tsx fetches data and manages loading state directly.
  • Good: use<ComponentName>.tsx manages data fetching and state, and presentation.tsx renders only from props such as isLoading, items, and onAction.

Dependency Direction

  • features -> ui: allowed.
  • ui -> features: forbidden.

File Structure

ui

  • index.tsx
  • presentation.tsx
  • presentation.stories.tsx
  • presentation.module.scss

features

  • index.tsx
  • use<ComponentName>.tsx
  • presentation.tsx
  • types.ts
  • presentation.stories.tsx
  • presentation.module.scss

Storybook Minimum

  • Always create Default.
  • Add state-specific stories only when distinct states exist.
  • Prefer story sets based on behavior:
    • Interactive controls: Hover.
    • Input-like: Focus, Error, Disabled.
    • Layout/open-close: Open, Closed, Empty.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts28d3 checks · Risk SAFE
  • Gen Agent Trust Hub28d

    This skill scaffolds React components using the Container/Presentation pattern. It creates files, refactors existing code, and runs project validation scripts. While it includes input validation and user confirmation steps, it processes user-provided names that are used in file operations and build commands.

  • Socket28d

    No alerts

  • Snyk28d

    Risk: LOW · No issues

Signed by skilld at f10fdb8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 5 months ago
argument-hint
componentName type(ui|features)
user-invocable
true
  • React
  • TypeScript
  • container-presentation
  • component-scaffold
  • storybook
  • scss
  • ui-components

README badge

README badge for github/awesome-copilot/react-container-presentation-component

Scaffolds a React component in src/components using the Container/Presentation pattern, generating TypeScript files, SCSS modules, and Storybook stories that match the repository's conventions. Asks for component name and type (ui or features), then creates the appropriate file structure with validation against state and side-effect rules.

Generated from the current SKILL.md.

Does this skill work with existing components or only create new ones?
It checks for existing components first and will not overwrite them. If a component already exists, it asks you to confirm the preferred approach before proceeding.
What's the difference between ui and features components?
ui components are presentational with no state or business logic; features components handle state management, side effects, and business logic. The skill will reclassify a ui component as features if it detects state, async processing, or context updates.
Does this skill update existing usages of Mantine or other UI libraries?
Only when creating a ui component and only with your explicit approval. It will ask whether to replace equivalent direct implementations in existing features components.
What files does this skill generate?
For ui: index.tsx, index.module.scss, and index.stories.tsx. For features: index.tsx, use<ComponentName>.tsx, presentation.tsx, types.ts, presentation.module.scss, and presentation.stories.tsx.
Does this skill run Storybook automatically?
No. It asks whether to run `npm run storybook` after generating files; you can skip Storybook verification if preferred.

Generated from the current SKILL.md. These answers refresh after source changes.