cqrs-implementation
하는 일
이 가이드는 시스템에서 데이터 쓰기 작업과 읽기 작업을 분리하는 방법을 가르칩니다. 특히 많은 정보가 조회되거나 수정될 때, 시스템을 더 빠르고 체계적으로 만드는 데 도움이 됩니다.
사용하는 경우
- ✓데이터 쓰기와 읽기가 서로 다른 방식으로 작동해야 할 때.
- ✓쓰기에 영향을 주지 않으면서 시스템의 읽기 부분을 더 빠르게 만들려는 경우.
- ✓모든 변경을 이벤트로 기록하는 시스템을 만들 때.
스킬 링크
https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/cqrs-implementation/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“CQRS를 사용해 복잡한 보고서의 속도를 최적화하려면 어떻게 하면 좋을까요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
작업을 두 부분, 즉 명령(데이터 변경)과 질의(데이터 읽기)로 나눕니다. 각 부분은 서로 다른 데이터 모델을 사용해 따로 최적화할 수 있으며, 성능에 집중합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
CQRS Implementation
Comprehensive guide to implementing CQRS (Command Query Responsibility Segregation) patterns.
When to Use This Skill
- Separating read and write concerns
- Scaling reads independently from writes
- Building event-sourced systems
- Optimizing complex query scenarios
- Different read/write data models needed
- High-performance reporting requirements
Core Concepts
1. CQRS Architecture
┌─────────────┐
│ Client │
└──────┬──────┘
│
┌────────────┴────────────┐
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Commands │ │ Queries │
│ API │ │ API │
└──────┬──────┘ └──────┬──────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Command │ │ Query │
│ Handlers │ │ Handlers │
└──────┬──────┘ └──────┬──────┘
│ │
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Write │─────────►│ Read │
│ Model │ Events │ Model │
└─────────────┘ └─────────────┘
2. Key Components
| Component | Responsibility |
|---|---|
| Command | Intent to change state |
| Command Handler | Validates and executes commands |
| Event | Record of state change |
| Query | Request for data |
| Query Handler | Retrieves data from read model |
| Projector | Updates read model from events |
Templates and detailed worked examples
Full template library and detailed worked examples live in references/details.md. Read that file when you need the concrete templates.
Best Practices
Do's
- Separate command and query models - Different needs
- Use eventual consistency - Accept propagation delay
- Validate in command handlers - Before state change
- Denormalize read models - Optimize for queries
- Version your events - For schema evolution
Don'ts
- Don't query in commands - Use only for writes
- Don't couple read/write schemas - Independent evolution
- Don't over-engineer - Start simple
- Don't ignore consistency SLAs - Define acceptable lag
자주 묻는 질문
'최종 일관성(eventual consistency)'이란 무엇인가요?
데이터가 시스템의 모든 부분에 업데이트되기까지 잠시 걸릴 수 있지만, 결국에는 올바르게 된다는 뜻입니다.
읽기 모델과 쓰기 모델을 왜 나누나요?
요구 사항이 다르기 때문입니다. 쓰기 모델은 데이터 무결성을 보장해야 하고, 읽기 모델은 질문에 빠르게 답해야 합니다.
간단한 구현으로 시작할 수 있나요?
네. 간단하게 시작하고, 정말 필요할 때만 복잡성을 더하는 것을 권장합니다.
상세 정보
작성자의 원본 설명
Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.
repo: wshobson/agents
인기도
- GitHub 스타
- 41k
- 순위
- #6637
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
screen-reader-testing
41k에이전트가 스크린 리더로 웹사이트를 테스트해 접근성을 확인하도록 돕습니다.
wcag-audit-patterns
41k에이전트가 WCAG 지침에 따라 웹사이트의 접근성을 감사하고 문제를 고치도록 돕습니다.
multi-reviewer-patterns
41k에이전트가 병렬 코드 리뷰를 조율하고, 중복된 발견 사항을 정리하며, 보고서를 통합하도록 돕습니다.
parallel-debugging
41k에이전트가 병렬 조사와 근본 원인 분석으로 복잡한 문제를 디버그하도록 돕습니다.
비슷한 스킬
api-connector-builder
280k에이전트가 기존 패턴을 따라 새로운 API 연결을 만들도록 합니다. 새로운 방식을 도입하지 않고 연동을 하나 더 추가할 때 씁니다.
api-design
280k에이전트가 모범 사례에 따라 REST API를 설계하도록 돕습니다. API가 통신하는 방식, 오류를 보여 주는 방식, 데이터를 정리하는 방식을 정하는 데 유용합니다.
backend-patterns
280k에이전트가 서버 쪽 아키텍처 패턴과 데이터베이스 최적화를 다루도록 돕습니다. 서버에서 실행되는 코드를 만들거나 검토할 때 유용합니다.