<?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>Forem: Steven Feng</title>
    <description>The latest articles on Forem by Steven Feng (@fh332393900).</description>
    <link>https://forem.com/fh332393900</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F985212%2Fe3955de1-81a7-487a-ae09-74cf82acb871.jpg</url>
      <title>Forem: Steven Feng</title>
      <link>https://forem.com/fh332393900</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/fh332393900"/>
    <language>en</language>
    <item>
      <title>AI Coding in a Mastodon Client: Prompting for Complex UI, Fast Iteration, and Reliable Behavior</title>
      <dc:creator>Steven Feng</dc:creator>
      <pubDate>Fri, 08 May 2026 07:22:24 +0000</pubDate>
      <link>https://forem.com/fh332393900/ai-coding-in-a-mastodon-client-prompting-for-complex-ui-fast-iteration-and-reliable-behavior-3ba5</link>
      <guid>https://forem.com/fh332393900/ai-coding-in-a-mastodon-client-prompting-for-complex-ui-fast-iteration-and-reliable-behavior-3ba5</guid>
      <description>&lt;p&gt;This article shares how AI Coding accelerated development of a Mastodon web client, with a focus on &lt;strong&gt;prompt-driven engineering&lt;/strong&gt;, &lt;strong&gt;complex interaction design&lt;/strong&gt;, and &lt;strong&gt;high‑leverage refactors&lt;/strong&gt;. It highlights prompt patterns, integration strategies, and two key features: &lt;strong&gt;React Query&lt;/strong&gt; and the &lt;strong&gt;rich text editor&lt;/strong&gt;.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Preview&lt;/strong&gt;: &lt;a href="https://v0-mastodon-client.vercel.app" rel="noopener noreferrer"&gt;https://v0-mastodon-client.vercel.app&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Github&lt;/strong&gt;: &lt;a href="https://github.com/fh332393900/mastodon-client" rel="noopener noreferrer"&gt;https://github.com/fh332393900/mastodon-client&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model note:&lt;/strong&gt; Most of the AI work used &lt;strong&gt;GPT‑5.2‑Codex&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1) Why AI Coding Here?
&lt;/h2&gt;

&lt;p&gt;The project evolved quickly: rich editor, federated search, emoji handling, code blocks, and multi‑language UI. AI was used as a &lt;strong&gt;co‑pilot for high‑impact changes&lt;/strong&gt;, not just boilerplate.&lt;/p&gt;

&lt;p&gt;Key goals:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ship complex interactions fast&lt;/li&gt;
&lt;li&gt;Maintain correctness (state boundaries, serialization)&lt;/li&gt;
&lt;li&gt;Keep UI responsive&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2) Prompting Patterns That Worked
&lt;/h2&gt;

&lt;h3&gt;
  
  
  A) “Diagnose then propose”
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Explain the cause of input lag, then propose a fix with minimal changes.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Outcome:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AI focused on render priorities and avoided rewriting the component blindly.&lt;/p&gt;




&lt;h3&gt;
  
  
  B) “Refactor without changing behavior”
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Replace editor implementation but preserve mention/hashtag/emoji output format.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Outcome:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AI matched existing serialization rules (&lt;code&gt;@user&lt;/code&gt;, &lt;code&gt;#tag&lt;/code&gt;, &lt;code&gt;:emoji:&lt;/code&gt;) and kept backend compatibility.&lt;/p&gt;




&lt;h3&gt;
  
  
  C) “Complex interaction in one shot”
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Prompt:&lt;/strong&gt;  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Add a toolbar with a popover containing: code block, bold, italic. Each tool highlights based on cursor position.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Outcome:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
AI generated a consistent UI state model and wiring via &lt;code&gt;editor.isActive(...)&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  3) AI + Rich Text Editor (Key Highlight)
&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.amazonaws.com%2Fuploads%2Farticles%2F7jw91pzqecu9jlqntncf.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%2F7jw91pzqecu9jlqntncf.png" alt="Rich Text Editor" width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The editor is the most complex UI surface. AI helped:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Move to &lt;strong&gt;Tiptap&lt;/strong&gt; with custom NodeViews&lt;/li&gt;
&lt;li&gt;Keep &lt;strong&gt;mention/hashtag/emoji&lt;/strong&gt; as atomic nodes&lt;/li&gt;
&lt;li&gt;Export plain text while rendering rich UI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Why it matters:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
The editor must feel native while still producing Mastodon‑compatible plain text.&lt;/p&gt;




&lt;h2&gt;
  
  
  4) AI + React Query (Key Highlight)
&lt;/h2&gt;

&lt;p&gt;React Query powers async data flows (search, timelines, discovery):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Query‑based caching keeps UI fast&lt;/li&gt;
&lt;li&gt;Stale‑while‑revalidate pattern fits social feeds&lt;/li&gt;
&lt;li&gt;Easy invalidation on user actions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;AI benefit:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Fast scaffolding of hooks and query keys with consistent conventions.&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%2Fyhta89cr4xsss6eykaj0.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%2Fyhta89cr4xsss6eykaj0.png" alt="Directory Structure" width="542" height="702"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  5) Lessons Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Be explicit with constraints&lt;/strong&gt;: “Don’t change serialization output” prevents regressions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Split prompts&lt;/strong&gt;: diagnosis first, refactor later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Focus on state boundaries&lt;/strong&gt;: editing vs. persistence, display vs. submission.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6) Takeaway
&lt;/h2&gt;

&lt;p&gt;AI Coding becomes effective when it’s asked to solve &lt;strong&gt;specific engineering problems&lt;/strong&gt;, not just generate code.&lt;br&gt;&lt;br&gt;
In this project, AI was most valuable for:&lt;/p&gt;

&lt;p&gt;✅ Structured refactors&lt;br&gt;&lt;br&gt;
✅ Complex interaction logic&lt;br&gt;&lt;br&gt;
✅ Maintaining behavior while changing architecture&lt;/p&gt;




</description>
      <category>ai</category>
      <category>vibecoding</category>
      <category>nextjs</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
