container-presentational

Separate data fetching and business logic from presentation in Vue applications.

235|25|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/PatternsDev/skills --skill container-presentational
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: container-presentational
Source: https://github.com/PatternsDev/skills/tree/main/vue/container-presentational
Command: npx skills add https://github.com/PatternsDev/skills --skill container-presentational

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Data-heavy Vue components often mix business logic with presentation, making testing and reuse harder. This skill teaches a clear separation using container/presentational patterns, improving maintainability and scalability of Vue interfaces.

Core Features & Use Cases

  • Presentational components render UI and are stateless, while container components manage data fetching and state.
  • Composables offer a lightweight alternative for sharing logic without wrappers, supporting clean architecture.
  • Use cases include refactoring legacy Vue components into reusable, testable units and designing scalable UI architectures.

Quick Start

Refactor your Vue app to separate data logic from presentation by introducing container and presentational components.

Frequently Asked Questions about container-presentational

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate business logic from UI in Vue components?

To separate business logic from UI in Vue components, use the container-presentational pattern where container components manage data fetching and state while presentational components handle stateless rendering. This approach improves component testability and reuse.

What is the best way to refactor data-heavy Vue components for better testability?

The best way to refactor data-heavy Vue components is splitting them into container components for state management and presentational components for UI rendering, or extracting shared logic into composables to achieve a clean, maintainable architecture.

When should I use composables instead of container components in Vue?

Use composables instead of container components when you need a lightweight alternative for sharing logic without adding wrapper components. Composables support clean architecture by extracting reusable data-fetching logic directly into reactive functions.

Does the container-presentational pattern work with both Vue 2 and Vue 3?

Yes, the container-presentational pattern works with both Vue 2 and Vue 3 projects. It provides guidelines for separating data fetching from presentation across both versions, though Vue 3 composables offer an additional lightweight alternative for logic reuse.

Why does mixing data fetching and presentation make Vue components harder to test?

Mixing data fetching and presentation makes Vue components harder to test because business logic and UI rendering are tightly coupled. Separating them into container and presentational components isolates state management, allowing you to test UI and logic independently.

Can I use container-presentational component design for scalable Vue architectures?

Yes, you can use container-presentational component design to build scalable Vue architectures. By cleanly uncoupling data logic from presentation, it transforms legacy components into reusable, testable units that support maintainable interface growth.