back-forward-cache
できること
このスキルは、ブラウザが即座の戻る・進むのために、ページを保存できなくしているコードを確認します。サイト内のページへの戻りを速くしたい開発者向けです。
使う場面
- ✓訪問者が戻るをクリックした後、ページの読み込みが遅いとき。
- ✓unloadのリスナーや、常に実行されるbeforeunloadの確認があるとき。
- ✓ページが復元された後に、時間に敏感なデータを更新すべきとき。
スキルのリンク
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/back-forward-cache/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“戻る操作が即座に動かなくなる原因がないか、私のチェックアウトのページを確認してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、unloadのリスナーと無条件のbeforeunloadの処理を探し、その処理をpagehideとpageshowに移し、変わらなければならないデータだけを更新します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Optimize pages for back/forward cache
Back/forward cache turns many browser back and forward navigations into near-instant restores because the entire page is resumed from memory instead of being rebuilt from the network. Losing bfcache eligibility makes common navigations feel far slower than they need to.
Quick Reference
- Never add an
unloadlistener - it is the most common bfcache blocker - Use
pagehideandpageshowinstead of assuming every navigation reloads - Refresh time-sensitive state when
pageshow.persistedistrue - Keep
beforeunloadconditional and remove it when there are no unsaved changes - Verify eligibility in DevTools instead of assuming a page is cacheable
Check
Review this route for back/forward cache blockers. Search for unload or unconditional beforeunload listeners, state that assumes every navigation is a full reload, and resource lifecycles that break when the page is resumed from memory.
Fix
Replace unload logic with pagehide and pageshow handlers, remove unnecessary blockers, and refresh only the time-sensitive state that must change after a bfcache restore.
Explain
Explain how the back/forward cache differs from HTTP caching, why unload blocks it, and how pageshow/pagehide should be used instead.
Code Review
Review route code, global listeners, analytics hooks, and data-refresh logic related to Optimize pages for back/forward cache. Flag exact listeners, APIs, or lifecycle assumptions that prevent a restore or leave stale state after a restore.
For full implementation details, code examples, and framework-specific guidance,
see references/rule.md.
Rule page: https://frontendchecklist.io/rules/performance/back-forward-cache
よくある質問
戻る・進むキャッシュとは何ですか?
ページ全体をメモリに保持して素早く再開できるようにする仕組みで、ネットワークから作り直す代わりのものだと、このスキルは説明しています。
最もよく妨げるものは何ですか?
unloadのリスナーが、最もよくある妨げだと、このスキルは説明しています。
ページが対象かどうかは、どう確かめられますか?
ブラウザの開発者ツールで、対象かどうかを確認するよう、このスキルは述べています。
詳細
作者による元の説明
Use when reviewing navigation performance, browser lifecycle events, or resume-from-memory behavior. Check the actual browser lifecycle and restore path, not only static code patterns.
人気
- GitHubのスター
- 75k
- ランキング
- #2754
- ライセンス
- 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 において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。