cqrs-implementation
यह क्या करती है
यह गाइड सिखाता है कि सिस्टम में डेटा लिखने और पढ़ने के काम को कैसे अलग किया जाए। इससे सिस्टम तेज़ और ज़्यादा व्यवस्थित बनता है, खासकर जब बहुत सारी जानकारी पढ़ी या बदली जा रही हो।
कब इस्तेमाल करें
- ✓जब आपको डेटा लिखने और पढ़ने का काम अलग-अलग तरीके से करवाना हो।
- ✓लिखने के काम को प्रभावित किए बिना सिस्टम का पढ़ने वाला हिस्सा तेज़ करने के लिए।
- ✓ऐसे सिस्टम बनाते समय जो हर बदलाव को इवेंट के रूप में रिकॉर्ड करते हैं।
Skill का लिंक
https://github.com/wshobson/agents/blob/main/plugins/backend-development/skills/cqrs-implementation/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“जटिल रिपोर्ट्स की स्पीड बढ़ाने के लिए मैं CQRS कैसे इस्तेमाल करूँ?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह काम को दो हिस्सों में बाँटता है: commands (डेटा बदलने के लिए) और queries (डेटा पढ़ने के लिए)। हर हिस्से को अलग से optimize किया जा सकता है, अलग डेटा मॉडल के साथ और परफ़ॉर्मेंस पर ध्यान देकर।
तकनीकी सामग्री (मूल 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
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
screen-reader-testing
41kआपके एजेंट को screen readers का इस्तेमाल करके वेबसाइटों की जांच करने देता है, ताकि यह पक्का हो सके कि वे accessible हैं।
wcag-audit-patterns
41kआपके एजेंट को वेबसाइटों का accessibility audit करने और WCAG guidelines के हिसाब से समस्याएं ठीक करने में मदद करता है।
multi-reviewer-patterns
41kआपके एजेंट को कई code reviews को एक साथ चलाने देता है। यह एक जैसे findings हटाता है और सारी रिपोर्ट को एक जगह जोड़ता है।
parallel-debugging
41kआपके एजेंट को parallel जांच के साथ जटिल समस्याओं को debug करने और root cause analysis में मदद करता है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।