back-forward-cache
What it does
This skill checks pages for code that stops the browser from saving them for instant back and forward navigation. It is for developers who want faster returns to pages within a site.
When to use it
- ✓When pages reload slowly after a visitor clicks back.
- ✓When a page uses unload listeners or a beforeunload prompt that always runs.
- ✓When time-sensitive data should refresh after the page is restored.
Skill link
https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/back-forward-cache/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Check my checkout pages for anything that stops back navigation from being instant.”
5 new skills a week. 1 minute to read.
How it works
The agent looks for unload listeners and unconditional beforeunload handlers, moves that logic to pagehide and pageshow, and refreshes only the data that must change.
Technical content (original SKILL.md)
Original text by the author, straight from 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
FAQ
What is the back and forward cache?
The skill describes it as keeping the whole page in memory so it can resume quickly, instead of rebuilding it from the network.
What blocks it most often?
The skill says an unload listener is the most common blocker.
How can I confirm a page is eligible?
The skill says to verify eligibility in the browser developer tools.
Details
Original description by the author
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.
Popularity
- GitHub stars
- 75k
- Ranking position
- #2754
- License
- MIT
- Updated
- 10/31/2026
Comments
- …
More skills from this repository
frontendchecklist
75kChecks frontend code and live pages against 380+ rules for accessibility, speed, SEO and security, using a command-line tool.
frontend-checklist-global
75kAudits a frontend project against all 386 Front-End Checklist rules, and gives a specific fix for each issue found.
404-page
75kChecks that your missing-page screen offers helpful links and returns a real 404 status, to help lost visitors find their way.
about-page
75kReviews whether your site has a clear About page that explains who runs it, to build trust with visitors and search engines.
Similar skills
angular-developer
280kHelps your agent create Angular code and give project structure advice. Useful for starting new projects, creating code parts, or improving performance and accessibility.
frontend-a11y
280kHelps your agent make web interfaces accessible to everyone. It ensures websites and apps work well with screen readers and keyboard navigation.
frontend-patterns
280kHas your agent apply modern patterns in frontend development. It optimizes performance, manages state, and follows best practices in React and Next.js.