component-patterns
Component patterns — container/presentational for React/Vue/Angular.
Skill by Dev-Toolbelt
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/dev-toolbelt-component-patterns
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: frontend
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/component-patterns
What's inside
- Skill name
component-patterns- Description
- Component patterns — container/presentational for React/Vue/Angular.
- License
- MIT
- Instructions
- 176 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
# Component Patterns
## Container / Presentational (Smart / Dumb)
The core idea: separate **what data comes from** (container) from **how it looks** (presentational). Presentational components receive everything via props/inputs — they own no side effects and no data fetching.
| Aspect | Container (Smart) | Presentational (Dumb) |
|---|---|---|
| Responsibility | Fetch data, manage state, handle business logic | Render UI, emit user events |
| Dependencies | API clients, stores, router | None beyond UI primitives |
| Reusability | Low — tied to a specific domain | High — usable anywhere |
| Testability | Test behavior + integration | Test with prop snapshots / storybook |
| State | Owns or subscribes to state | Receives everything via props/inputs |
**When to split**: as soon as a component both fetches data AND renders UI, extract the rendering into a presentational child. This makes the UI testable without mocking the network.
---
## Rules
- **One reason to change**: if a component would change for a UI tweak AND for an API change, split it.
- **No business logic in templates**: move conditionals, transforms, and computations to hooks, composables, or services — not inline in JSX/template.
- **Props down, events up**: data flows down via props/inputs; user intent flows up via callbacks/emits/outputs.
- **Max ~150 lines per component**: a component that exceeds this is doing too much; split before it grows further.
- **Prop sprawl**: more than 5–7 props is a design smell — consider decomposition or a configuration object.
- **No cross-feature imports**: a component in `features/orders` must not import directly from `features/users`; go through a shared layer.
---
## React
```tsx
// Container — owns data fetching and state
function OrderListContainer() {
const { data, isLoading, error } = useOrders()
if (isLoading) return <Spinner />
if (error) return <ErrorMessage error={error} />
return <OrderList orders={data} />
}
// Presentational — pure render, fully testable with props alone
function OrderList({ orders }: { orders: Order[] }) {
return (
<ul>
{orders.map(o => <OrderItem key={o.id} order={o} />)}
</ul>
)
}
```
**React-specific rules**:
- Custom hooks are the idiomatic container layer — prefer `useOrders()` over class-based containers.
- Wrap page-level components in an `ErrorBoundary`; presentational components should not catch errors themselves.
- Use `React.memo` on stable presentational components to avoid unnecessary re-renders from parent state changes.
---
## Vue
```vue
<!-- Container -->
<script setup lang="ts">
const { orders, isLoading, error } = useOrders()
</script>
<template>
<Spinner v-if="isLoading" />
<ErrorMessage v-else-if="error" :error="error" />
<OrderList v-else :orders="orders" />
</template>
<!-- Presentational -->
<script setup lang="ts">
defineProps<{ orders: Order[] }>()
</script>
<template>
<ul>
<OrderItem v-for="o in orders" :key="o.id" :order="o" />
</ul>
</template>
```
**Vue-specific rules**:
- Composables (`useX`) are the Vue equivalent of React hooks — put all fetching and state logic there.
- Use `defineProps` with explicit types; avoid prop drilling beyond two levels — use `provide`/`inject` or a store.
- Emit events with `defineEmits` and typed payloads; never mutate a prop directly.
---
## Angular
```typescript
// Container — smart component, injects service
@Component({
selector: 'app-order-list-container',
template: `
<app-spinner *ngIf="isLoading" />
<app-error-message *ngIf="error" [error]="error" />
<app-order-list *ngIf="!isLoading && !error" [orders]="orders" />
`
})
export class OrderListContainerComponent implements OnInit {
orders: Order[] = []
isLoading = false
error: Error | null = null
constructor(private orderService: OrderService) {}
ngOnInit() {
this.isLoading = true
this.orderService.getOrders().subscribe({
next: orders => { this.orders = orders; this.isLoading = false },
error: err => { this.error = err; this.isLoading = false }
})
}
}
// Presentational — dumb component, only @Input / @Output
@Component({
selector: 'app-order-list',From Dev-Toolbelt/dev-team-agents, MIT.
More from Dev-Toolbelt/dev-team-agents
- 0.623score
design-patterns
Dev-Toolbelt
Design patterns — KISS, YAGNI, DRY, SOLID, GoF, DDD reference.
SkillAFreshness: A★ 7Claude Code +9 - 0.620score
graphql
Dev-Toolbelt
GraphQL — schema, resolvers, N+1/DataLoader, pagination.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-design
Dev-Toolbelt
REST/GraphQL design — naming, status codes, pagination, idempotency.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-versioning
Dev-Toolbelt
API versioning — compatibility rules and deprecation lifecycle.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
architecture-docs
Dev-Toolbelt
Where architecture documents live, what each contains, and the conformance report format.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
async-jobs
Dev-Toolbelt
Async jobs — idempotency, retry strategy, DLQ, observability.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
i18n
Dev-Toolbelt
i18n/l10n — locale detection, translations, pluralization, RTL.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
css-quality
Dev-Toolbelt
CSS quality — specificity, magic numbers, responsive.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
data-fetching-integrity
Dev-Toolbelt
Detect and prevent duplicate/redundant API calls in SPA/SSG frontends — tool-agnostic.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
event-driven
Dev-Toolbelt
Event-driven — sourcing, CQRS, saga, idempotency, schema registry.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
form-handling
Dev-Toolbelt
Form design — state, validation, error feedback.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
frontend-patterns
Dev-Toolbelt
Frontend patterns — debounce, double-submit prevention, error boundaries.
SkillAFreshness: A★ 7Claude Code +9
Signals
- Stars
- 7
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 18, 2026 (10 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Dev-Toolbelt/dev-team-agents
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Dev-Toolbelt
- 0.623score
design-patterns
Dev-Toolbelt
Design patterns — KISS, YAGNI, DRY, SOLID, GoF, DDD reference.
SkillAFreshness: A★ 7Claude Code +9 - 0.620score
graphql
Dev-Toolbelt
GraphQL — schema, resolvers, N+1/DataLoader, pagination.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-design
Dev-Toolbelt
REST/GraphQL design — naming, status codes, pagination, idempotency.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
architecture-docs
Dev-Toolbelt
Where architecture documents live, what each contains, and the conformance report format.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
async-jobs
Dev-Toolbelt
Async jobs — idempotency, retry strategy, DLQ, observability.
SkillAFreshness: A★ 7Claude Code +9 - 0.618score
api-versioning
Dev-Toolbelt
API versioning — compatibility rules and deprecation lifecycle.
SkillAFreshness: A★ 7Claude Code +9
Cite this page
component-patterns skill. Agent Mart. https://agentmart.dev/skills/dev-toolbelt-component-patterns (last updated 2026-10-24)