<?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: muhammad hussain</title>
    <description>The latest articles on DEV Community by muhammad hussain (@muhammad_hussain).</description>
    <link>https://dev.to/muhammad_hussain</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%2F4281308%2Fc86bd691-f6fe-4b4e-a1bb-b3bd6d69bb9a.jpg</url>
      <title>DEV Community: muhammad hussain</title>
      <link>https://dev.to/muhammad_hussain</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammad_hussain"/>
    <language>en</language>
    <item>
      <title>Five bugs caught before any code: a one-switch voice in the Kiro CLI</title>
      <dc:creator>muhammad hussain</dc:creator>
      <pubDate>Thu, 03 Dec 2026 19:26:52 +0000</pubDate>
      <link>https://dev.to/muhammad_hussain/five-bugs-caught-before-any-code-a-one-switch-voice-in-the-kiro-cli-22gk</link>
      <guid>https://dev.to/muhammad_hussain/five-bugs-caught-before-any-code-a-one-switch-voice-in-the-kiro-cli-22gk</guid>
      <description>&lt;p&gt;Some people can't speak and can barely move. Many of them can still press one switch. Dot-Dash lets them type in Morse code with that one switch, and the browser speaks the message out loud.&lt;/p&gt;

&lt;p&gt;I built it alone for Kiroween 2026 (Resurrection category): the telegraph key from 1844, brought back as a voice.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Try it:&lt;/strong&gt; &lt;a href="https://hussnain-butt.github.io/dot-dash/" rel="noopener noreferrer"&gt;https://hussnain-butt.github.io/dot-dash/&lt;/a&gt; (free, no login, nothing to install)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code:&lt;/strong&gt; &lt;a href="https://github.com/Hussnain-Butt/dot-dash" rel="noopener noreferrer"&gt;https://github.com/Hussnain-Butt/dot-dash&lt;/a&gt; (MIT)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Video:&lt;/strong&gt; &lt;a href="https://www.youtube.com/watch?v=vt2H2i0CAqY" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=vt2H2i0CAqY&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Turn your sound on and press the space bar: a quick tap is a dot, a press about three times longer is a dash. Key &lt;code&gt;.-- .- - . .-.&lt;/code&gt; (WATER), pausing between letters, then &lt;code&gt;.-.-&lt;/code&gt;, and the browser says "I need water".&lt;/p&gt;

&lt;p&gt;This post is about building it with Kiro, and what I learned.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I used the terminal
&lt;/h2&gt;

&lt;p&gt;The Kiro IDE doesn't start on my PC: Windows Smart App Control blocks one of its unsigned native modules. I kept that security feature on and built the whole project in the Kiro CLI, with the V3 engine (&lt;code&gt;kiro-cli --v3&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;What I noticed first: every file write and every git command asked for my approval, so I always knew what reached GitHub. (Near the end I allowed reads, writes and npm commands, and kept git manual.) Two terminal lessons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/spec new&lt;/code&gt; works only when typed inside the TUI. From the command line, &lt;code&gt;kiro-cli chat --mode spec&lt;/code&gt; starts Kiro's Spec agent.&lt;/li&gt;
&lt;li&gt;Send long prompts from a small &lt;code&gt;.cmd&lt;/code&gt; file. Text pasted into the TUI inside an embedded terminal panel never reached Kiro.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Who wrote what: Kiro wrote every file in the repo. I used Claude Code to help write prompts and as a second reviewer. It never wrote app code, and its findings went back to Kiro as fix prompts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Specs for the hard logic
&lt;/h2&gt;

&lt;p&gt;A one-switch decoder sounds simple, but the timing is hard: a slow dot versus a quick dash, or a thinking pause versus a word break, for someone whose presses drift as they tire. So everything with subtle behaviour went through a spec before any code, and the rest were plain prompts.&lt;/p&gt;

&lt;p&gt;The decoder spec has 11 requirements, and every acceptance criterion is in EARS form: WHEN something happens, THE system SHALL do something. This one lets a user undo with the switch alone:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;### 8. Undo
&lt;/span&gt;As a user who makes mistakes, I want to undo my last letter and my last word, each with one action.

Acceptance criteria:
8.1 WHEN the user enters the Morse error prosign (eight dots, &lt;span class="sb"&gt;`........`&lt;/span&gt;), THE decoder SHALL delete the last emitted letter, so a one-switch user can undo with the switch alone.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kiro's first draft ended with seven open questions, and my answers became decisions: start at about 5 words a minute, learn dots and dashes as two weighted moving averages, and show □ for an unknown code.&lt;/p&gt;

&lt;p&gt;Then Kiro wrote &lt;code&gt;design.md&lt;/code&gt;: the formulas for the adaptive timing engine, the full Morse table, the undo rules and 12 properties for property-based tests. Before any code, I reviewed it with Claude Code as a second reviewer. The review found five bugs:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;J was coded as &lt;code&gt;.--.&lt;/code&gt;, which is P.&lt;/li&gt;
&lt;li&gt;The "ambiguous zone" spanned the whole gap between the dot and dash averages, and the more common symbol won there. A slightly short dash would have been read as a dot, and Kiro's own round-trip property would have failed.&lt;/li&gt;
&lt;li&gt;Every new symbol reset the "two erase signs in a row" flag, so undoing a word could never happen.&lt;/li&gt;
&lt;li&gt;A letter was committed only at the next press or after a long idle timer, so the R of WATER would have appeared seconds late. A pure &lt;code&gt;tick(now)&lt;/code&gt; fixed it.&lt;/li&gt;
&lt;li&gt;The scale property allowed any factor, so fast timings would hit the 40 ms tremor floor and fail for no real reason.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Kiro fixed all five in one run for 6.31 credits. The whole decoder spec, from requirements to tasks, cost about 17.6 credits. My first lesson: on logic that is easy to get subtly wrong, read the design closely before anyone writes code, an agent included.&lt;/p&gt;

&lt;p&gt;One quirk: Kiro saved this first spec to &lt;code&gt;.kiro/spec/&lt;/code&gt;, but its own code reads &lt;code&gt;.kiro/specs/&lt;/code&gt;. The folder was renamed outside Kiro, the only change in the repo that Kiro didn't make.&lt;/p&gt;

&lt;p&gt;The second spec, &lt;code&gt;speak-screen&lt;/code&gt;, has 7 EARS requirements for speech, six quick phrases, the timing store and the screen. Kiro's own Spec agent wrote it, and it ran a format validator on its files until they passed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hooks: rules Kiro can't skip
&lt;/h2&gt;

&lt;p&gt;Steering tells Kiro what I want. Hooks check that it happened. I have two, and Kiro wrote both scripts.&lt;/p&gt;

&lt;p&gt;The Stop hook runs &lt;code&gt;npm run build&lt;/code&gt; (&lt;code&gt;tsc &amp;amp;&amp;amp; vite build&lt;/code&gt;) and then &lt;code&gt;npm test&lt;/code&gt; at the end of every Kiro turn, and exits with an error if either fails. A broken task can't look finished.&lt;/p&gt;

&lt;p&gt;The second hook protects a promise the app makes: no runtime network calls. This is the whole hook file, &lt;code&gt;.kiro/hooks/block-network-calls.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"v1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"hooks"&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="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Block runtime network calls under src/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"trigger"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"PreToolUse"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"matcher"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^(fs_write|fs_append|str_replace)$"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"node .kiro/hooks/no-network-calls.mjs"&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;For any write under &lt;code&gt;src/&lt;/code&gt;, &lt;code&gt;no-network-calls.mjs&lt;/code&gt; scans the new text. If it finds &lt;code&gt;fetch(&lt;/code&gt;, &lt;code&gt;XMLHttpRequest&lt;/code&gt;, &lt;code&gt;WebSocket&lt;/code&gt;, &lt;code&gt;EventSource&lt;/code&gt;, &lt;code&gt;sendBeacon&lt;/code&gt; or a URL import, it exits with code 2 and the write is blocked. Both hooks fired in real runs: in one run the guard checked 37 file writes, and the Stop hook ran the build and tests when the turn ended.&lt;/p&gt;

&lt;p&gt;My second lesson: a steering rule is something I hope Kiro remembers. A hook makes it something Kiro can't skip.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steering, one agent and four properties
&lt;/h2&gt;

&lt;p&gt;There are 7 steering files. Five use inclusion &lt;code&gt;always&lt;/code&gt;, because every task needs them: product, tech, structure, accessibility and the hackathon rules. Accessibility, for example, asks for 44 × 44 px targets and undo one action away.&lt;/p&gt;

&lt;p&gt;Two use &lt;code&gt;fileMatch&lt;/code&gt;. &lt;code&gt;morse-timing.md&lt;/code&gt; loads only for &lt;code&gt;src/morse/**&lt;/code&gt; and &lt;code&gt;tests/**&lt;/code&gt;, and &lt;code&gt;visual-design.md&lt;/code&gt; only for &lt;code&gt;src/ui/**&lt;/code&gt; and &lt;code&gt;tests/ui/**&lt;/code&gt;. The 1:3:3:7 timing ratios don't need to be in context while Kiro styles a button, and the palette doesn't while it tunes the decoder.&lt;/p&gt;

&lt;p&gt;The custom agent, &lt;code&gt;.kiro/agents/dot-dash.json&lt;/code&gt;, loads all seven steering files and the README. Its prompt says to work test-first and to finish one spec task, with passing tests and a clean build, before starting the next. Every December run used &lt;code&gt;--agent dot-dash&lt;/code&gt;, except the deploy run and the Spec-mode run.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;design.md&lt;/code&gt; defines 12 properties. On my credit budget I kept the four that guard the most: a round trip from text to Morse timing and back (P1), decoding with a learned timing (P2), no crash on random, out-of-order or negative timestamps (P3), and a round trip of the saved timing profile (P12). All four pass. This is P12, in fast-check:&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="n"&gt;fc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;assert&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;fc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;property&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;profileGen&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;original&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;TimingProfile&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="n"&gt;json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;serializeProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;original&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;restored&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;deserializeProfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&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="n"&gt;restored&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toEqual&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;original&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;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Kiro's first decoder tests used hand-worked timestamps, and five failed: one keyed B as three 240 ms presses, which is S. On Claude Haiku 4.5, Kiro kept changing the tests, and I cancelled the run after 24 minutes. Claude Code's review found the decoder right and the tests wrong. Kiro's fix was a keying helper that turns a Morse string such as &lt;code&gt;.- -...&lt;/code&gt; into presses with ideal timing. The decoder tests and the properties use it.&lt;/p&gt;

&lt;p&gt;In the browser, real key presses on a busy machine drifted by 50 to 70 ms and turned a dot into a dash ("WATTR"), so Claude Code's checks of the live app used Playwright's fake clock. The project ends with 181 Vitest tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Credits: the cheapest model wasn't the cheapest run
&lt;/h2&gt;

&lt;p&gt;I worked on Kiro's Free plan (50 credits a month), plus the hackathon's 4,000 credits from 3 Dec, when December's free credits ran out. The whole project used about 167 credits.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;kiro-cli chat --list-models&lt;/code&gt; shows each model's credit multiplier, and &lt;code&gt;--model&lt;/code&gt; picks one per run. I used Auto, Claude Haiku 4.5, Claude Sonnet 4.5 and MiniMax M2.5.&lt;/p&gt;

&lt;p&gt;MiniMax M2.5 runs at 0.25x, and it wrote my deploy workflow for 1.23 credits. Then I gave it a bigger task: four app modules. Five input-capture tests failed, because the input adapter called &lt;code&gt;performance.now()&lt;/code&gt; directly and the tests couldn't control time. MiniMax went in circles for over 20 minutes, re-reading files and re-sending its growing context. It burned 21.5 credits and hit my monthly limit.&lt;/p&gt;

&lt;p&gt;With the cause written into the prompt, Claude Sonnet 4.5 fixed the same problem for 5 credits. It added an optional clock to the input options and used a fake clock in the tests.&lt;/p&gt;

&lt;p&gt;My rules for a small budget now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;One Kiro task per prompt, test first.&lt;/li&gt;
&lt;li&gt;Put the cause in the prompt, not only the symptom.&lt;/li&gt;
&lt;li&gt;Stop a run once it is 50% past its estimate, whatever the model costs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Honest limits and what's next
&lt;/h2&gt;

&lt;p&gt;I haven't tested Dot-Dash with people who use AAC (augmentative and alternative communication), or with real assistive switches. An assistive switch that sends a space-bar press or a click should work like the space bar, but I don't own one, so that is untested. Testing with real users and real switches comes first. Next come the features I cut to fit 50 credits a month, starting with Urdu Morse and Urdu speech.&lt;/p&gt;

&lt;p&gt;Dot-Dash is free, MIT-licensed and needs nothing but a browser. Try it at &lt;a href="https://hussnain-butt.github.io/dot-dash/" rel="noopener noreferrer"&gt;https://hussnain-butt.github.io/dot-dash/&lt;/a&gt;, and open the &lt;code&gt;.kiro&lt;/code&gt; folder at &lt;a href="https://github.com/Hussnain-Butt/dot-dash" rel="noopener noreferrer"&gt;https://github.com/Hussnain-Butt/dot-dash&lt;/a&gt; to see everything in this post. If you use AAC, or work with people who do, I would like to hear what breaks. I built Dot-Dash for Kiroween 2026: a technology from 1844, giving a voice back in 2026.&lt;/p&gt;

</description>
      <category>kiro</category>
      <category>a11y</category>
      <category>typescript</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
