principle-separate-before-serializing-shared-state
यह क्या करती है
यह स्किल असिस्टेंट को समानांतर काम के लिए नियम देती है, जहाँ एक ही फ़ाइल, ब्रांच या स्टेट में लिखा जा सकता है। यह उन इंजीनियरों के लिए है जो एक साथ कई वर्कर या एजेंट चलाते हैं।
कब इस्तेमाल करें
- ✓जब कई एजेंट या प्रोसेस एक ही फ़ाइल या स्टेट ऑब्जेक्ट में लिख सकते हों।
- ✓जब दो ब्रांच या वर्कर एक ही लक्ष्य पर पुश करेंगे।
- ✓जब आप रुक-रुक कर होने वाली race condition ठीक करने के लिए lock जोड़ने का सोच रहे हों।
Skill का लिंक
https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-separate-before-serializing-shared-state/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“तीन एजेंट एक साझा status फ़ाइल में लिखते हैं और वह बार-बार खराब हो जाती है। डिज़ाइन ठीक कीजिए।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
असिस्टेंट पूछता है कि क्या वर्कर्स को सच में एक ही साझा ऑब्जेक्ट चाहिए। अगर नहीं, तो हर एक को अपनी फ़ाइल या key देता है और केवल रिपोर्टिंग के चरण पर मिलाता है। केवल तभी संरचनात्मक क्रम, जैसे lock, जोड़ता है जब सच में एक ही साझा लेखक ज़रूरी हो।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Separate Before Serializing Shared State
When concurrent actors might share mutable state, first ask whether they need the same mutable object. If not, eliminate the sharing. When sharing is real, enforce serialization structurally: lockfiles, sequential phases, exclusive ownership. Instructions and conventions are not concurrency control.
Why: Concurrent writes to shared state create race conditions that are intermittent, hard to reproduce, and expensive to debug.
Pattern:
- Identify shared mutable state (files both read and write, branches both push to, APIs both define and consume).
- Default: eliminate the shared write target. Ask: do these actors need one canonical object, or are they publishing independent facts? Give each actor its own owned file, key, branch, or state directory, and merge only at the read/reporting boundary. Two workers writing their own
lastXfield into onestate.jsonis still shared mutation.indexer-state.json+metrics-state.jsonis not. - Only when one shared write target is a real invariant, serialize access structurally (lockfiles, sequential phases, single-writer actor, or atomic compare-and-swap). Treat "we need a lock" as a design smell to check, not as the default answer.
अक्सर पूछे जाने वाले सवाल
क्या निर्देश टकराव रोकने के लिए काफ़ी हैं?
नहीं। स्किल कहती है कि निर्देश और परंपराएँ concurrency नियंत्रण नहीं हैं।
क्या lock डिफ़ॉल्ट समाधान है?
नहीं। स्किल lock की ज़रूरत को पहले जाँचने योग्य डिज़ाइन की गंध मानती है।
अच्छा विभाजन कैसा होता है?
हर एक्टर के अपने स्टेट फ़ाइल, बजाय इसके कि कई वर्कर एक ही साझा फ़ाइल में लिखें।
जानकारी
लेखक का मूल विवरण
Apply when concurrent actors might write to the same file, branch, key, or state object. Eliminate the sharing first; serialize structurally only when one shared writer is a real invariant.
repo: cursor/plugins
लोकप्रियता
- GitHub स्टार
- 15k
- रैंकिंग में स्थान
- #10987
- लाइसेंस
- —
- अपडेट की गई
- 31/10/2026
कमेंट
- …
इस repository की और skills
advisor
15kअगर आप इसे चालू करते हैं, तो आपका एजेंट बड़े फ़ैसले से पहले या किसी त्रुटि में अटकने पर एक ज़्यादा शक्तिशाली दूसरे मॉडल से सलाह ले सकता है।
check-agent-compatibility
15kजाँचती है कि AI कोडिंग एजेंट किसी रिपॉज़िटरी को शुरू, सत्यापित और दस्तावेज़ित कर सकते हैं या नहीं, और एक अनुकूलता स्कोर के साथ मुख्य समस्याएँ लौटाती है।
cli-for-agents
15kआपके एजेंट को कमांड-लाइन टूल ऐसे डिज़ाइन या जाँचना सिखाती है कि AI एजेंट उन्हें बिना प्रॉम्प्ट चला सकें, साफ़ help टेक्स्ट और उदाहरणों के साथ।
continual-learning
15kपिछली चैट की समीक्षा का काम एक समर्पित मेमोरी अपडेटर को सौंपकर आपकी AGENTS.md नोट्स को अद्यतन रखती है।
मिलती-जुलती 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 करने के लिए उपयोगी है।