본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)6.0k · #14442

pinia

하는 일

이 스킬은 Vue의 공식 상태 라이브러리인 Pinia로 Vue 앱의 공유 데이터를 정리하는 방법을 설명합니다. 앱의 여러 부분에서 같은 데이터가 필요한 개발자를 위한 것입니다.

사용하는 경우

  • ✓앱의 많은 컴포넌트가 데이터를 공유해야 하는 Vue 앱을 만들 때.
  • ✓상태, 게터, 액션이 있는 스토어를 설정하고 싶을 때.
  • ✓Pinia 스토어를 테스트하거나 확장해야 할 때.

스킬 링크

https://github.com/antfu/skills/blob/main/skills/pinia/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/antfu/skills/blob/main/skills/pinia/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“장바구니 항목과 합계를 모든 페이지에서 유지하는 Pinia 스토어를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 공유 데이터를 담고 그것을 바꾸는 액션을 가진 스토어를 설정합니다. 타입, 테스트, 확장에 관한 Pinia 안내를 따릅니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Pinia

Pinia is the official state management library for Vue, designed to be intuitive and type-safe. It supports both Options API and Composition API styles, with first-class TypeScript support and devtools integration.

The skill is based on Pinia v4.0.3, generated at 2026-09-25.

Core References

Topic Description Reference
Stores Defining stores, state, getters, actions, storeToRefs, subscriptions core-stores

Features

Extensibility

Topic Description Reference
Plugins Extend stores with custom properties, state, and behavior features-plugins

Composability

Topic Description Reference
Composables Using Vue composables within stores (VueUse, etc.) features-composables
Composing Stores Store-to-store communication, avoiding circular dependencies features-composing-stores

Best Practices

Topic Description Reference
Testing Unit testing with @pinia/testing, mocking, stubbing best-practices-testing
Outside Components Using stores in navigation guards, plugins, middlewares best-practices-outside-component

Advanced

Topic Description Reference
SSR Server-side rendering, state hydration advanced-ssr
Nuxt Nuxt integration, auto-imports, SSR best practices advanced-nuxt
HMR Hot module replacement for development advanced-hmr

Key Recommendations

  • Prefer Setup Stores for complex logic, composables, and watchers
  • Use storeToRefs() when destructuring state/getters to preserve reactivity
  • Actions can be destructured directly - they're bound to the store
  • Call stores inside functions not at module scope, especially for SSR
  • Add HMR support to each store for better development experience
  • Use @pinia/testing for component tests with mocked stores
자주 묻는 질문

Pinia는 Vue 전용인가요?

네. Vue 앱을 위해 만들어졌으며, 이 스킬의 안내도 그 내용을 다룹니다.

스토어를 테스트할 수 있나요?

네. 스토어 테스트와 모킹에 대한 안내를 포함합니다.

TypeScript와 함께 쓸 수 있나요?

네. Pinia는 타입 안전성을 갖추도록 설계되었으며 TypeScript를 지원합니다.

상세 정보

작성자의 원본 설명

Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.

repo: antfu/skills

인기도

GitHub 스타
6.0k
순위
#14442
라이선스
MIT
업데이트
2026. 10. 30.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬