dom-performance
यह क्या करती है
यह स्किल पेज के ऐसे कोड को खोजती है जो लगातार लेआउट पढ़ता और बदलता रहता है, जिससे धीमी दोबारा गणनाएँ होती हैं। यह सुचारु और प्रतिक्रियाशील पेज चाहने वाले डेवलपर के लिए है।
कब इस्तेमाल करें
- ✓जब एनिमेशन या अपडेट के दौरान पेज कुछ पल के लिए जम जाता है।
- ✓जब कोई स्क्रिप्ट लूप के भीतर कई एलिमेंट अपडेट करती है।
- ✓जब स्क्रॉल या टच क्रियाएँ सुस्त लगती हैं।
Skill का लिंक
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/dom-performance/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“क्या आप मेरा कोड जाँच सकते हैं कि ऐसे चरण तो नहीं जो पेज को अपडेट होने में धीमा करते हैं?”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
एजेंट ऐसी जगहें खोजता है जहाँ पेज लेआउट पढ़ना और लिखना आपस में मिले हैं। वह पहले सारे पढ़ने और फिर सारे लिखने का सुझाव देता है, और कुछ स्क्रॉल लिसनर को passive चिह्नित करता है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
Minimize costly DOM read/write operations
Every time you read a layout property after making a DOM change, the browser must synchronously recalculate layout (reflow) before returning the value. Doing this in a loop — even with just 10 elements — can freeze the page for hundreds of milliseconds. This is called layout thrashing and is one of the most common causes of janky animations and slow renders.
Quick Reference
- Never interleave DOM reads (offsetHeight, getBoundingClientRect) with DOM writes (style changes)
- Batch all reads first, then all writes
- Use requestAnimationFrame for visual updates
- Use DocumentFragment or innerHTML for bulk DOM insertion
- Avoid per-frame React state updates across many visible components when a simpler CSS or reduced-frequency approach would work
- Use passive listeners for scroll, touch, and wheel when you do not call preventDefault
Check
Identify any layout thrashing in this code — places where DOM reads and writes are interleaved in loops. Also flag scroll, touch, and wheel listeners that should be passive to avoid blocking the main thread.
Fix
Refactor this code to batch all DOM reads before writes, eliminating forced synchronous layouts. Mark relevant listeners as passive when they do not need to cancel scrolling.
Explain
Explain layout thrashing, what causes it, and how batching reads and writes prevents it.
Code Review
Review scripts, client components, and browser execution paths related to Minimize costly DOM read/write operations. Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/javascript/dom-performance
अक्सर पूछे जाने वाले सवाल
layout thrashing क्या है?
जब एक अपडेट के दौरान ब्राउज़र को बार-बार लेआउट दोबारा गिनना पड़ता है, जिससे पेज कुछ पल के लिए जम सकता है।
passive लिसनर क्या है?
यह ब्राउज़र को बताता है कि स्क्रॉल या टच हैंडलर स्क्रॉलिंग नहीं रोकेगा, ताकि स्क्रॉलिंग सुचारु रहे।
क्या इसमें React की स्टेट अपडेट भी आते हैं?
स्किल कहती है कि कई कंपोनेंट में फ़्रेम-आधारित बार-बार स्टेट अपडेट, अगर कोड में दिखें, तो प्रदर्शन की समस्या बन सकते हैं।
जानकारी
लेखक का मूल विवरण
Use when reviewing scripts, client components, bundles, or runtime behavior related to Minimize costly DOM read/write operations. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug. In React, repeated requestAnimationFrame-driven state updates across multiple mounted components are a valid performance smell when visible in the source.
लोकप्रियता
- GitHub स्टार
- 75k
- रैंकिंग में स्थान
- #2820
- लाइसेंस
- MIT
- अपडेट की गई
- 31/10/2026
कमेंट
- …
इस repository की और skills
frontendchecklist
75kकमांड-लाइन टूल से फ़्रंटएंड कोड और लाइव पेजों को एक्सेसिबिलिटी, स्पीड, SEO और सिक्योरिटी के 380 से ज़्यादा नियमों से जाँचती है।
frontend-checklist-global
75kफ़्रंटएंड प्रोजेक्ट को Front-End Checklist के सभी 386 नियमों से ऑडिट करती है, और हर मिली समस्या का ठोस समाधान देती है।
404-page
75kजाँचती है कि आपका गुम पेज उपयोगी लिंक देता है और सही 404 स्टेटस लौटाता है, ताकि भटके हुए विज़िटर रास्ता ढूँढ सकें।
about-page
75kजाँचती है कि आपकी साइट पर एक साफ़ About पेज है जो बताता है कि उसे कौन चलाता है, ताकि विज़िटर और सर्च इंजन का भरोसा बढ़े।
मिलती-जुलती skills
angular-developer
280kआपके एजेंट को Angular code बनाने और प्रोजेक्ट स्ट्रक्चर पर सलाह देने में मदद करता है। नए प्रोजेक्ट शुरू करने, code के हिस्से बनाने, या performance और accessibility सुधारने में उपयोगी है।
frontend-a11y
280kआपके एजेंट को web interfaces को सबके लिए accessible बनाने में मदद करता है। यह सुनिश्चित करता है कि websites और apps screen readers और keyboard navigation के साथ अच्छे से काम करें।
frontend-patterns
280kआपके एजेंट को React और Next.js में frontend development के modern patterns लागू करने में मदद करता है। यह performance optimize करता है, state manage करता है और best practices फॉलो करवाता है।