मुख्य सामग्री पर जाएँ
Skillpedia
API और सर्वर (backend)15k · #10987

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 पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-separate-before-serializing-shared-state/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

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:

  1. Identify shared mutable state (files both read and write, branches both push to, APIs both define and consume).
  2. 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 lastX field into one state.json is still shared mutation. indexer-state.json + metrics-state.json is not.
  3. 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

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

advisor

15k

अगर आप इसे चालू करते हैं, तो आपका एजेंट बड़े फ़ैसले से पहले या किसी त्रुटि में अटकने पर एक ज़्यादा शक्तिशाली दूसरे मॉडल से सलाह ले सकता है।

AI और एजेंटएजेंट

check-agent-compatibility

15k

जाँचती है कि AI कोडिंग एजेंट किसी रिपॉज़िटरी को शुरू, सत्यापित और दस्तावेज़ित कर सकते हैं या नहीं, और एक अनुकूलता स्कोर के साथ मुख्य समस्याएँ लौटाती है।

कोडिंगडिप्लॉय और क्लाउड (DevOps)

cli-for-agents

15k

आपके एजेंट को कमांड-लाइन टूल ऐसे डिज़ाइन या जाँचना सिखाती है कि AI एजेंट उन्हें बिना प्रॉम्प्ट चला सकें, साफ़ help टेक्स्ट और उदाहरणों के साथ।

कोडिंगAPI और सर्वर (backend)

continual-learning

15k

पिछली चैट की समीक्षा का काम एक समर्पित मेमोरी अपडेटर को सौंपकर आपकी AGENTS.md नोट्स को अद्यतन रखती है।

AI और एजेंटएजेंट

मिलती-जुलती skills