debounce-throttle
できること
このスキルは、スクロール、リサイズ、入力などの素早い操作に反応するWebサイトのコードをレビューします。より滑らかなページを求める開発者向けです。
使う場面
- ✓誰かが入力している間に、検索ボックスが多すぎるリクエストを送るとき。
- ✓ページのスクロールやリサイズがもたついて感じられるとき。
- ✓スクリプトが必要以上に頻繁に実行されているとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/debounce-throttle/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私のスクロールと入力の処理にもたつきがないか、確認してもらえますか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは素早いイベントで実行されるコードを見つけ、debounceまたはthrottleを提案します。debounceは操作が止まるまで待ち、throttleはコードの実行頻度を制限します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Debounce and throttle event handlers
High-frequency events fire hundreds of times per second, causing UI jank, excessive API calls, and poor Interaction to Next Paint (INP) scores.
Quick Reference
- Debounce: delays execution until activity stops (search inputs, form validation)
- Throttle: limits execution rate (scroll, resize handlers)
- Use 150-300ms delay for user input, 100ms for scroll/resize
- Clean up event listeners to prevent memory leaks
Check
Review this JavaScript code for scroll, resize, input, mousemove, or other high-frequency event handlers that should use debounce or throttle.
Fix
Add debounce or throttle to high-frequency event handlers to limit execution rate and improve performance.
Explain
Explain the difference between debounce and throttle, and when to use each pattern for optimal performance.
Code Review
Review scripts, client components, and browser execution paths related to Debounce and throttle event handlers. 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/debounce-throttle
よくある質問
debounceとthrottleの違いは何ですか?
debounceは利用者が止まるまで待ちます。throttleは操作が続く間も、一定の制限された頻度でコードを実行します。
どのくらいの遅延を提案していますか?
入力には約150から300ミリ秒、スクロールとリサイズには約100ミリ秒を提案しています。
イベントのリスナーは、なぜ片付けるべきですか?
リスナーを片付けると、時間とともにページを遅くするメモリリークを防げると、このスキルは説明しています。
詳細
作者による元の説明
Use when reviewing scripts, client components, bundles, or runtime behavior related to Debounce and throttle event handlers. Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.
人気
- GitHubのスター
- 75k
- ランキング
- #2810
- ライセンス
- MIT
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
frontendchecklist
75kコマンドラインツールを使って、フロントエンドのコードとライブページを、アクセシビリティ、速度、SEO、セキュリティに関する380以上のルールと照らし合わせて確認します。
frontend-checklist-global
75kフロントエンドのプロジェクトを、386のFront-End Checklistのルールすべてと照らし合わせて監査し、見つかった問題ごとに具体的な修正方法を示します。
404-page
75k見つからないページの画面に役立つリンクがあり、本物の404ステータスを返すかを確認し、迷った訪問者が目的のページを見つけられるようにします。
about-page
75kサイトの運営者が誰かを説明する、分かりやすいAboutページがあるかを確認し、訪問者と検索エンジンからの信頼を高めます。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。