Generated banner for React Container Presentation Component
Generated logo for React Container Presentation Component

React Container Presentation Component

GitHubOfficialFirst committed by tmt823Distributed by GitHub

  • Skill
  • Workflow
  • Software development
  • MIT
  • No issues found

From the author

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.
— the description by tmt823

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill automates the creation of React components within the src/components directory. It enforces a strict separation of concerns by guiding the user to classify components as either ui (stateless, render-only) or features (logic-heavy, container-based). The tool ensures that all generated code adheres to project-specific TypeScript, SCSS, and Storybook conventions, while validating that logic, state management, and side effects are correctly isolated within the appropriate layers.

What it does

  • Scaffolds file structures for ui or features components
  • Enforces the Container/Presentation pattern for feature components
  • Validates component classification based on logic and state usage
  • Generates boilerplate including index, styles, types, and stories
  • Checks for existing components to prevent accidental overwrites
  • Provides options to replace direct library implementations with new ui components

When to use it

  • When you need to create a new React component in src/components
  • When you want to ensure consistent application of the Container/Presentation pattern
  • When you need help determining if a component should be classified as ui or features
  • When you need to scaffold files that follow project-specific styling and testing standards

Advantages

  • Ensures architectural consistency across the codebase
  • Automates repetitive boilerplate creation
  • Prevents logic leakage into presentation layers
  • Enforces project-wide TypeScript and SCSS coding standards

Usage examples

“/react-container-presentation-component UserProfile features”
The agent scaffolds a UserProfile feature component with index.tsx, useUserProfile.tsx, presentation.tsx, types.ts, and associated styles and stories.
“/react-container-presentation-component PrimaryButton ui”
The agent creates a stateless PrimaryButton ui component with index.tsx, index.module.scss, and index.stories.tsx.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/github/react-container-presentation-component/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip react-container-presentation-component.zip -d .agents/skills

Documentation by tmt823

Container/Presentation Component

Use this skill to create a React component under src/components that follows the Container/Presentation pattern.

Refer to this skill's bundled references for detailed rules.

  • references/component-architecture.md

  • references/typescript-and-scss-rules.md

If the /react-container-presentation-component input is incomplete, ask questions first before creating files.

When To Use

  • When the user runs /react-container-presentation-component

  • When the user explicitly asks for a React component that follows the Container/Presentation pattern

  • When the user wants help deciding or implementing ui vs features classification within the Container/Presentation pattern

Required Questions

If any of the following information is missing, ask the user using ask_user.

  1. Component name

  2. Type (ui or features)

  3. Whether to replace existing components (only when creating ui)

Question requirements:

  • Provide the type as options (ui, features)

  • Require the component name to be in PascalCase

  • For ui, ask whether direct usage of Mantine or other UI libraries in existing features should be replaced with the new component

Procedure

  1. Check existing components

  • Check whether src/components/ui/<ComponentName> or src/components/features/<ComponentName> already exists.

  • If it exists, do not overwrite; confirm the preferred approach with the user.

  1. Decide target directory

  • ui: src/components/ui/<ComponentName>

  • features: src/components/features/<ComponentName>

  1. Re-check classification (only when ui is specified)

  • Even when ui is specified, before creating files, review Reclassification Rule in references/component-architecture.md.

  • If the implementation includes state management, side effects, async processing, context/store updates, or business logic, treat it as features.

  • If the result is closer to features, do not proceed as ui; use ask_user and confirm one of the following before continuing.

    • Create as features

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

  1. Create required files

  • ui: index.tsx, index.module.scss, index.stories.tsx

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

  1. Replace existing usages (only when creating ui)

  • Only when the user approves, replace equivalent direct implementations using Mantine or other UI libraries in existing features with the new ui component.

  1. Validate

  • Run build and lint commands, and ensure both pass; if issues are introduced by newly added or updated files, fix them.

  • Follow Storybook Minimum in references/component-architecture.md for story state decisions.

  • Ask the user via ask_user whether to run a Storybook check (for example: "Run" / "Skip for now").

  • Run npm run storybook only if the user selects "Run".

  • If the user selects "Skip for now", explicitly mention in the final report that Storybook execution was skipped.

Output Contract

  • Report the list of files created.

  • If replacements were performed, report the list of changed files and replacement details.

  • Provide one usage example of the created component.

  • Report whether Storybook verification was executed (run/skip), and if run, include the command used.

  • Explain why the component was classified as ui or features.

  • Summarize where state, side effects, and rendering responsibilities were placed.

  • Confirm whether there were any dependency direction violations.

  • Clearly state any unresolved items.

Files

references/component-architecture.md

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
TypeResponsibility
uiReusable render-only component. Must not include business logic, side effects, or state management.
featuresUse-case-oriented component. Handles state transitions, event interpretation, and async orchestration.
2. Internal Layer in features
LayerResponsibilityPrimary files
containerHandles state management, side effects, event handling, and data fetching.index.tsx, use<ComponentName>.tsx, types.ts
presentationReceives 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.

Requirements and compatibility

Written for: GitHub Copilot, Claude Code

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Claude Code frontmatter, Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

First committed by
GitHub avatar of tmt823tmt823
Publisher
GitHub (Official)
Distributed by
GitHub
Source
github/awesome-copilot · skills/react-container-presentation-component · commit 797337f
Licence
MIT License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced
Contributors
tmt823

AutoGineer is not affiliated with or endorsed by tmt823 or GitHub.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download react-container-presentation-component.zip