functional cohesion components

Design Community

Skill notes

Purpose

Use functional cohesion to keep frontend components aligned with product responsibilities. Prefer components that represent one meaningful feature, role, or workflow over components that switch many responsibilities with flags. Use this skill to answer: "Should this UI be one component with conditions, split into multiple components, or partially commonized?"

Core Rule

Prefer functional cohesion: Split by responsibility when UI represents different roles, workflows, permissions, states, or user intentions. Commonize only a meaningful unit, not a visually similar fragment. Keep unavoidable branching near the boundary that decides what feature is being rendered. Avoid logical cohesion: one component that groups similar-looking behavior and switches responsibilities with role, type, or many boolean flags.

Review Workflow

Identify the feature boundary. Ask what product responsibility the component represents: buyer view, seller view, admin operation, notification kind, file row, directory row, create page, edit page, etc. List the differences. Check displayed data, actions, navigation target, permissions, validation, empty/error states, mobile behavior, and future variation risk. Decide where branching belongs.

Route-Separable Screens

When routing already separates roles or page purposes, let the route call different page components. Good examples: BuyerProductPage and SellerProductPage from role-specific routes. CreateProductPage and EditProductPage as separate pages. A shared ProductForm only when schema and field responsibility are truly the same.

Data-Type Branching

When API data determines the UI type, a branch is unavoidable. Do not scatter the same branch across icon, click handler, menu items, and layout. Prefer: A parent dispatcher such as FileSystemRow. A list.map() branch that chooses DirectoryRow or FileRow. Exhaustive matching for discriminated unions.

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Design
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@yutakobayashidev · no license declared
Token usage
Lean
Setup complexity
Plug-and-play
External API key
Not required
Operating systems
Unspecified (assume cross-platform)
Runtime requirements
No explicit requirements detected
Detected file/system behavior
  • Read-only
  • Write / modify
Network behavior
Local-only
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

Output preview functional-cohesion-components.preview
# Review Output

1. Current cohesion: functional, logical, or mixed.
2. Main risk: the concrete branch or shared unit likely to grow.
3. Recommended boundary: route/page, dispatcher, row/component, form, or feature prop.
4. Duplication decision: what to duplicate intentionally and what to share.
5. Verification: type exhaustiveness, affected role flows, and tests or story cases to cover.

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.