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.
- Component name
- Type (
ui or features)
- 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
- 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.
- Decide target directory
ui: src/components/ui/<ComponentName>
features: src/components/features/<ComponentName>
- 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
- 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
- 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.
- 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.
1---2name: react-container-presentation-component3description: Scaffold React components following the Container/Presentation pattern under src/components, with TypeScript, Storybook, and SCSS conventions.4---56# Container/Presentation Component78Use this skill to create a React component under `src/components` that follows the Container/Presentation pattern.910Refer to this skill's bundled references for detailed rules.1112- `references/component-architecture.md`13- `references/typescript-and-scss-rules.md`1415If the `/react-container-presentation-component` input is incomplete, ask questions first before creating files.1617## When To Use1819- When the user runs `/react-container-presentation-component`20- When the user explicitly asks for a React component that follows the Container/Presentation pattern21- When the user wants help deciding or implementing `ui` vs `features` classification within the Container/Presentation pattern2223## Required Questions2425If any of the following information is missing, ask the user using `ask_user`.26271. Component name282. Type (`ui` or `features`)293. Whether to replace existing components (only when creating `ui`)3031Question requirements:3233- Provide the type as options (`ui`, `features`)34- Require the component name to be in PascalCase35- For `ui`, ask whether direct usage of Mantine or other UI libraries in existing `features` should be replaced with the new component3637## Procedure38391. Check existing components4041- Check whether `src/components/ui/<ComponentName>` or `src/components/features/<ComponentName>` already exists.42- If it exists, do not overwrite; confirm the preferred approach with the user.43442. Decide target directory4546- `ui`: `src/components/ui/<ComponentName>`47- `features`: `src/components/features/<ComponentName>`48493. Re-check classification (only when `ui` is specified)5051- Even when `ui` is specified, before creating files, review `Reclassification Rule` in `references/component-architecture.md`.52- If the implementation includes state management, side effects, async processing, context/store updates, or business logic, treat it as `features`.53- If the result is closer to `features`, do not proceed as `ui`; use `ask_user` and confirm one of the following before continuing.54 - `Create as features`55 - `Keep ui and move state/logic to parent or features`56574. Create required files5859- `ui`: `index.tsx`, `index.module.scss`, `index.stories.tsx`60- `features`: `index.tsx`, `use<ComponentName>.tsx`, `presentation.tsx`, `types.ts`, `presentation.module.scss`, `presentation.stories.tsx`61625. Replace existing usages (only when creating `ui`)6364- Only when the user approves, replace equivalent direct implementations using Mantine or other UI libraries in existing `features` with the new `ui` component.65666. Validate6768- Run build and lint commands, and ensure both pass; if issues are introduced by newly added or updated files, fix them.69- Follow `Storybook Minimum` in `references/component-architecture.md` for story state decisions.70- Ask the user via `ask_user` whether to run a Storybook check (for example: "Run" / "Skip for now").71- Run `npm run storybook` only if the user selects "Run".72- If the user selects "Skip for now", explicitly mention in the final report that Storybook execution was skipped.7374## Output Contract7576- Report the list of files created.77- If replacements were performed, report the list of changed files and replacement details.78- Provide one usage example of the created component.79- Report whether Storybook verification was executed (run/skip), and if run, include the command used.80- Explain why the component was classified as `ui` or `features`.81- Summarize where state, side effects, and rendering responsibilities were placed.82- Confirm whether there were any dependency direction violations.83- Clearly state any unresolved items.