How I Built a Cognitive Distortion Detector in 200 Lines of Vanilla JavaScript
I built a free, privacy-first CBT cognitive distortion detector that runs entirely in the browser — no AI, no backend, no signup required. Here's how.
The Problem
As developers, we often fall into cognitive distortions:
- Mind reading: 'My reviewer thinks I am a bad developer'
- Catastrophizing: 'This bug will bring down production'
- All-or-nothing: 'If it is not perfect, it is garbage'
The Solution
A 200-line vanilla JS detector that identifies 10 cognitive distortions using keyword matching + context scoring.
How It Works
- Input: User types their anxious thought
- Analysis: Each distortion is scored based on keyword matches + context
- Output: Top 3 distortions with reframing suggestions
Try It
The tool is free at cbt-toolkit. No data leaves your browser.
Why Vanilla JS?
- Privacy: No data sent to servers
- Speed: Instant feedback
- Accessibility: Works offline
Continue Reading — CBT Tools for Developers:
Top comments (0)