Yesterday a small script dropped on r/PromptEngineering. It fixes an annoyance every heavy ChatGPT and Claude user knows: your chat window turning into an endless scroll of fenced code and text blocks you don’t even need to read. u/coz built a Tampermonkey userscript that slaps a collapsible/expandable button on every one of those blocks, right in the Claude and ChatGPT web interfaces.
Here’s the twist: it doesn’t just fold the block away. It auto-collapses on load by default, so the second a response lands, your screen stays clean instead of getting buried under fifty lines of boilerplate. There’s a “save to clipboard” button built in too, so you can grab the content without ever needing to expand it and look at it.
That last part is the whole point. u/coz says they skip reading these blocks 90% of the time. They ask an AI to write a prompt for another AI, grab it, and move on. One Redditor in the thread had the exact same complaint the day before: half their screen was just code blocks they didn’t need to see.
Quick setup:
- 🔧 Install the Tampermonkey extension for Chrome
- 📋 Open the dashboard, create a new script
- 📥 Paste in the gist code, save it
- 🔄 Reload your Claude or ChatGPT tab, and you’re done
Pro tip: if you’re wary of pasting random JavaScript into a browser extension (fair instinct), copy the script and hand it to an AI you trust to review it before installing. u/coz also built in an option to turn off auto-collapse, for anyone who’d rather see blocks expanded by default.
It’s MIT licensed, so nothing’s stopping you from tweaking it to fit your own workflow.
Go check out the full gist and the original thread. If you live in Claude or ChatGPT all day, this is a five-minute fix for a problem you’ve been silently tolerating for months. 🚀
Frequently Asked Questions
Q: Does this work with dark mode?
The script should work well with dark mode, though some browser scripts can occasionally mess with color schemes. Since the full code is on GitHub Gist, you can review it before installing or tweak it yourself if needed to match your exact theme.
Q: Is it safe to install? How can I verify the code?
Yes, the script is MIT licensed and posted publicly on Gist so you can read the source before installing. Tampermonkey is a legitimate, long-established browser extension. If you’re concerned, feel free to share the code with an AI or developer friend for a quick review.
Q: Can I turn off auto-collapse if I want code blocks visible by default?
The script auto-collapses on load, but there’s a setting in the code to disable this. Check the gist, should be easy to toggle to your preference.
Q: Who would actually benefit from this?
Mainly power users who constantly ask Claude or ChatGPT to generate prompts for other AI tools. If you find yourself copying code blocks to clipboard way more than reading them onscreen, this stops them from cluttering 90% of your screen and saves endless scrolling.
Tampermonkey script – give your copy and pasteable fenced code/text blocks a collapsible/expandable button for Claude and ChatGPT (web)
by u/coz in PromptEngineering