<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Marcelo C.</title>
    <description>The latest articles on DEV Community by Marcelo C. (@marcelo_sqe).</description>
    <link>https://dev.to/marcelo_sqe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1805681%2Fe450e775-428b-46c4-9bb6-869551761185.jpg</url>
      <title>DEV Community: Marcelo C.</title>
      <link>https://dev.to/marcelo_sqe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marcelo_sqe"/>
    <language>en</language>
    <item>
      <title>How I built my entire Home Assistant with Claude Code running inside it</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Sun, 08 Nov 2026 12:33:48 +0000</pubDate>
      <link>https://dev.to/marcelo_sqe/how-i-built-my-entire-home-assistant-with-claude-code-running-inside-it-26ch</link>
      <guid>https://dev.to/marcelo_sqe/how-i-built-my-entire-home-assistant-with-claude-code-running-inside-it-26ch</guid>
      <description>&lt;p&gt;In my three-part series I showed you &lt;a href="https://dev.to/marcelo_sqe/home-assistant-made-me-love-automation-flows-in-real-life-2cek"&gt;the gates, the alarm and the car&lt;/a&gt;, &lt;a href="https://dev.to/marcelo_sqe/the-floor-heating-cooling-war-a-co2-diagnosis-and-appliances-that-talk-1o0c"&gt;the floor heating war and the CO₂ diagnosis&lt;/a&gt;, and &lt;a href="https://dev.to/marcelo_sqe/the-boring-automations-are-the-ones-that-matter-4h5j"&gt;the boring automations that actually protect the place&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What I didn't tell you is how it got built.&lt;/p&gt;

&lt;p&gt;Here's the confession: I barely typed any of that YAML myself. Almost every line of it (the automations, the dashboard, the animated cards, the scripts that pair and rename devices) was written by &lt;strong&gt;Claude Code, running inside the Home Assistant box itself&lt;/strong&gt;. I talk to it in Portuguese, usually from my phone. It edits &lt;code&gt;/config&lt;/code&gt;, validates, reloads, checks that the thing actually worked, and writes down whatever bit it along the way.&lt;/p&gt;

&lt;p&gt;So this one is the behind-the-scenes: how it's wired, the skills it leans on, how the dashboard went from YAML to code, where the animations came from, how you pair devices when your assistant has no hands, and then a tour of &lt;strong&gt;every page of the dashboard&lt;/strong&gt;, straight from my phone.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Since June 2026&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Commits&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;580&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automations · scripts&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;129&lt;/strong&gt; · 73&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Devices · entities&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;147&lt;/strong&gt; · 1,163&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dashboard&lt;/td&gt;
&lt;td&gt;10 tabs, 60 pop-ups, generated by &lt;strong&gt;7,600 lines of Python&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Home-made cards&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;17&lt;/strong&gt; custom elements, no libraries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Notes it wrote for itself&lt;/td&gt;
&lt;td&gt;25 files, ~105,000 words&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Step zero: Claude Code lives in an add-on
&lt;/h2&gt;

&lt;p&gt;The house runs on a &lt;strong&gt;Home Assistant Green&lt;/strong&gt; with Home Assistant OS, which means you can't just go and install things on the host. What you &lt;em&gt;can&lt;/em&gt; do is use the &lt;strong&gt;Advanced SSH &amp;amp; Web Terminal&lt;/strong&gt; add-on: a small Alpine container with &lt;code&gt;/config&lt;/code&gt; mounted, the &lt;code&gt;ha&lt;/code&gt; CLI and a Supervisor token. Turns out that's all it needs.&lt;/p&gt;

&lt;p&gt;Of course there's a catch (there always is): add-on containers get rebuilt. Anything you install with &lt;code&gt;npm&lt;/code&gt;, &lt;code&gt;apk&lt;/code&gt; or &lt;code&gt;pip&lt;/code&gt; is gone after an add-on restart, and your login goes with it. The fix lives in the add-on's own configuration: reinstall on every boot, and keep Claude's folder &lt;strong&gt;inside&lt;/strong&gt; &lt;code&gt;/config&lt;/code&gt;, which survives everything.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Settings → Add-ons → Advanced SSH &amp;amp; Web Terminal → Configuration&lt;/span&gt;
&lt;span class="na"&gt;packages&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;nodejs&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;git&lt;/span&gt;
&lt;span class="na"&gt;init_commands&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;mkdir -p /config/.claude-box&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ln -sfn /config/.claude-box /root/.claude&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;[&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;-f&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;/config/.claude-box/claude.json&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;]&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;||&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;echo&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;'{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;hasCompletedOnboarding&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s"&gt;:&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;true}'&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;/config/.claude-box/claude.json"&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ln -sf /config/.claude-box/claude.json /root/.claude.json&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;npm i -g @anthropic-ai/claude-code &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 || &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Basically, every boot puts Node and Claude Code back, and the symlinks point Claude at a folder that never goes away. Login, settings, memory and skills all live in &lt;code&gt;/config/.claude-box&lt;/code&gt; (which is in &lt;code&gt;.gitignore&lt;/code&gt;, obviously). I open &lt;strong&gt;Terminal&lt;/strong&gt; from the Home Assistant sidebar, on the laptop or on the phone, type &lt;code&gt;claude&lt;/code&gt;, and I'm in.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxmn25l7h7q0fcvoztlwr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxmn25l7h7q0fcvoztlwr.png" alt="How it's wired" width="799" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From there it reaches Home Assistant through four doors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Files.&lt;/strong&gt; &lt;code&gt;/config&lt;/code&gt; &lt;em&gt;is&lt;/em&gt; the git repository. What's in the repo is what runs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The &lt;code&gt;ha&lt;/code&gt; CLI.&lt;/strong&gt; &lt;code&gt;ha core check&lt;/code&gt; before anything, reload when possible, restart only when it has to.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The websocket.&lt;/strong&gt; Dashboards, the entity registry, template rendering. The client is &lt;code&gt;tools/haws.py&lt;/code&gt;, a &lt;strong&gt;pure-stdlib&lt;/strong&gt; websocket client. It wrote that one after the first tooling, built on &lt;code&gt;aiohttp&lt;/code&gt;, stopped running the day the add-on restarted (remember the catch?). Same reason every tool in the repo is stdlib only.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP.&lt;/strong&gt; Home Assistant's official MCP Server integration, for live state.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The secret is what it reads first
&lt;/h2&gt;

&lt;p&gt;Every session starts by loading &lt;code&gt;CLAUDE.md&lt;/code&gt;, the rules that apply to the whole house. Each rule in there cost at least one diagnosis, and the file writes down what it cost. A couple of my favourites (the first one still stings):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;condition:&lt;/code&gt; inside &lt;code&gt;then:&lt;/code&gt; / &lt;code&gt;choose:&lt;/code&gt; does NOT stop the script&lt;/strong&gt; — it only aborts that block, and the next action runs anyway. Guards that must stop everything go at the top level, or use &lt;code&gt;stop:&lt;/code&gt;. &lt;em&gt;This cost 5 alarm disarms with the house empty.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prefer reload.&lt;/strong&gt; Every restart knocks the Govee lamps offline for a couple of minutes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The details live in &lt;strong&gt;&lt;code&gt;docs/notas/&lt;/code&gt;&lt;/strong&gt;: 25 notes, one per subject (alarm, floor heating, TV, Zigbee, energy, irrigation…), all written by Claude as it went. The rule is simple: "before touching a subject, read its note". That's why a session in November doesn't repeat the mistakes a session made in August.&lt;/p&gt;

&lt;p&gt;On top of that, Claude Code keeps its own &lt;strong&gt;memory&lt;/strong&gt;: 47 small files about how &lt;em&gt;I&lt;/em&gt; work. Some of them exist only because I got annoyed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Always Brazilian Portuguese, never European.&lt;/strong&gt; It kept writing &lt;em&gt;telemóvel&lt;/em&gt; instead of &lt;em&gt;celular&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Information is not an edit request.&lt;/strong&gt; I once explained how the wall thermostats talk to each other, just so it would understand the house, and it went ahead and edited two packages. Now, when I explain something, it takes it in and stops there.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Visual is decided by looking.&lt;/strong&gt; More on that below.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fclglrj7h5pkdtxugigdz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fclglrj7h5pkdtxugigdz.png" alt="The loop every change goes through" width="800" height="269"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Step 7 is the one that compounds: a trap found today becomes a line in a note, and the next session starts already knowing it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The skills
&lt;/h2&gt;

&lt;p&gt;Skills are packaged instructions that Claude loads when the task matches. These are the ones that did the heavy lifting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/komal-SkyNET/claude-skill-homeassistant" rel="noopener noreferrer"&gt;home-assistant-manager&lt;/a&gt;&lt;/strong&gt; by komal-SkyNET — the deploy discipline: edit → &lt;code&gt;ha core check&lt;/code&gt; → reload vs restart → &lt;strong&gt;prove it&lt;/strong&gt; with logs, traces and entity state. By far the most used one (85 times and counting). It assumes you SSH in from outside, so my &lt;code&gt;CLAUDE.md&lt;/code&gt; overrides that part: we're already inside.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;artifact-design, dataviz and artifact-diagramming&lt;/strong&gt; — when I say "make it prettier", Claude doesn't just apply its best guess anymore. It builds a private page with 2–4 options side by side, using the real buttons, and I pick on my phone ("I like B"). It learned that one the hard way: a palette tuned "by the numbers" got an &lt;em&gt;"I don't see any significant changes"&lt;/em&gt; from me.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;security-review&lt;/strong&gt; — an audit of pending changes before they go live. Security became a habit after that: the latest sweep closed the MQTT ports on the local network, removed an old HTML page that was publicly reachable under &lt;code&gt;/local/&lt;/code&gt; (oops), and made failed logins and IP bans notify my phone.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The dashboard is code now
&lt;/h2&gt;

&lt;p&gt;The dashboard is called &lt;strong&gt;Prisma&lt;/strong&gt;. 10 tabs, 60 pop-ups, and &lt;strong&gt;nobody edits it through the UI&lt;/strong&gt;. It's generated by &lt;code&gt;tools/build_prisma_dashboard.py&lt;/code&gt; (about 7,600 lines, with the reasoning behind each choice written as comments) and pushed straight into Home Assistant over the websocket. No restart needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 tools/conferir_prisma.py        &lt;span class="c"&gt;# does the generator still match what is live? exits 1 with a diff&lt;/span&gt;
python3 tools/build_prisma_dashboard.py &lt;span class="c"&gt;# rebuilds the whole dashboard&lt;/span&gt;
&lt;span class="nb"&gt;cd &lt;/span&gt;i18n &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; python3 gerar.py             &lt;span class="c"&gt;# Spanish version, must print "sem tradução: 0"&lt;/span&gt;
python3 publicar.py                     &lt;span class="c"&gt;# pushes them all over the websocket&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why the first line? Because a UI edit got silently wiped by the generator &lt;strong&gt;five times&lt;/strong&gt; before we added the check.&lt;/p&gt;

&lt;p&gt;The same dashboard also comes out in &lt;strong&gt;Spanish and English&lt;/strong&gt;, generated from a dictionary of segments. The screenshots below are from the English one, which is why a few live states still show up in Portuguese: the generator translates the cards, never an entity's state.&lt;/p&gt;

&lt;p&gt;The building blocks are Bubble Card (the pop-ups), Mushroom, navbar-card (the bottom bar), kiosk-mode (no header), a custom theme with a light/dark toggle, and the cards it wrote from scratch. Which brings me to the fun part.&lt;/p&gt;




&lt;h2&gt;
  
  
  Animations: drawing what nobody had drawn
&lt;/h2&gt;

&lt;p&gt;The Marketplace has animated cards for washing machines, weather, energy and fans. Something that draws a TV, a speaker or a PC? &lt;strong&gt;Nothing.&lt;/strong&gt; So Claude wrote &lt;code&gt;casa-media-cards.js&lt;/code&gt;: 17 custom elements in ~4,800 lines of plain JavaScript. No library, no network calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The TV&lt;/strong&gt; lights up when it turns on, takes the colour of the active input and does a slow sweep:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu04giq7wlk7uan16svc7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu04giq7wlk7uan16svc7.gif" alt="The TV card: off, then the TV tuner, then HDMI 1" width="600" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The PC&lt;/strong&gt; opens its screen like an old CRT and collapses it back on power off. The trick is that the SVG is never rebuilt, only a class flips, so the CSS transition runs both ways (rebuild it, and the power-off turns into a hard cut):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F96v9m4yd8w2jz8jif0p1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F96v9m4yd8w2jz8jif0p1.gif" alt="The PC card turning on and off" width="600" height="435"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Music Frame&lt;/strong&gt; (a speaker shaped like a picture frame) shows the album art inside a wooden frame, with a 7-bar equaliser whose height follows the volume:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1mlknyg3nl1m0r1d9md.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx1mlknyg3nl1m0r1d9md.gif" alt="The Music Frame card playing, volume going up" width="600" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The washer and the dishwasher&lt;/strong&gt; use the community &lt;em&gt;washing-machine-card&lt;/em&gt;, patched by Claude so the ring counts from the real start of the cycle and shows time as &lt;code&gt;1h47&lt;/code&gt;. Every Marketplace update overwrites that patch, so an automation quietly re-applies it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0wc5xolmrbbdfpipmd8k.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0wc5xolmrbbdfpipmd8k.gif" alt="The washer-dryer running" width="480" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkh6v0mkwsden7uaxdyjv.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkh6v0mkwsden7uaxdyjv.gif" alt="The dishwasher running" width="480" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(These GIFs were recorded in a headless browser, with the states simulated in that browser tab only. My actual TV stayed off the whole time.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And a few smaller touches, because I wanted the dashboard to feel more alive: every button gets a soft gradient in its icon's colour, and the &lt;strong&gt;gate buttons vibrate&lt;/strong&gt; on tap and again when the building's API answers, ending in &lt;em&gt;Opened&lt;/em&gt; or &lt;em&gt;Didn't open&lt;/em&gt;. The walking sequences count down live to the next gate.&lt;/p&gt;

&lt;p&gt;You might be asking: how does an AI even test an animation? Two ways. The card bundle runs under &lt;strong&gt;Node with &lt;code&gt;linkedom&lt;/code&gt;&lt;/strong&gt;, so it can call &lt;code&gt;setConfig()&lt;/code&gt; with the real config and read back what the card computed. And for the real thing, it starts a &lt;strong&gt;headless Chromium&lt;/strong&gt;, logs into the actual frontend and takes screenshots. That's exactly how every image in this post was made.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pairing devices when your AI has no hands
&lt;/h2&gt;

&lt;p&gt;I press the button on the device. Claude does everything else.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The CO₂ sensors (Matter).&lt;/strong&gt; I first added the AirGuard to the SmartThings app, and it showed up in Home Assistant through the Samsung cloud. Claude didn't like that one bit: this sensor feeds the living-room floor heating, so if the cloud is down, the room has no thermometer. It found Matter disabled by configuration (integration ignored, no Matter Server add-on), installed the add-on, and walked me through &lt;strong&gt;Matter multi-admin&lt;/strong&gt;: the SmartThings app gives you a sharing code (valid for 15 minutes, with the screen open), and Home Assistant joins as a second "fabric". The device was already on Wi-Fi, so it was commissioned &lt;strong&gt;over IP&lt;/strong&gt;. And that matters, because the Green has no Bluetooth at all.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Zigbee.&lt;/strong&gt; The rule here is &lt;em&gt;rename on pairing day&lt;/em&gt;. Factory names get truncated at 32 characters, and renaming a device doesn't rename its entities, so Claude renames both through the registry, following a naming scheme the dashboard scans for. Name a new thermometer &lt;code&gt;termometro_&amp;lt;room&amp;gt;&lt;/code&gt; → it shows up by itself on the Sensors tab, in the daily battery report and on the Home card. No dashboard edit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The pipe probes&lt;/strong&gt; on the heat-pump manifold. Before they even arrived, it wrote me a mounting guide with photos, as a private page. Once they were installed, I sent photos back and it confirmed which one was supply and which was return. It also pushed back (correctly!) on an outside analysis saying one probe was loose: the other one was simply still warm from my hand, and it cooled down 8 minutes later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Also paired this way:&lt;/strong&gt; door contacts and a smoke detector (Zigbee), a Zigbee irrigation valve, the kitchen roller blind, the Shelly relays for the shutters and the floor heating, and a Samsung SmartTag on my keys, through a community fork of SmartThings Find that it had to patch too.&lt;/p&gt;




&lt;h2&gt;
  
  
  Every scenario I could think of
&lt;/h2&gt;

&lt;p&gt;Parts 1–3 go deep on most of these. Here they are in one table:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;What happens&lt;/th&gt;
&lt;th&gt;The trap it found&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Arriving home&lt;/td&gt;
&lt;td&gt;The alarm disarms through home Wi-Fi, a gate + presence, or GPS &lt;strong&gt;with the approach seen&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;Bare GPS once disarmed it with nobody arriving&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Leaving&lt;/td&gt;
&lt;td&gt;The alarm arms and the lamps turn off&lt;/td&gt;
&lt;td&gt;Presence needs &lt;code&gt;person.*&lt;/code&gt;, not &lt;code&gt;device_tracker.*&lt;/code&gt;: its &lt;code&gt;last_changed&lt;/code&gt; is rewritten on every GPS ping&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Night&lt;/td&gt;
&lt;td&gt;Lights come on if someone gets up, and a sweep after midnight turns off whatever was forgotten&lt;/td&gt;
&lt;td&gt;A motion trigger must be &lt;code&gt;from: "off"&lt;/code&gt;, or a sensor coming back from &lt;code&gt;unavailable&lt;/code&gt; fires the alarm&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Floor heating&lt;/td&gt;
&lt;td&gt;Home Assistant can only &lt;strong&gt;subtract&lt;/strong&gt;: a Shelly cuts the demand wire&lt;/td&gt;
&lt;td&gt;The wall thermostat always wins, so HA detects when it's being overruled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Appliances&lt;/td&gt;
&lt;td&gt;Each wash cycle is rebuilt by hand: duration, energy, cost&lt;/td&gt;
&lt;td&gt;Samsung reports lifetime kWh and Bosch reports none&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Irrigation&lt;/td&gt;
&lt;td&gt;Watering time follows &lt;strong&gt;evapotranspiration&lt;/strong&gt;, and it skips when it rains&lt;/td&gt;
&lt;td&gt;The valve closes by itself at 10 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Laundry &amp;amp; awning&lt;/td&gt;
&lt;td&gt;One tap: a camera photo + Gemini answer "is there laundry outside, and is it going to rain?"&lt;/td&gt;
&lt;td&gt;The camera stays silent while its motion detection is off, so the script turns it on just for the photo&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Commute&lt;/td&gt;
&lt;td&gt;Metro line 3 status on the Home tab, weekdays 07:30–08:30&lt;/td&gt;
&lt;td&gt;No API, so it reads the website, which blocks bots unless you look like a browser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Bills&lt;/td&gt;
&lt;td&gt;Electricity bills import themselves; water comes in through a bookmarklet&lt;/td&gt;
&lt;td&gt;The captcha is mine, the rest belongs to the house&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Voice&lt;/td&gt;
&lt;td&gt;Assist runs on Gemini&lt;/td&gt;
&lt;td&gt;My Claude subscription doesn't cover API calls, and the Google key was already paid for&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;And the best bug of all: "certificate not trusted" on my phone over 4G, only at certain times, while Wi-Fi was fine. Looked like a Home Assistant problem. It wasn't. &lt;strong&gt;My ISP intercepts Cloudflare IP ranges during football match windows&lt;/strong&gt;, with a fake certificate. Yes, football. The fix is a DNS rewrite on the phone pointing to a different Cloudflare edge. And the rule it saved in memory: &lt;em&gt;write down the time before you start theorizing.&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The tour: every page, from my phone
&lt;/h2&gt;

&lt;p&gt;Expenses, camera images, maps and faces are blurred. Everything else is exactly what I see.&lt;/p&gt;

&lt;h3&gt;
  
  
  Home
&lt;/h3&gt;

&lt;p&gt;Weather, presence, alarm, climate, lights, blinds, TV &amp;amp; music, PC, appliances and sensors. Each section opens its own pop-up.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxep5qlb1st4jji2rafdn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxep5qlb1st4jji2rafdn.png" alt="Home tab" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Climate
&lt;/h3&gt;

&lt;p&gt;The three thermostats with their presets, the water temperature in the manifold, the air in each room, and the controls.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faul3iyma8o3hxgka0734.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faul3iyma8o3hxgka0734.png" alt="Climate tab" width="800" height="563"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Access
&lt;/h3&gt;

&lt;p&gt;Every gate in the building, the walking sequences with their stopwatch-tuned timings, the garage, and the common areas. The gates run on Alfred Smart, which has no official Home Assistant integration (&lt;a href="https://dev.to/marcelo_sqe/home-assistant-made-me-love-automation-flows-in-real-life-2cek"&gt;part 1&lt;/a&gt; has the reverse-engineering story). So I built one: &lt;strong&gt;&lt;a href="https://github.com/mcello23/ha-alfred-smart" rel="noopener noreferrer"&gt;ha-alfred-smart&lt;/a&gt;&lt;/strong&gt;, installable from HACS as a custom repository. It discovers every gate, garage and door your account can use, gives each one an &lt;em&gt;Open&lt;/em&gt; button and a &lt;em&gt;Last opening&lt;/em&gt; sensor, and it never retries an opening. Why not? Because no answer from Alfred doesn't mean the gate stayed shut. If your building runs on Alfred Smart too, give it a try.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxarag9yvy6ftpymflre1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxarag9yvy6ftpymflre1.png" alt="Access tab" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Bookings and common areas
&lt;/h3&gt;

&lt;p&gt;Gym and Agora Club slots, booked with one tap, and the doors to the shared spaces.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fax2wezejlbweny8q1jfy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fax2wezejlbweny8q1jfy.png" alt="Bookings and Open tabs" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Cameras
&lt;/h3&gt;

&lt;p&gt;The Ring cameras, with motion detection that follows the alarm. The live images are blurred, for obvious reasons.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5yiigu4bsx8k3cv0692w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5yiigu4bsx8k3cv0692w.png" alt="Cameras tab" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Car
&lt;/h3&gt;

&lt;p&gt;Fuel, range, doors and windows, lock and unlock, health warnings and the map (blurred, of course).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr8dgm3jdow93t6y2mc8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fr8dgm3jdow93t6y2mc8l.png" alt="Car tab" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Bills
&lt;/h3&gt;

&lt;p&gt;Electricity, the building's heat pump and water, month by month. You get the shape, not the numbers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmbykgs4yx0alikzy6p6y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmbykgs4yx0alikzy6p6y.png" alt="Bills tab, values blurred" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Sensors
&lt;/h3&gt;

&lt;p&gt;Leaks, smoke, temperature, CO₂, humidity and every battery in the house.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwgmzck7h21v03kvogtx2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwgmzck7h21v03kvogtx2.png" alt="Sensors tab" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Irrigation
&lt;/h3&gt;

&lt;p&gt;Today's run, the schedule, and the "adjust to the weather" pop-up with the evapotranspiration math.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F378cfn93n9vg0bsysfa8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F378cfn93n9vg0bsysfa8.png" alt="Irrigation tab and the weather pop-up" width="800" height="832"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Pop-ups
&lt;/h3&gt;

&lt;p&gt;The drawn blind that follows the real position, the weather, the metro line and my keys:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fja3zbnk6x0m7u31e2wck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fja3zbnk6x0m7u31e2wck.png" alt="Pop-ups: blind, weather, metro, keys" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The TV remote, the Music Frame, the washer and the dishwasher:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fawxkg1vp1iv49iihednc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fawxkg1vp1iv49iihednc.png" alt="Pop-ups: TV remote, Music Frame, washer, dishwasher" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The heating presets, who is in charge right now, air quality and batteries:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ouq56a3nvoi5pqea9f0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1ouq56a3nvoi5pqea9f0.png" alt="Pop-ups: heating presets, now, air quality, batteries" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Presence, the alarm, the lights and the car doors:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftvtx2f8r2z699fnv6s8l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftvtx2f8r2z699fnv6s8l.png" alt="Pop-ups: presence, alarm, lights, car doors" width="800" height="425"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  If you want to try this
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Put it inside the box.&lt;/strong&gt; As an add-on it runs &lt;code&gt;ha core check&lt;/code&gt;, reads the logs and reloads by itself. No SSH juggling, no copying files around.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make &lt;code&gt;/config&lt;/code&gt; a git repository before the first prompt.&lt;/strong&gt; Every change becomes a diff you can read and revert.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write the rules down, and let it write the notes.&lt;/strong&gt; &lt;code&gt;CLAUDE.md&lt;/code&gt; for what applies everywhere, one note per subject for the rest.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demand proof, not "it should work".&lt;/strong&gt; Real state, the automation trace, the raw log. My favourite rule in the whole file: &lt;em&gt;don't say "this can't be fixed" before reading the raw log.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;When the dashboard gets big, generate it.&lt;/strong&gt; UI edits and a 60-pop-up dashboard don't mix (five wiped edits taught me that).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decide visuals by looking&lt;/strong&gt;, on the device you actually use.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep &lt;code&gt;secrets.yaml&lt;/code&gt; off-limits.&lt;/strong&gt; Mine is, by rule.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;Funny thing is, for years my day job has been turning manual flows into something that runs and proves itself. Here I ended up on the other side of the table: I'm the one who knows how the house should behave, and Claude is the engineer who builds it, tests it and keeps a log of every bug it ever met.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The house is still a system under test. It just has a very fast pair programmer living inside it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Running Home Assistant Green, YAML-first (well, Claude-first), with a dashboard built on Bubble Card, Mushroom and 17 cards of my own. What about you? Would you let an AI live inside your Home Assistant box, or is that a hard no? Leave me a comment, and ask me anything about the setup. I would love to hear!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>claudecode</category>
      <category>ai</category>
      <category>homeautomation</category>
    </item>
    <item>
      <title>The boring automations are the ones that matter</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Sat, 07 Nov 2026 14:42:18 +0000</pubDate>
      <link>https://dev.to/marcelo_sqe/the-boring-automations-are-the-ones-that-matter-4h5j</link>
      <guid>https://dev.to/marcelo_sqe/the-boring-automations-are-the-ones-that-matter-4h5j</guid>
      <description>&lt;p&gt;In &lt;a href="https://dev.to/marcelo_sqe/home-assistant-made-me-love-automation-flows-in-real-life-2cek"&gt;part 1&lt;/a&gt; I got home, and in &lt;a href="https://dev.to/marcelo_sqe/the-floor-heating-cooling-war-a-co2-diagnosis-and-appliances-that-talk-1o0c"&gt;part 2&lt;/a&gt; the house started running itself. This last part is about the automations nobody shows off. And they're the ones that justify the whole thing.&lt;/p&gt;

&lt;h2&gt;
  
  
  A silent sensor is not a calm sensor
&lt;/h2&gt;

&lt;p&gt;Leak sensor gets wet → alarm. Obviously. Both phones, through silent mode, and it &lt;strong&gt;repeats every 5 minutes&lt;/strong&gt; while it's wet, because a warning only helps if someone actually goes and shuts the water off.&lt;/p&gt;

&lt;p&gt;But there's a second automation: &lt;strong&gt;leak sensor goes quiet → alarm.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Wait, an alarm for a sensor doing &lt;em&gt;nothing&lt;/em&gt;? Yes. Look at the screen:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv5orfi2bd7aqjplshptt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fv5orfi2bd7aqjplshptt.png" alt="Sensors tab — the Leaks, Smoke, Thermometers and Batteries summaries" width="800" height="1359"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Every card on it has &lt;strong&gt;three states, not two&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Green → fine.&lt;/li&gt;
&lt;li&gt;Red → water on the floor.&lt;/li&gt;
&lt;li&gt;Orange → a sensor that stopped reporting.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The orange one is the reason the page exists. A sensor off the network doesn't warn you about anything, and its silence looks exactly like "all good".&lt;/p&gt;

&lt;p&gt;The smoke detector gets the same treatment, plus a monthly reminder to test it by hand. If it goes off, the lamps turn on at full brightness, both phones ring, and it &lt;strong&gt;repeats every 2 minutes&lt;/strong&gt;. Why two and not five? Water ruins the parquet. Smoke kills in minutes.&lt;/p&gt;

&lt;p&gt;There's deliberately &lt;strong&gt;no test button&lt;/strong&gt; on the dashboard. The self-test beeps loudly for several seconds, and one accidental tap on the kitchen tablet would set it off (no, thank you). The test lives in the monthly reminder, where you have to read before you tap.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa8el282ylkrf9nzb01uf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa8el282ylkrf9nzb01uf.png" alt="The &amp;quot;How to read&amp;quot; pop-up — the green / orange / red table" width="800" height="1227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Everything checks in
&lt;/h2&gt;

&lt;p&gt;Every battery in the house checks in once a day, at 11:00, all in a single message. Silent water sensors and silent detectors get their own warnings five minutes later, so if it's a dead battery, the three messages tell the same story.&lt;/p&gt;

&lt;p&gt;Shelly firmware updates announce themselves. And after a restart, the MQTT bridges get asked to announce themselves again, because otherwise half the house comes back as &lt;code&gt;unavailable&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Small-scale prophecy
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw2g9yosbpztvxhvf4rsk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw2g9yosbpztvxhvf4rsk.png" alt="Cameras tab — the &amp;quot;Clothesline and awning&amp;quot; section" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My favourite piece of small-scale prophecy: the clothesline and the awning get a warning &lt;strong&gt;before&lt;/strong&gt; the rain or the wind arrives, not after. Nothing digital happens, it just tells me to go outside and deal with it.&lt;/p&gt;

&lt;p&gt;And none of these warnings tells me when things are back to normal. On purpose: a second message saying "it's over" is how you teach someone to ignore the first one.&lt;/p&gt;

&lt;h2&gt;
  
  
  And this is where the day job leaked in
&lt;/h2&gt;

&lt;p&gt;Go back and look at everything in this post. Health checks. Heartbeat monitoring. &lt;strong&gt;Alerting on the absence of a signal, not just the presence of one.&lt;/strong&gt; Scheduled self-tests. A daily report on fleet state. And from &lt;a href="https://dev.to/marcelo_sqe/home-assistant-made-me-love-automation-flows-in-real-life-2cek"&gt;part 1&lt;/a&gt;: a tunable timeout exposed in the UI instead of buried in a config file.&lt;/p&gt;

&lt;p&gt;I spent years building exactly this for test suites, and never once thought to point it at my own apartment. Read it with QA eyes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A sensor that goes silent → a test that fails when the assertion never runs.&lt;/li&gt;
&lt;li&gt;A flaky sensor → a flaky test. It works 95% of the time, which is the worst possible number.&lt;/li&gt;
&lt;li&gt;The GPS glitch that once disarmed my alarm → a false positive with great-looking data.&lt;/li&gt;
&lt;li&gt;The car automation that fired correctly at a terrible moment → a passing test nobody trusts.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can't unit test a gate motor. But you can absolutely build one that tells you when it's lying to you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The house is a system under test. It just happens to also be where I sleep.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;That's the series. Running Home Assistant Green, YAML-first, with a dashboard built on Bubble Card and Mushroom. Got a boring automation that quietly saved you? Tell me in the comments, and I'm happy to go deeper on any of these.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>automation</category>
      <category>homeautomation</category>
      <category>programming</category>
    </item>
    <item>
      <title>The floor heating &amp; cooling war, a CO2 diagnosis and appliances that talk</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Sat, 07 Nov 2026 14:35:56 +0000</pubDate>
      <link>https://dev.to/marcelo_sqe/the-floor-heating-cooling-war-a-co2-diagnosis-and-appliances-that-talk-1o0c</link>
      <guid>https://dev.to/marcelo_sqe/the-floor-heating-cooling-war-a-co2-diagnosis-and-appliances-that-talk-1o0c</guid>
      <description>&lt;p&gt;In &lt;a href="https://dev.to/marcelo_sqe/home-assistant-made-me-love-automation-flows-in-real-life-2cek"&gt;part 1&lt;/a&gt; I got through the gates, past the alarm and away from the car. Now I'm inside, and inside is where the house started doing things I never asked for.&lt;/p&gt;

&lt;h2&gt;
  
  
  The war over the floor heating and cooling
&lt;/h2&gt;

&lt;p&gt;I have &lt;strong&gt;14 automations&lt;/strong&gt; just for the radiant floor. Fourteen! That number alone tells you how this war is going.&lt;/p&gt;

&lt;p&gt;The physical wall thermostats and Home Assistant do not agree on who's in charge. And the setup makes it worse: the same floor heats in winter and cools in summer, but Home Assistant can't actually do either. The wall thermostat calls for it, and Home Assistant can only &lt;strong&gt;let it through or cut it&lt;/strong&gt;. It never adds, it only subtracts.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz377j93w3566bhpixdk0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fz377j93w3566bhpixdk0.png" alt="Climate tab — the floor heating &amp;amp; cooling card with the three zones" width="800" height="1184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So one automation detects when the wall refuses to let HA reach the target it was given, and re-syncs the valves to what I actually asked for. Someone turns a knob by hand? Another one waits and quietly puts it back. The Shelly's fallback script dies silently? There's a heartbeat watching for that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6pwkqjxcytz4cocb6qr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6pwkqjxcytz4cocb6qr.png" alt="The &amp;quot;How it works&amp;quot; pop-up — the &amp;quot;Who controls what&amp;quot; table" width="800" height="1592"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My favourite one is the dumbest of all: &lt;strong&gt;on the 1st and the 15th of every month, every valve gets exercised&lt;/strong&gt;, opened and closed once, so they don't seize up after sitting closed for weeks. Is that smart home stuff? Not really. It's maintenance I would never, ever remember to do (which is kind of the entire point).&lt;/p&gt;

&lt;h2&gt;
  
  
  The air I'm breathing
&lt;/h2&gt;

&lt;p&gt;Five automations around CO₂. I genuinely did not expect to care about any of them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhb6hqdjq09u44m2656xd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhb6hqdjq09u44m2656xd.png" alt="Sensors tab — &amp;quot;CO2 in the last 24 h&amp;quot; chart and the rooms table" width="800" height="1351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The house empties out and stops ventilating → a warning.&lt;/li&gt;
&lt;li&gt;The bedroom air goes stale → air it out before bed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;See that line climbing past 1000 ppm overnight? That's the bedroom, with the door shut, with two people in it.&lt;/p&gt;

&lt;p&gt;Now, here is where the plot thickens. After enough nights, it stopped just reporting the number and started telling me &lt;strong&gt;how the night went&lt;/strong&gt;. And when the same bad shape kept repeating, three times in three days, it stopped talking about CO₂ altogether and told me to go check the ventilation filter.&lt;/p&gt;

&lt;p&gt;The dashboard keeps one more number next to it: the &lt;strong&gt;lowest reading since midnight&lt;/strong&gt;. With the ventilation healthy, it sits close to the 420 ppm of outdoor air. If that floor creeps up over weeks, the airflow dropped, and you'd never see it in the live value, because people moving around hide it.&lt;/p&gt;

&lt;p&gt;Reporting a metric → diagnosing a cause. I never designed that part. It showed up after adding one more condition, over and over.&lt;/p&gt;

&lt;h2&gt;
  
  
  The appliances learned to talk
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgw7uoi6893qabjd80ezv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgw7uoi6893qabjd80ezv.png" alt="The dishwasher pop-up — with the &amp;quot;How long each program takes&amp;quot; table" width="800" height="2124"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The dishwasher tells me when it starts, when it errors, and reminds me to crack the door open at the end so things actually dry. And look at the bottom of that screen: &lt;strong&gt;"How long each program takes"&lt;/strong&gt;. That table isn't from the manual. It built itself by watching the machine run, cycle after cycle.&lt;/p&gt;

&lt;p&gt;The washer-dryer reports every phase change, tells me when it's done, and (crucially) nags me again 30 minutes later if I've abandoned a load inside. It also caught two things I'd never have noticed: anti-crease had been running for an absurdly long time, and the machine quietly resets its UI language after every firmware update. Thanks, firmware.&lt;/p&gt;

&lt;p&gt;Nobody sells you a washing machine on &lt;em&gt;"it will remember things so you don't have to."&lt;/em&gt; But that's the feature.&lt;/p&gt;

&lt;h2&gt;
  
  
  And the genuinely small stuff
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa8gb6iuxygkx3tsshebo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fa8gb6iuxygkx3tsshebo.png" alt="Home tab — the &amp;quot;Lights&amp;quot; section" width="800" height="1278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Presence lighting between 20:00 and 08:00, dimmed to something that won't blind you at 3am.&lt;/li&gt;
&lt;li&gt;Arming the alarm turns off any lamp someone left on.&lt;/li&gt;
&lt;li&gt;The reading lamp hands control back to Ana instead of fighting her.&lt;/li&gt;
&lt;li&gt;The Govee bridge re-sends brightness together with colour, because sending them separately makes it flicker.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvimetm1li0y8ih4fnxgi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvimetm1li0y8ih4fnxgi.png" alt="Home tab — &amp;quot;TV &amp;amp; Music&amp;quot;" width="800" height="746"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The TV needs an explicit &lt;code&gt;turn_on&lt;/code&gt; over Wake-on-LAN, because SmartThings alone won't wake it. The PC reports back when it actually shuts down instead of leaving me guessing. And the Music Frame remembers the last station I was listening to, so "put the radio on" is one tap and not a menu dive.&lt;/p&gt;

&lt;p&gt;None of these are impressive. But every one of them removed a tiny daily friction I'd stopped noticing I had.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Next, and last:&lt;/strong&gt; the boring automations. Leak sensors, smoke detectors, batteries: the ones nobody shows off, and the ones that made me realise I'd been doing QA on my own apartment.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Running Home Assistant Green, YAML-first, with a dashboard built on Bubble Card and Mushroom. What about you? What's the dumbest automation you'd never give up? Leave me a comment, I would love to hear!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>automation</category>
      <category>homeautomation</category>
      <category>programming</category>
    </item>
    <item>
      <title>How Home Assistant made me love automation flows in real life</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Sat, 19 Sep 2026 13:55:17 +0000</pubDate>
      <link>https://dev.to/marcelo_sqe/home-assistant-made-me-love-automation-flows-in-real-life-2cek</link>
      <guid>https://dev.to/marcelo_sqe/home-assistant-made-me-love-automation-flows-in-real-life-2cek</guid>
      <description>&lt;p&gt;I never thought about automation as something that could be integrated to my daily routine. You see, I already work with automation everyday, as a Lead QA Engineer, my job is to stare at manual workflows across SaaS platforms and mobile apps and turn them into something that runs by itself. &lt;/p&gt;

&lt;p&gt;But one thing is to automate software, and another completely different is to think of real-life flows.&lt;/p&gt;

&lt;p&gt;I usually get up at night to drink some water, pitch black corridors and didn’t want to make noises searching for the switch. Now a Zigbee motion sensor tells a smart plugged lamp to turn on automatically when I go through. Or the annoyance of inputting my alarm code whenever I arrived home - the alarm now turns on or off based on my home presence, or my spouse’s. Those scenarios started as an idea and ended up part of my day, saving me time.  &lt;/p&gt;

&lt;p&gt;That is the story of how I got into Home Assistant.&lt;/p&gt;

&lt;h2&gt;
  
  
  I automate software for a living. But I never &lt;strong&gt;thought&lt;/strong&gt; about it making my life easier.
&lt;/h2&gt;

&lt;p&gt;It's a strange thing to work with something but never implement it in the real world, into a tangible or &lt;em&gt;physical&lt;/em&gt; device. Something with a door and a motor and a delay. I just thought “what if…” I could automate my entrance to the building? Or maybe having a garage door control to open and close them in a sequence, that runs in my car screen? Check and check.&lt;/p&gt;

&lt;p&gt;I am nearing almost &lt;strong&gt;100 automations&lt;/strong&gt; scenarios that one dashboard integrates and controls air quality sensors, temperature, shades, a myriad of devices (Samsung TV and washer, Bosch dishwasher, Ring cameras, etc). But I separated this into three pieces:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Getting home&lt;/strong&gt; — gates, the alarm and the car &lt;em&gt;(this one)&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Inside the house&lt;/strong&gt; — floor heating and cooling, air and appliances&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The boring ones&lt;/strong&gt; — the automations that actually protect the place&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxi5qeytzy5zdeyb9ta3a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxi5qeytzy5zdeyb9ta3a.png" alt=" Home tab — from the top down to " width="800" height="732"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The gates: reverse engineering Alfred Smart
&lt;/h2&gt;

&lt;p&gt;Every gate in my building runs on Alfred Smart, an access-control platform with its own app and no Home Assistant integration. So I looked at what the Alfred web app sends. It turned out to be a plain REST API: a login that returns a JWT, and one &lt;code&gt;PATCH /devices/interact&lt;/code&gt; per door, with a gateway ID and a device ID. &lt;/p&gt;

&lt;p&gt;I rebuilt both as &lt;code&gt;rest_commands&lt;/code&gt; in Home Assistant, sending the same headers the web app does. Also, since &lt;strong&gt;the&lt;/strong&gt; access token is valid for 60 days, I automated a &lt;strong&gt;renewal&lt;/strong&gt; for the credentials every month or so.&lt;/p&gt;

&lt;p&gt;Testing it was where it got interesting. Every gate goes through one script that reads the HTTP status. And how to get exact times of entrance? By doing them, over and over. I mean, I am going to be entering my &lt;strong&gt;house&lt;/strong&gt; many times—why not take note and adjust the times until you get them right? I am talking about a few seconds of difference, of course.&lt;/p&gt;

&lt;p&gt;Then came the health check. A badge at the top of the dashboard polls the API, keeping the last real value for 15 minutes before admitting the service is down. That avoids &lt;strong&gt;my&lt;/strong&gt; using the scripts and not knowing that they're offline (it happened more than twice).&lt;/p&gt;

&lt;h2&gt;
  
  
  Walking in: a state machine tuned with a stopwatch
&lt;/h2&gt;

&lt;p&gt;There are five gates in the complex, and arriving on foot through Gate 11 is not the same path as through Gate 5. So each entrance became a sequence: open this, wait, open that. The waits — &lt;strong&gt;G11 → G3 in 30 s, G5 → G3 in 50 s&lt;/strong&gt; — come from what I said before, just entering again and again until the timing is perfect.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2mgq0eio2ipbfwn58pd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ft2mgq0eio2ipbfwn58pd.png" alt="Access tab — from " width="800" height="1177"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Those numbers used to be hardcoded, embedded &lt;strong&gt;in&lt;/strong&gt; the YAML file, a tad more difficult to update. Now each wait is &lt;strong&gt;a&lt;/strong&gt; helper, editable from an &lt;strong&gt;"Adjust timings"&lt;/strong&gt; pop-up, and both the delay and the button label read from it. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0m218v4xfwcayvtn3h8h.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0m218v4xfwcayvtn3h8h.png" alt="The " width="800" height="2030"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The phone asks before I get there
&lt;/h2&gt;

&lt;p&gt;When I'm about 200 m from home, my phone asks &lt;strong&gt;"Arriving home? — which way are you coming in?"&lt;/strong&gt;, with one button per gate. One tap and the sequence runs while I walk.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe044kk9zdsag7u4b5xqh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fe044kk9zdsag7u4b5xqh.jpg" alt="The " width="800" height="1067"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I can change my home zone radius and adapt the YAML file to when it's triggered in the street. Also, the same logic applies to &lt;strong&gt;arming&lt;/strong&gt; or &lt;strong&gt;disarming&lt;/strong&gt; my alarm based on when I get closer to my door, after another smaller radius that was set to my door as well. &lt;/p&gt;

&lt;h2&gt;
  
  
  The alarm: Verisure through the Securitas integration
&lt;/h2&gt;

&lt;p&gt;The alarm is a Verisure, connected through the Securitas custom integration from HACS. The protocol has a "partial night" mode, so Home Assistant &lt;strong&gt;renders&lt;/strong&gt; three buttons: Disarmed, Partial, Full—just like the &lt;strong&gt;physical&lt;/strong&gt; device. It also talks to the Ring cameras, activating the movement detector and letting me know if there's movement with the alarm on.&lt;/p&gt;

&lt;p&gt;Now the PIN entering is gone: the alarm disarms automatically when we get home. My wife and I are not detected home after closing the door, but no alarm was set? Home Assistant takes care of that. I can enable—with one tap—arming or disarming by day or at night, and &lt;strong&gt;also&lt;/strong&gt; at &lt;strong&gt;certain time slots&lt;/strong&gt; during the &lt;strong&gt;week&lt;/strong&gt;. I remember the nightmare it was to set that up with the official alarm app. Good riddance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsm2865veplq6mbc8yty3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fsm2865veplq6mbc8yty3.png" alt="Home tab — the " width="799" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The car: the Toyota integration, and a lock it didn't have
&lt;/h2&gt;

&lt;p&gt;The Toyota integration from HACS gave me fuel, odometer, doors and windows, but no lock. The library underneath can send remote commands, so I wrote a &lt;code&gt;lock.py&lt;/code&gt; for it. It is a feature that &lt;a href="https://github.com/pytoyoda/ha_toyota/pull/344/changes/e831b77fc4ec49dd96420d87e598556943b00d0c" rel="noopener noreferrer"&gt;I hope gets merged eventually&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That made the car automations possible: unlocked for 3 minutes → a notification, still unlocked at 6 → lock it. This has saved us many times already, whenever one of us forgets to properly lock the car when we have our hands full. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5qysegz7uga7aebu3wo5.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5qysegz7uga7aebu3wo5.jpg" alt="Car tab — the top part" width="800" height="1219"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I also added &lt;strong&gt;two scripts&lt;/strong&gt; as my car panel buttons: &lt;strong&gt;"Arriving"&lt;/strong&gt; and &lt;strong&gt;"Going out"&lt;/strong&gt;. They work with &lt;strong&gt;the&lt;/strong&gt; Alfred Smart building integration that I mentioned and &lt;strong&gt;open&lt;/strong&gt; each of the two garage doors in sequence through a REST command, with a timed wait &lt;strong&gt;between them&lt;/strong&gt;. Compatible with Apple &lt;strong&gt;CarPlay&lt;/strong&gt; and Android Auto, of course.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvc7nuf32md3l44zpubfq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvc7nuf32md3l44zpubfq.jpg" alt="Garage doors controlled conviniently in my car panel" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; inside the house — where the wall thermostats and Home Assistant have been at war for months, and a CO₂ chart ended up telling me to change a filter.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Running Home Assistant Green, YAML-first, with a dashboard built on Bubble Card and Mushroom. Happy to go deeper on any of these in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>homeassistant</category>
      <category>automation</category>
      <category>homeautomation</category>
      <category>programming</category>
    </item>
    <item>
      <title>My restored Cypress session was lying to me</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Mon, 07 Sep 2026 15:36:23 +0000</pubDate>
      <link>https://dev.to/marcelo_sqe/my-restored-cypress-session-was-lying-to-me-4648</link>
      <guid>https://dev.to/marcelo_sqe/my-restored-cypress-session-was-lying-to-me-4648</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faciu9u0ag1ah6uoboo5q.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faciu9u0ag1ah6uoboo5q.jpg" alt="When your Idp validation goes wrong" width="799" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Author's Note / Disclosure:&lt;/strong&gt; 100% human-authored content based on real production engineering work. No AI was involved in writing the article, technical analysis, or code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;cy.session()&lt;/code&gt; is the single biggest speed win available to an authenticated Cypress suite. You log in once, Cypress snapshots cookies, &lt;code&gt;localStorage&lt;/code&gt; and &lt;code&gt;sessionStorage&lt;/code&gt;, and every later spec restores that snapshot instead of walking through an identity provider.&lt;/p&gt;

&lt;p&gt;The safety net is &lt;code&gt;validate()&lt;/code&gt;. Cypress runs it after restoring a cached session; if it throws, fails an assertion, or yields &lt;code&gt;false&lt;/code&gt;, Cypress throws the snapshot away and runs &lt;code&gt;setup&lt;/code&gt; again. That is the whole contract: &lt;strong&gt;a bad session gets detected and replaced.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Mine could not fail. For weeks. And it cost me days of chasing "flaky" specs that were nothing of the kind.&lt;/p&gt;

&lt;h2&gt;
  
  
  The code that looked fine
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;Cypress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;session&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;origin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;idpOrigin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#username&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#password&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;type&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
        &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;button[type="submit"]&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#app-shell&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;be.visible&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;cacheAcrossSpecs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/connect/userinfo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;its&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;status&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;eq&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Reasonable, right? &lt;code&gt;/connect/userinfo&lt;/code&gt; is the OIDC user info endpoint. If the session is dead it should 401, &lt;code&gt;validate()&lt;/code&gt; fails, and we log in again.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it always passes
&lt;/h2&gt;

&lt;p&gt;Two independent bugs stack up here, and either one alone is enough to make the check worthless.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The URL is relative.&lt;/strong&gt; &lt;code&gt;cy.request('/connect/userinfo')&lt;/code&gt; resolves against &lt;code&gt;baseUrl&lt;/code&gt;, which is the application, not the identity provider. So the request never touches the IdP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The application is a single-page app.&lt;/strong&gt; Its host serves &lt;code&gt;index.html&lt;/code&gt; for any path it does not recognise, because that is what history-API routing requires. A request for &lt;code&gt;/connect/userinfo&lt;/code&gt; gets back the SPA shell with &lt;code&gt;200 OK&lt;/code&gt; and &lt;code&gt;content-type: text/html&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;validate()&lt;/code&gt; asserted on a status code. It got a &lt;code&gt;200&lt;/code&gt;. Every single time. Including for a session whose refresh token expired three hours ago.&lt;/p&gt;

&lt;p&gt;You can confirm this in one command, without Cypress:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-is&lt;/span&gt; https://app.example.com/connect/userinfo | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you see &lt;code&gt;200&lt;/code&gt; and &lt;code&gt;text/html&lt;/code&gt;, your validate is decorative.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the failure looks like from the outside
&lt;/h2&gt;

&lt;p&gt;This is the part that burns time. The session restores, &lt;code&gt;validate()&lt;/code&gt; passes, and then the &lt;em&gt;first real command&lt;/em&gt; of your test triggers the app's own auth check, which redirects to the identity provider. Your spec fails like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AssertionError: Timed out retrying after 10000ms:
Expected to find element: `#dashboard-grid`, but never found it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing points at authentication. The URL in the screenshot is the IdP login page, but you are looking at a grid selector, so you go and inspect the grid. Across a large suite the pattern shows up as an unrelated scatter of failures in whichever specs happened to run after the token expired — the exact fingerprint people label "flaky" and hand a retry.&lt;/p&gt;

&lt;p&gt;The tell: &lt;strong&gt;the failure moves around between runs, but always lands on the first assertion after a restored session.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fixes that do not work
&lt;/h2&gt;

&lt;p&gt;I tried the two obvious ones first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Point at the absolute IdP URL.&lt;/strong&gt; &lt;code&gt;cy.request('https://idp.example.com/connect/userinfo')&lt;/code&gt; now reaches the right server, but &lt;code&gt;cy.request&lt;/code&gt; sends the browser's cookie jar and nothing else. If your SPA authenticates with a bearer token — and if you are using &lt;code&gt;oidc-client-ts&lt;/code&gt;, &lt;code&gt;MSAL&lt;/code&gt;, &lt;code&gt;angular-auth-oidc-client&lt;/code&gt; or friends, you are — then the token lives in web storage and is attached by an HTTP interceptor inside the app. &lt;code&gt;cy.request&lt;/code&gt; has no interceptor. You get a &lt;code&gt;401&lt;/code&gt; for a session that is perfectly alive, &lt;code&gt;setup&lt;/code&gt; re-runs on every spec, and you have deleted the entire benefit of &lt;code&gt;cy.session&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Call a real application API instead.&lt;/strong&gt; Same problem, same reason. You are testing whether cookies alone can authenticate, which is not how the app works.&lt;/p&gt;

&lt;p&gt;Both failures come from the same mistake as the original bug, just inverted: the check is exercising a credential path the application does not use.&lt;/p&gt;

&lt;h2&gt;
  
  
  The fix: validate what the app reads
&lt;/h2&gt;

&lt;p&gt;The application decides it is logged in by reading a token out of storage. So that is what &lt;code&gt;validate()&lt;/code&gt; should assert on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;StoredUser&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;access_token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
  &lt;span class="nx"&gt;expires_at&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;readStoredUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Window&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;StoredUser&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;k&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;startsWith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;oidc.user:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;raw&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;StoredUser&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;expiryMs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;StoredUser&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expires_at&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expires_at&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[,&lt;/span&gt; &lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;access_token&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nf"&gt;atob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/-/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;+&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/_/g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;exp&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exp&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exp&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the validate itself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;window&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;readStoredUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;stored auth record&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;not&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;be&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;expires&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;expiryMs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;StoredUser&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expires&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token expiry claim&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;be&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;a&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;expires&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token still valid with margin&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;to&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;be&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;greaterThan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three details in there matter more than the rest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;cy.visit('/')&lt;/code&gt; is not optional.&lt;/strong&gt; &lt;code&gt;validate()&lt;/code&gt; runs before your test's own &lt;code&gt;cy.visit&lt;/code&gt;. Until a page on the app origin is loaded, the application under test is a blank frame, and &lt;code&gt;cy.window()&lt;/code&gt; hands you storage that is empty regardless of session health. Skip the visit and you have built the opposite bug: a validate that can never &lt;em&gt;pass&lt;/em&gt;, so &lt;code&gt;setup&lt;/code&gt; runs every spec. Read the storage from a page on the origin that owns it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The 30-second margin.&lt;/strong&gt; A token with four seconds left passes a naive &lt;code&gt;&amp;gt; Date.now()&lt;/code&gt; check and then expires in the middle of your test. Require enough runway to finish the spec. Tune the number to your slowest test, not your fastest.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The storage key prefix is library-specific.&lt;/strong&gt; &lt;code&gt;oidc.user:&amp;lt;authority&amp;gt;:&amp;lt;client_id&amp;gt;&lt;/code&gt; is &lt;code&gt;oidc-client-ts&lt;/code&gt;. MSAL shards the account, token and metadata across separate keys. Open DevTools, look at what your app actually wrote, and key off that. If your app uses an httpOnly cookie session instead, the same principle points somewhere else entirely: assert against an endpoint that authenticates &lt;em&gt;by cookie&lt;/em&gt;, absolute-URL'd, and confirm by hand that it 401s when logged out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prove your validate can fail
&lt;/h2&gt;

&lt;p&gt;This is the step I want you to take away, because it generalises past auth. A guard you have never seen fire is not a guard.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;it&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;re-runs setup when the stored token is gone&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;window&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;win&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clear&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;login&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;#app-shell&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;should&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;be.visible&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Better still, break it on purpose once by hand: clear the token, re-run a spec, and watch the Cypress command log. You are looking for the &lt;code&gt;setup&lt;/code&gt; block re-executing. If it does not, your &lt;code&gt;validate()&lt;/code&gt; is a comment with extra steps.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;validate()&lt;/code&gt; must assert on the credential the application actually sends, in the context the application actually reads it.&lt;/li&gt;
&lt;li&gt;A relative URL in &lt;code&gt;validate()&lt;/code&gt; on a single-page app resolves to the SPA shell. It will return &lt;code&gt;200&lt;/code&gt; forever.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cy.request&lt;/code&gt; carries cookies, never your in-app bearer token. Do not use it to check token-based sessions.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;validate()&lt;/code&gt; runs before your &lt;code&gt;cy.visit&lt;/code&gt;, so read web storage only after loading a page on that origin.&lt;/li&gt;
&lt;li&gt;Validate expiry with a margin, not against &lt;code&gt;Date.now()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Deliberately break the session once and confirm &lt;code&gt;setup&lt;/code&gt; re-runs. Then you know the net exists.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>automation</category>
      <category>debugging</category>
      <category>javascript</category>
      <category>testing</category>
    </item>
    <item>
      <title>How I leveraged Claude Code skills to help me migrate Cypress 16 deprecations in time</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Fri, 03 Jul 2026 15:05:58 +0000</pubDate>
      <link>https://dev.to/cypress/how-i-leveraged-claude-code-skills-to-help-me-migrate-cypress-16-deprecations-in-time-37ff</link>
      <guid>https://dev.to/cypress/how-i-leveraged-claude-code-skills-to-help-me-migrate-cypress-16-deprecations-in-time-37ff</guid>
      <description>&lt;p&gt;Have you ever stared at a deprecation warning scrolling by in your terminal and thought &lt;em&gt;"eh, future me will deal with that"&lt;/em&gt;? We all have! But here's the thing about future you: he eventually shows up. And in my case, he showed up wearing a shirt that said &lt;strong&gt;Cypress v16&lt;/strong&gt;, holding a changelog, and pointing at the line that says &lt;code&gt;Cypress.env()&lt;/code&gt; will be &lt;strong&gt;fully removed&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxw1gx0ztg6645q543ozf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxw1gx0ztg6645q543ozf.png" alt="Cypress terminal warning before migration" width="799" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Warning in 15.10. Gone in 16. And sprinkled across every config, page object, and spec file in the massive E2E repository I maintain at my work monorepo. Configs, support files, fluent page-object chains — everywhere.&lt;/p&gt;

&lt;p&gt;So let's get to the grain here: even though Cypress has a &lt;a href="https://docs.cypress.io/app/references/migration-guide" rel="noopener noreferrer"&gt;great documentation about it&lt;/a&gt;, I didn't want to execute a find-and-replace job manually, and I also wanted to move fast. So instead of pasting a prompt into a chat window forty times, I did something better: I turned the migration playbook itself into a &lt;strong&gt;Claude Code Skill&lt;/strong&gt; — a reusable, self-triggering unit of expertise that lives in my machine and outlives this one migration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Cypress.env() had to die
&lt;/h2&gt;

&lt;p&gt;If you've written E2E tests, you know &lt;code&gt;Cypress.env()&lt;/code&gt;. Synchronous, available everywhere, dead simple.&lt;/p&gt;

&lt;p&gt;And that simplicity was exactly the problem: &lt;strong&gt;it hydrated the entire env object straight into the browser runtime&lt;/strong&gt;. Every value. Including the ones a given test never reads. Your admin password, your API tokens — all of it, sitting in browser-accessible memory, one &lt;code&gt;window&lt;/code&gt; inspection away, in every single spec.&lt;/p&gt;

&lt;p&gt;Easy to use? Absolutely. A credential-leaking surface baked into your test runner? Also absolutely.&lt;/p&gt;

&lt;p&gt;The v16 API splits the concern into two deliberately asymmetric halves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;cy.env(['key']).then(...)&lt;/code&gt;&lt;/strong&gt; — asynchronous, resolved &lt;strong&gt;Node-side&lt;/strong&gt;, strictly read-only. Values never touch the browser context until you explicitly consume them inside the callback. This is where credentials and tokens live now.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Cypress.expose('key')&lt;/code&gt;&lt;/strong&gt; — synchronous, a drop-in replacement, but only for values you've &lt;em&gt;explicitly opted in&lt;/em&gt; to exposing via a new top-level &lt;code&gt;expose:&lt;/code&gt; block in your config (a sibling to &lt;code&gt;env:&lt;/code&gt;, not nested inside it).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice the design: the safe path is ergonomic, the sensitive path is deliberately awkward. That asymmetry is the whole point.&lt;/p&gt;

&lt;h2&gt;
  
  
  The strategy: teaching the AI a classification heuristic
&lt;/h2&gt;

&lt;p&gt;Doing a mindless regex sweep across thousands of files would have been fast — and catastrophically wrong, because every single call site needed a &lt;strong&gt;classification decision&lt;/strong&gt; first. So instead of doing the work 3,000 times, I did it once: I encoded a strict heuristic and let Claude Code apply it mechanically.&lt;/p&gt;

&lt;p&gt;The heuristic:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Does the value contain a password, a username paired with a password, or any secret?&lt;/strong&gt; → It's sensitive. It &lt;strong&gt;stays&lt;/strong&gt; in the &lt;code&gt;env:&lt;/code&gt; block and every read site gets rewritten to the async &lt;code&gt;cy.env([...]).then(...)&lt;/code&gt; form.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Is it a feature flag (our &lt;code&gt;idp_active&lt;/code&gt;, &lt;code&gt;xbrl_active&lt;/code&gt;), a locale, a timeout, a base URL fragment?&lt;/strong&gt; → It's public. It &lt;strong&gt;moves&lt;/strong&gt; to the &lt;code&gt;expose:&lt;/code&gt; block and the read becomes a one-line swap to &lt;code&gt;Cypress.expose()&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rule 2 is boring. Rule 1 is where the migration earns its war stories.&lt;/p&gt;

&lt;h2&gt;
  
  
  From prompt to Skill: making the knowledge permanent
&lt;/h2&gt;

&lt;p&gt;The Cypress team actually ships an official starting point for this — the &lt;a href="https://github.com/cypress-io/ai-toolkit/blob/main/prompt-library/cypress-v16-migration/remove-cypress-env-usage.md" rel="noopener noreferrer"&gt;remove-cypress-env-usage prompt from the Cypress AI Toolkit&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fagmdeoz0yidhduh5xcrv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fagmdeoz0yidhduh5xcrv.png" alt="Real prompt from Cypress team" width="800" height="634"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It's good. But a prompt in a library has two problems: &lt;strong&gt;you have to remember it exists&lt;/strong&gt;, and &lt;strong&gt;you have to re-paste it every session&lt;/strong&gt;. A Claude Code Skill solves both. A Skill is just a folder with a &lt;code&gt;SKILL.md&lt;/code&gt; — a markdown file with a small YAML frontmatter (name + description) followed by the instructions. Claude Code scans the descriptions on every task and &lt;strong&gt;auto-loads the skill when the context matches&lt;/strong&gt;, so the moment I say "migrate this spec off Cypress.env", the whole playbook is already in its head. No copy-paste, no drift between sessions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9pa2uml0cwyjoch7ber0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9pa2uml0cwyjoch7ber0.png" alt="Prompt set as Claude skill" width="800" height="194"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/
└── .claude/
    └── skills/
        └── cypress-v16-migration/
            └── SKILL.md    # frontmatter + the full migration playbook
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But here's the important part — I didn't just copy the official prompt into a file. I &lt;strong&gt;transformed&lt;/strong&gt; it, layering in everything the generic version can't know about &lt;em&gt;my&lt;/em&gt; repo:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;classification heuristic&lt;/strong&gt; above, with our real flag names (&lt;code&gt;idp_active&lt;/code&gt;, &lt;code&gt;xbrl_active&lt;/code&gt;) as worked examples, so it never has to guess what "sensitive" means in our codebase.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;command-queue traps&lt;/strong&gt; you're about to read below, written as explicit "never do this / always do this" rules — because I hit them once and never wanted the AI to reproduce them.&lt;/li&gt;
&lt;li&gt;Our repo topology: &lt;strong&gt;all four active config files&lt;/strong&gt; that need the &lt;code&gt;expose:&lt;/code&gt; block and the final flag flip, so nothing gets a partial migration.&lt;/li&gt;
&lt;li&gt;The verification sequence (grep → flag → CI) as a mandatory checklist the skill must run before declaring victory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The generic prompt is the textbook; the Skill is the textbook annotated by someone who took the exam. And since it's a personal skill (kept local, not committed to the repo), I can keep sharpening it without a PR review debate about my prompt-engineering style. 😄&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the plot thickens 🕵️
&lt;/h2&gt;

&lt;p&gt;You might be thinking: &lt;em&gt;"Ok, this is still just a glorified find-and-replace with two output templates. What's the big deal?"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The big deal is &lt;strong&gt;the Cypress command queue&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Swapping a synchronous read for an asynchronous one &lt;em&gt;inside a fluent page-object chain&lt;/em&gt; changes the execution semantics of everything around it. Take our global &lt;code&gt;cy.login()&lt;/code&gt; command — the one every spec in the codebase depends on:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// BEFORE — synchronous, credentials resolved at enqueue time&lt;/span&gt;
&lt;span class="nx"&gt;Cypress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Cypress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;username&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;pass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Cypress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;password&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;session&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;loginPage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;typeUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;typePass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pass&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;goToHome&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Naive migration attempt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// BROKEN — do you see it?&lt;/span&gt;
&lt;span class="nx"&gt;Cypress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;username&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;password&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;session&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;loginPage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;typeUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;typePass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;goToHome&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// 💥&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Looks reasonable. It's a time bomb. Here's why:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trap #1 — silent reordering.&lt;/strong&gt; Cypress enqueues commands synchronously as JavaScript executes, but runs them later. That trailing &lt;code&gt;cy.goToHome()&lt;/code&gt; gets &lt;strong&gt;enqueued before the &lt;code&gt;.then()&lt;/code&gt; callback ever fires&lt;/strong&gt; — and any &lt;em&gt;non-Cypress&lt;/em&gt; code after the block (variable assignments, page-object state mutations) executes immediately, before the credentials even exist. No error. No warning. Just your test quietly doing things in the wrong order. This is, by far, the easiest mistake to make in the entire migration, and grep will never find it for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trap #2 — &lt;code&gt;cy.session()&lt;/code&gt; needs a resolved ID.&lt;/strong&gt; The session ID argument is evaluated &lt;em&gt;at call time&lt;/em&gt;, not at run time. You can't hand it a promise or a pending value. So the entire &lt;code&gt;cy.session(...)&lt;/code&gt; invocation — not just its setup callback — has to move &lt;strong&gt;inside&lt;/strong&gt; the &lt;code&gt;cy.env().then()&lt;/code&gt; callback:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// CORRECT — everything downstream of the credentials lives inside the callback&lt;/span&gt;
&lt;span class="nx"&gt;Cypress&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Commands&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;env&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;username&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;password&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;password&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;session&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;loginPage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;visit&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;typeUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;username&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;typePass&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;password&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;submit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nx"&gt;cy&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;goToHome&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And here's the payoff of years of discipline: because every login flow was registered through &lt;code&gt;Cypress.Commands.add&lt;/code&gt;, this entire architectural shift happened &lt;strong&gt;behind the command boundary&lt;/strong&gt;. Thousands of &lt;code&gt;cy.login()&lt;/code&gt; call sites across the specs didn't change by a single character. The abstraction held. This, kids, is why you wrap your login logic in a custom command instead of copy-pasting it into 5k tests (ask me how I know 😉).&lt;/p&gt;

&lt;h2&gt;
  
  
  The final lockdown 🔒
&lt;/h2&gt;

&lt;p&gt;A migration you can't &lt;em&gt;verify&lt;/em&gt; is just a migration you &lt;em&gt;hope&lt;/em&gt; worked. Cypress v16 gives you a kill switch for exactly this: &lt;code&gt;allowCypressEnv: false&lt;/code&gt;. With it set, any surviving &lt;code&gt;Cypress.env()&lt;/code&gt; call becomes a &lt;strong&gt;hard runtime failure&lt;/strong&gt; — not a warning, a crash.&lt;/p&gt;

&lt;p&gt;My verification sequence:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;grep&lt;/code&gt; the branch for live &lt;code&gt;Cypress.env(&lt;/code&gt; calls → zero hits (comments and the migration doc don't count).&lt;/li&gt;
&lt;li&gt;Flip &lt;code&gt;allowCypressEnv: false&lt;/code&gt; across &lt;strong&gt;all four&lt;/strong&gt; active config files — no partial lockdowns, no "we'll enable it on that config later."&lt;/li&gt;
&lt;li&gt;Ship it to CI and let the full E2E stages be the judge.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Green across the board. And here's the subtle part that made it safe: we only changed the &lt;strong&gt;read API&lt;/strong&gt;, never the &lt;strong&gt;injection mechanism&lt;/strong&gt;. Every CI secret, every &lt;code&gt;--env&lt;/code&gt; CLI override, every pipeline variable kept flowing exactly as before — they just land in a place the browser can no longer see by default.&lt;/p&gt;

&lt;h2&gt;
  
  
  The commit log tells the real story 📜
&lt;/h2&gt;

&lt;p&gt;Want proof that the Skill approach actually moved fast? Read the git history like a detective:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;First PR:
Tue 11:27  Migration to v16
Tue 12:11  [E2E] Migration to Cypress v16 architecture
Tue 14:44  Updating Cypress env flag
Wed 16:04  Updating Typescript types

Fixing login issue:
Thu 10:23  [E2E] Fixing idp override with v16 Cy migration 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Look at Tuesday morning: the &lt;strong&gt;bulk rewrite of the entire architecture landed in about 45 minutes&lt;/strong&gt;, between the first pass and the structured &lt;code&gt;[E2E]&lt;/code&gt; commit. That's thousands of call sites, classified and rewritten, in less time than a sprint planning meeting. Two hours later, &lt;code&gt;allowCypressEnv: false&lt;/code&gt; was already flipped — the kill switch armed on day one.&lt;/p&gt;

&lt;p&gt;Then comes the honest part, the part most migration posts conveniently forget: &lt;strong&gt;the long tail&lt;/strong&gt;. Wednesday was TypeScript's turn — &lt;code&gt;cy.env()&lt;/code&gt; returning a promise-like of a keyed object meant the old string-based typings had to be reshaped, so the compiler could catch a mistyped key at build time instead of CI catching it at run time.&lt;/p&gt;

&lt;p&gt;And Thursday? Thursday delivered the one trap the Skill didn't know about yet — &lt;strong&gt;Trap #3, the runtime override&lt;/strong&gt;. One special spec family runs against a different server with IDP/SSO enabled, and it used to flip that on with a runtime &lt;code&gt;Cypress.env('idp_active', true)&lt;/code&gt; in a &lt;code&gt;beforeEach&lt;/code&gt;. In v16, &lt;code&gt;idp_active&lt;/code&gt; now lives in the &lt;code&gt;expose:&lt;/code&gt; block — and exposed values are &lt;strong&gt;resolved from config, read-only at runtime&lt;/strong&gt;. The old setter didn't crash; it just silently did nothing, and the spec calmly logged into the wrong server. The fix was moving the override where v16 wants it: into the spec-level config override, resolved &lt;em&gt;before&lt;/em&gt; the test runs, not mutated &lt;em&gt;during&lt;/em&gt; it.&lt;/p&gt;

&lt;p&gt;Guess what happened next? That trap went straight into the &lt;code&gt;SKILL.md&lt;/code&gt;. The next migration Claude Code runs already knows about runtime overrides of exposed values. &lt;strong&gt;That's the whole point of a Skill over a prompt: it compounds.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The takeaway
&lt;/h2&gt;

&lt;p&gt;A breaking-change migration at this scale isn't a refactor problem, it's a &lt;strong&gt;classification + execution-semantics&lt;/strong&gt; problem. The AI didn't make the hard decisions — the heuristic did. The AI just made applying that heuristic across thousands of files not cost me a month of my life. And by encoding it as a Skill instead of a throwaway prompt, every trap I hit made the &lt;em&gt;next&lt;/em&gt; migration cheaper.&lt;/p&gt;

&lt;p&gt;What about you? Have you ever had to architect a massive, breaking-change migration across thousands of tests? What was the trap that almost got you — and did your abstractions hold when it mattered? Leave me a comment, I'd love to hear!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>cypress</category>
      <category>e2etesting</category>
    </item>
    <item>
      <title>How I stopped declaring login in each of my 5k tests</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Fri, 27 Feb 2026 19:26:44 +0000</pubDate>
      <link>https://dev.to/cypress/how-i-stopped-declaring-login-in-each-of-my-5k-tests-37km</link>
      <guid>https://dev.to/cypress/how-i-stopped-declaring-login-in-each-of-my-5k-tests-37km</guid>
      <description>&lt;p&gt;Have you ever encountered a testing codebase that many portions are repeated over and over? We all have! Of course, I could be talking about DRY princples (Don't Repeat Yourself), but lets keep that aside for now and focus on a Cypress trick up it's sleeve that can go unnoticed for many senior devs: the global hooks.&lt;/p&gt;

&lt;p&gt;And what do I mean by "global" hooks? They're called like that because you only declare them once and they're applied to all your tests instantly. &lt;/p&gt;

&lt;p&gt;So let's get to the grain here: when installing Cypress it already comes with a file at created at &lt;code&gt;cypress/support/e2e.&amp;lt;ts|js&amp;gt;&lt;/code&gt; level. This is usually where you declare some important commands &lt;em&gt;imports&lt;/em&gt; that your E2E testing will need to access and run properly.&lt;/p&gt;

&lt;p&gt;But it's also responsible for adding let's say &lt;em&gt;before&lt;/em&gt;, &lt;em&gt;beforeEach&lt;/em&gt;, or &lt;em&gt;after&lt;/em&gt;, &lt;em&gt;afterEach&lt;/em&gt; hooks that will be applied by all your tests. This can be responsible for login hooks, clean-ups to the database after the tests run, screenshots resolutions configuration -- a million of possibilities here.&lt;/p&gt;

&lt;p&gt;I guess that the "global hooks" makes more sense now, right? &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The challenge&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;At my workplace, I encountered the command to login, called &lt;code&gt;cy.login&lt;/code&gt;, declared in each of the 5.634 tests that we have. For a while it bothered me a lot, because I always wanted to remove this codelines, and make my life easier with a simple &lt;code&gt;e2e.ts&lt;/code&gt; file that handled all existing and new login logic for future tests.&lt;/p&gt;

&lt;p&gt;But if I knew how it worked, why didn't I just do it already? &lt;/p&gt;

&lt;p&gt;Becuase, for the first time (for me), I was dealing with a really complex system: a big chunk of the legacy tests ran with &lt;code&gt;testIsolation: false&lt;/code&gt;. That meant that they only login once, and the &lt;code&gt;it&lt;/code&gt; blocks don't load a new baseURL after each one is done. They do it all in one session.&lt;/p&gt;

&lt;p&gt;Because? Well, that would be another story, so let's just accept their done like that for "system requirements" at the time.&lt;/p&gt;

&lt;p&gt;Ok, so I basically needed:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;before() → cy.login()&lt;br&gt;
beforeEach() → cy.login() only if testIsolation is true&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Easy right? Not yet. The complexity resides because different spec families have different needs: different credentials, different environments, different session strategies, and different testIsolation settings. &lt;/p&gt;

&lt;p&gt;There are two needs here to login:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which login method?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cy.login(): Default specs with standard app with default credential.&lt;/li&gt;
&lt;li&gt;cy.loginDemo(): Presentation specs with different environment, likely SSO or different credentials.&lt;/li&gt;
&lt;li&gt;Custom (own login): Need specific credentials or totally different E2E tests outside enviroment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;When to login? (before vs beforeEach)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is driven by Cypress's testIsolation setting:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;testIsolation: true&lt;/code&gt; — Cypress clears browser state (cookies, storage) between each test. Session is lost → must re-login before each test.&lt;br&gt;
&lt;code&gt;testIsolation: false&lt;/code&gt; — Cookies persist across tests in the same spec → login once is enough.&lt;/p&gt;

&lt;p&gt;Now, here is where the plot thickens. I had to declare folders, tests, paths that needed to be skipped (or not), because on the same folder I had &lt;code&gt;testIsolation: true/false&lt;/code&gt;. So, follow me along:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Legacy specs (/legacy/ folder)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;before()&lt;/code&gt; → skip entirely&lt;br&gt;
&lt;code&gt;beforeEach()&lt;/code&gt; → only call cy.login() if testIsolation is true&lt;/p&gt;

&lt;p&gt;Legacy specs use specific credentials. If the global before() called cy.login() first, cy.session() would cache the wrong credentials, causing 500 errors when the spec then tries to login with different ones. So global before() is completely skipped. In beforeEach(), it only re-validates when state is actually cleared (testIsolation: true).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Training portal specs (/training/ folder) + Custom login specs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;before()&lt;/code&gt; → skip entirely&lt;br&gt;
&lt;code&gt;beforeEach()&lt;/code&gt; → skip entirely&lt;/p&gt;

&lt;p&gt;These specs manage their own login end-to-end. The global hooks stay completely out of the way. Some tests likely test login flows themselves or use role-specific credentials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. BEFORE_LOGIN_DEMO_SPECS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;before()&lt;/code&gt; → &lt;code&gt;cy.loginDemo() + cy.goToHome()&lt;/code&gt;&lt;br&gt;
&lt;code&gt;beforeEach()&lt;/code&gt; → skip (already logged in)&lt;/p&gt;

&lt;p&gt;Login once per spec, reused across all tests. These are demo/presentation specs where re-logging in per test would be slow and unnecessary.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. BEFORE_EACH_LOGIN_DEMO_SPECS&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;code&gt;before()&lt;/code&gt; → nothing&lt;br&gt;
&lt;code&gt;beforeEach() → cy.loginDemo() + cy.goToHome()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Similar to above but login is repeated per test because &lt;code&gt;testIsolation: true&lt;/code&gt;, the state is cleared between tests, so they must re-login each time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. LOGIN_DEMO_SPECIAL_SPECS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;before() → nothing&lt;br&gt;
beforeEach() → override baseUrl + timeout + idp_active env, then cy.loginDemo()&lt;/p&gt;

&lt;p&gt;This spec runs against a completely different server, with an IDP/SSO active flag and a much longer timeout. The config must be set before each test because test isolation may reset Cypress config state.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Default specs (everything else, A.K.A the MOST important logic!)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;before() → cy.login()&lt;br&gt;
beforeEach() → cy.login() only if testIsolation is true&lt;/p&gt;

&lt;p&gt;Standard app, default credentials. Login once in before(), then beforeEach() only re-validates the session if Cypress actually cleared it (testIsolation: true). If testIsolation is false, cookies persist and calling cy.login() again would navigate back to home, breaking any test that expects to be on a specific page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The key insight: why before AND beforeEach?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You're asking "are you mental? why on earth would you declare login TWICE?", basically because:&lt;/p&gt;

&lt;p&gt;before()     → establishes the initial session (runs once)&lt;br&gt;
beforeEach() → re-validates/restores the session if testIsolation cleared it&lt;/p&gt;

&lt;p&gt;For specs with testIsolation: false, beforeEach() is a no-op (or returns early) because the session is still alive. For specs with testIsolation: true, beforeEach() must re-run the login to restore the cleared session — but it uses cy.session() internally which caches credentials.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4p9u788bh4lr91levn43.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4p9u788bh4lr91levn43.png" alt=" " width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here's a sneak peek of how my &lt;code&gt;e2e.ts&lt;/code&gt; file looks in it's (hopefully) final form:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdf703lpxrsubqex85z3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbdf703lpxrsubqex85z3.png" alt=" " width="800" height="783"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And I basically removed the cy.login function from more than 1k files in my codebase, leaving me or any other engineer to not worry anymore about the login being declared at test level, it handles everything for me now, as it should.&lt;/p&gt;

&lt;p&gt;What about you? Have you ever encountered a challenging and complex test codebase to deal with? What was the most difficult change you had to make? Leave me a comment, I would love to hear!&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>e2etesting</category>
      <category>typescript</category>
      <category>login</category>
    </item>
    <item>
      <title>How to validate tables, rows or any content of an Excel file using Cypress</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Fri, 31 Oct 2025 11:43:24 +0000</pubDate>
      <link>https://dev.to/cypress/how-to-validate-a-content-of-an-xlsx-file-using-cypress-45da</link>
      <guid>https://dev.to/cypress/how-to-validate-a-content-of-an-xlsx-file-using-cypress-45da</guid>
      <description>&lt;p&gt;At the company I work for, we already have many test cases to validate a key behavior of our SaaS, which through the user downloads a table as an Excel file of the information needed. But there was a need to validate some edge cases, in which we also needed to validate that the content corresponds to what the table showed.&lt;/p&gt;

&lt;p&gt;This would mean that Cypress needs to deterministically validate rows, numbers, names and even colors inside the Excel file set by our user flows. After some research, we basically came upon two &lt;em&gt;Node.js&lt;/em&gt; libs: &lt;code&gt;@e965/xlsx&lt;/code&gt; and &lt;code&gt;exceljs&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;While &lt;code&gt;@e965/xlsx&lt;/code&gt; is mostly used for data content validation, as in validating a JSON rows straight from the sheet - &lt;code&gt;exceljs&lt;/code&gt; is more focused for style assertion, meaning assertions like “is A1 light-green?”. All right, so now we could split keeps tests readable and fast.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuring &lt;a class="mentioned-user" href="https://dev.to/e965"&gt;@e965&lt;/a&gt;/xlsx library&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, wire up the configuration in Cypress. Head off to Node with cy.task(). It’s the official way to run filesystem code from Cypress tests: register tasks in setupNodeEvents and they’ll return values back to your spec.&lt;/p&gt;

&lt;p&gt;Remember to also import the package on the config file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//cypress.config.ts

const xlsx = require('@e965/xlsx');
...
...
...
      on('task', {
        async readExcelByPattern(pattern: string, timeoutMs = 15000) {
          const re = new RegExp(pattern);
          const end = Date.now() + timeoutMs;

          while (Date.now() &amp;lt; end) {
            const files = fs.readdirSync(downloadsDir).filter(f =&amp;gt; re.test(f) &amp;amp;&amp;amp; !f.endsWith('.crdownload') &amp;amp;&amp;amp; !f.endsWith('.tmp'));

            if (files.length) {
              const { fullPath } = files
                .map(f =&amp;gt; {
                  const fullPath = path.join(downloadsDir, f);
                  return { fullPath, mtime: fs.statSync(fullPath).mtimeMs };
                })
                .sort((a, b) =&amp;gt; b.mtime - a.mtime)[0];

              await sleep(200);

              const wb = xlsx.readFile(fullPath);
              const sheet = wb.Sheets[wb.SheetNames[0]];
              const data = xlsx.utils.sheet_to_json(sheet);
              return { fileName: path.basename(fullPath), data };
            }

            await sleep(300);
          }

          throw new Error(`File .xlsx taht matches /${pattern}/ not found on "${downloadsDir}" inside ${timeoutMs}ms`);
        },
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see that &lt;code&gt;readExcelByPattern&lt;/code&gt; is the task we should call to validate the content like rows, tables and any information inside the Excel file. You can then define it inside your test context and methods (or define it globally over &lt;code&gt;commands.ts&lt;/code&gt; if you plan to use it in many tests), but for a single test it should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//my-testing-context.ts

  @step('Read downloaded excel values')
  readExcelDownloadedFile(
    pathToFile: string = 'excel_export/bugs/',
    fixture: string,
    fileName: string
  ): ExportPrintableReportContext&amp;lt;TParent&amp;gt; {
    cy.fixture(pathToFile + fixture).then((expected: any[]) =&amp;gt; {
      cy.task('readExcelByPattern', fileName).then(({ data }: { data: any[] }) =&amp;gt; {
        expect(data.length, 'Table length').to.equal(expected.length);
        expected.forEach((expectedRow, i) =&amp;gt; {
          const actualRow = data[i];
          Object.entries(expectedRow).forEach(([key, expectedValue]) =&amp;gt; {
            const actualValue = actualRow[key] === undefined ? null : actualRow[key];
            expect(actualValue, `Row ${i} - Column "${key}"`).to.equal(expectedValue);
          });
        });
      });
    });
    return this;
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see it's pretty straight forward, it calls for a JSON file inside 'fixtures/excel_export/bugs/' that already has the values you want to validate and should be equal to the Excel file and executes a forEach of the Table length, and each row, which already awaits for a value.&lt;/p&gt;

&lt;p&gt;And this is how it would look inside a test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { testContext } from '@/my-testing-context'

const testingContext = new testContext();

describe('example of reading excel files', =&amp;gt; ()
  it('case 1', () =&amp;gt; {
    testingContext.readExcelDownloadedFile('excel_export/bugs/', tk, 'Excel.xlsx');
  });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Basically it checked 171 rows of the file content and succeeded in 40 seconds.&lt;/p&gt;

&lt;p&gt;For the second part of this tutorial, I'll expand on how to validate Excel colors as well. Happy testing!&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>testing</category>
      <category>automation</category>
    </item>
    <item>
      <title>How to get most out of cy.prompt() - 6 tips and tricks for your new AI tool!</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Thu, 09 Oct 2025 13:54:06 +0000</pubDate>
      <link>https://dev.to/cypress/how-to-get-most-out-of-cyprompt-6-tips-and-tricks-for-your-new-ai-tool-425l</link>
      <guid>https://dev.to/cypress/how-to-get-most-out-of-cyprompt-6-tips-and-tricks-for-your-new-ai-tool-425l</guid>
      <description>&lt;p&gt;I know, I know, Cypress has just announced a game changing feature with &lt;a href="https://www.cypress.io/blog/cy-prompt-frequently-asked-questions" rel="noopener noreferrer"&gt;cy.prompt()&lt;/a&gt; that is going to change the way we test - or at least approach how we think of it. You're going to use Natural Language all the way to test your new app? Read through my recommendations then!&lt;/p&gt;

&lt;p&gt;As a Cypress Ambassador I was lucky enough to be using &lt;a href="https://dev.to/marcelo_sqe/how-cypress-will-revolutionize-the-use-of-ai-in-testing-with-cyprompt-5gm2-temp-slug-2006966?preview=9c4ef5e51e58155f38ad1dcbf9f431475aa6874a9ce433001e022fdfd3b97ca85fd89420f5701d27bf06a28628c31b13e4802cb49d6966bf50a7aaee"&gt;cy.prompt&lt;/a&gt; for the past weeks and here are a few tips to make your testing and usage go a bit smoothly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Start your phrase with the action or assertion you want&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Instead of giving it an instruction like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;When the page loads, check that the header is seen and then click on Create button&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Would be better to:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Wait 8 seconds for the page to load&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Assert that the header is visible&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Click on create button&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now Cypress will translate your instructions more easily - a hardcoded &lt;em&gt;wait&lt;/em&gt;, followed by an &lt;em&gt;assertion&lt;/em&gt;, followed by a &lt;em&gt;click&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Try to separate instructions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The previous step gave it away already! Cypress prompt works as any other LLM - give clear instructions of what you want to do and it'll have a better chance to execute it.&lt;/p&gt;

&lt;p&gt;Do not mix assertions, with force clicks, with reloads in the same line of action! The prompt needs to go through, so in a way try to act as a &lt;em&gt;prompt engineer&lt;/em&gt; and step by step you'll get there.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) You can have up to 20 steps for each prompt you execute&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;20 is the limit, ok. But that doesn't mean that you need to have 20 steps each prompt. Also, the more steps you add, the prone it is to ask for clarifications or make mistakes.&lt;/p&gt;

&lt;p&gt;Think of it as this: each plain English text line you introduce is an abstraction layer, right? Do want an over-complicated test, or a easy to read through, understandable (for non-developers specially) test?&lt;/p&gt;

&lt;p&gt;Lesser is better in some cases!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcdw6hj3hgfmfmt31sfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcdw6hj3hgfmfmt31sfs.png" alt=" " width="800" height="687"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Leave some tests in prompt in order to validate flaky behavior&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Got a new feature? Want to avoid brittle in your E2E test? Want to check for any weird behavior here and there? Then cy.prompt is your way to go! You can always leave your tests in plain English to see if the BDD/TDD behavior stays the same. &lt;/p&gt;

&lt;p&gt;Remember: it works in both local and CI - but it only supports Chrome or Chromium browsers (Edge/Electron). Any others are out (sorry Firefox!). Leave it a few days or weeks in your CI in prompt scenario and see what happens.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5) Portability first?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For me any test that is written in plain English has a natural advantage over each other. It doesn't need to be refactored into any other programming language. So if you already know that the application you're working now is starting to be ported into another modern framework, leave your tests in prompt format. Your devs will appreaciate!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6) It's always cached&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Another advantage with cy.prompt is that once it runs, it will cache the steps in order to avoid LLM interaction. But if you change one line in your prompt - wait 15 seconds instead of 8, for example - it will execute all over again.&lt;/p&gt;

&lt;p&gt;Remember this to focus on speed and reliability in your tests!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>testing</category>
      <category>javascript</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How Cypress will revolutionize the use of AI in testing with cy.prompt()</title>
      <dc:creator>Marcelo C.</dc:creator>
      <pubDate>Thu, 09 Oct 2025 10:28:22 +0000</pubDate>
      <link>https://dev.to/cypress/how-cypress-will-revolutionize-the-use-of-ai-in-testing-with-cyprompt-fe9</link>
      <guid>https://dev.to/cypress/how-cypress-will-revolutionize-the-use-of-ai-in-testing-with-cyprompt-fe9</guid>
      <description>&lt;p&gt;Cypress has become the go-to testing framework for SDETs and QA engineers to validate modern web apps. It’s fast, reliable, and backed by a mature ecosystem—both in &lt;a href="https://docs.cypress.io/app/references/changelog" rel="noopener noreferrer"&gt;software updates&lt;/a&gt; and excellent &lt;a href="https://docs.cypress.io/app/get-started/why-cypress" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;. Add to that the vibrant community building powerful &lt;a href="https://dev.to/sebastianclavijo/my-top-191-favorite-cypress-plugins-for-testing-with-wick-like-precision-3fhh"&gt;plugins and extensions&lt;/a&gt;, and it’s clear why Cypress dominates the testing landscape.&lt;/p&gt;

&lt;p&gt;Cypress is taking a bold step into AI-powered testing with the upcoming &lt;a href="https://www.cypress.io/blog/cy-prompt-frequently-asked-questions" rel="noopener noreferrer"&gt;cy.prompt()&lt;/a&gt;. Unlike typical AI integrations that act as external copilots or rely on general-purpose &lt;em&gt;MCP-style&lt;/em&gt; assistants, &lt;code&gt;cy.prompt()&lt;/code&gt; adds the intent (what we want) built directly into the testing workflow.&lt;/p&gt;

&lt;p&gt;This means no context switching, no juggling between an IDE plugin and your test runner. Instead, Cypress allows you to describe your intent in plain English, and the AI automatically generates selectors, actions, and assertions right inside your test.&lt;/p&gt;

&lt;p&gt;It’s a shift from writing tests line by line to guiding your tests conversationally. Think less about &lt;code&gt;cy.get()&lt;/code&gt; or &lt;code&gt;cy.click()&lt;/code&gt; and more about telling Cypress what you want verified, letting the framework translate that into executable code.&lt;/p&gt;

&lt;p&gt;Here’s a video demonstration of &lt;code&gt;cy.prompt()&lt;/code&gt; in action:&lt;/p&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/Z_u8R3Z5spw"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This is the code that I used in the validation:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz55buxl9xe4od78p2oox.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz55buxl9xe4od78p2oox.png" alt=" raw `cy.prompt()` endraw  in action" width="690" height="288"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And here is what the prompt suggests of code locators right after is executed:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fag177k1he4h8hj438fik.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fag177k1he4h8hj438fik.png" alt="After usage,  raw `cy.prompt()` endraw  can insert the needed code into your IDE" width="767" height="694"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, you can leave the prompt as it is and push to your CI/CD pipeline:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxcvxemz08kdy0nwyw91.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxcvxemz08kdy0nwyw91.png" alt="Github Actions running directly with the prompt and passing" width="800" height="1096"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;cy.prompt()&lt;/code&gt;, Cypress is no longer “just” a testing framework—it’s stepping into the AI-assisted development era. For SDETs and QA engineers, this means faster authoring, smarter locator handling, and easier onboarding for teams.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The possibilities of cy.prompt()&lt;/strong&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cy.prompt focus on the intent:&lt;/strong&gt; what we want, not how do do it. It's a great tool for non-developers, or anyone who doesn’t want to dive deep into app implementation.

&lt;/li&gt;
&lt;li&gt;Imagine writing the &lt;strong&gt;BDD&lt;/strong&gt; (Behavior Driven Development) acceptance criteria directly into the test. You'll have the best of both worlds here, BDD criteria that is understood by all stakeholders (Project Managers, Product Owners), and the code being executed in the background.

&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TDD&lt;/strong&gt; (Test-Driven-Development) is also covered for the developers. Imagine developing a feature until is ready and, step by step (word by word, line by line) it start to pass. Until is ready for deployment.

&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Portability is here:&lt;/strong&gt; Need to refactor your project? Move from one programming language to another? Don't need to change a thing in your tests written in plain English, they can be easily shared, exported, or integrated across different systems.

&lt;/li&gt;
&lt;li&gt;Also, another great benefit here are the &lt;strong&gt;self-healing&lt;/strong&gt; tests, they’re more resilient to changes in the DOM or selectors. This feature could fundamentally change how we approach automation. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The future of QA is not just code—it’s collaboration between AI and testers.&lt;/p&gt;

&lt;p&gt;What are your thoughts? &lt;/p&gt;

&lt;p&gt;Share, comment or connect with me directly in &lt;a href="https://www.linkedin.com/in/marceloc/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>cypress</category>
      <category>ai</category>
      <category>promptengineering</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
