<?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: D Jaya Vardhan Reddy</title>
    <description>The latest articles on DEV Community by D Jaya Vardhan Reddy (@djayavardhanreddy).</description>
    <link>https://dev.to/djayavardhanreddy</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%2F985021%2Fd0e86197-7728-4349-9b4e-004c586ba78f.png</url>
      <title>DEV Community: D Jaya Vardhan Reddy</title>
      <link>https://dev.to/djayavardhanreddy</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/djayavardhanreddy"/>
    <language>en</language>
    <item>
      <title>How I Use AI to Write Platform-Specific Code (Without Getting Generic Output)</title>
      <dc:creator>D Jaya Vardhan Reddy</dc:creator>
      <pubDate>Thu, 11 Jun 2026 07:07:03 +0000</pubDate>
      <link>https://dev.to/djayavardhanreddy/how-i-use-ai-to-write-platform-specific-code-without-getting-generic-output-1921</link>
      <guid>https://dev.to/djayavardhanreddy/how-i-use-ai-to-write-platform-specific-code-without-getting-generic-output-1921</guid>
      <description>&lt;p&gt;If you've used AI to write code for more than a week, you've hit this wall:&lt;/p&gt;

&lt;p&gt;You ask for a component. It gives you something that &lt;em&gt;works&lt;/em&gt; — technically — but looks nothing like your actual codebase. Wrong naming conventions. Wrong library usage. Wrong patterns. You spend 20 minutes rewriting the thing you asked it to write.&lt;/p&gt;

&lt;p&gt;The output isn't bad. It's just &lt;strong&gt;generic&lt;/strong&gt;. And generic doesn't ship.&lt;/p&gt;

&lt;p&gt;Here's how I stopped getting boilerplate and started getting code I can actually use.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Root Cause: AI Doesn't Know Your Stack
&lt;/h2&gt;

&lt;p&gt;When you ask an AI to "create a data table component," it has no idea:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What UI library you're using (or its version)&lt;/li&gt;
&lt;li&gt;How you structure your types and interfaces&lt;/li&gt;
&lt;li&gt;What naming conventions your team follows&lt;/li&gt;
&lt;li&gt;What patterns already exist in your codebase&lt;/li&gt;
&lt;li&gt;What &lt;em&gt;not&lt;/em&gt; to do (the footguns you've already learned)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So it reaches for the most statistically common answer. That's why you get generic &lt;code&gt;useState&lt;/code&gt; hooks, default &lt;code&gt;any&lt;/code&gt; types, and &lt;code&gt;className="container"&lt;/code&gt; everywhere.&lt;/p&gt;

&lt;p&gt;The fix isn't a better AI. It's better context.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Context Stack That Actually Works
&lt;/h2&gt;

&lt;p&gt;I work on &lt;strong&gt;Optix&lt;/strong&gt;, a cloud asset management and cost intelligence platform. We deal with things like utilization tables, multi-account cloud inventory, and real-time cost dashboards — none of which an AI has seen before. Getting useful output required being intentional about what I feed in.&lt;/p&gt;

&lt;p&gt;Here's the stack of context I now always include:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Your Types and Interfaces First
&lt;/h3&gt;

&lt;p&gt;Before anything else, paste in the relevant types.&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;// Bad prompt:&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Create a table component for reservation data&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;

&lt;span class="c1"&gt;// Good prompt:&lt;/span&gt;
&lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ReservationItem&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;EC2&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;RDS&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ElastiCache&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;utilizationPct&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="nl"&gt;coveragePct&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="nl"&gt;monthlySavings&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="nl"&gt;expiryDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Create a table component for ReservationItem[]&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The moment you give it real types, the output transforms. Column names match your fields. The logic handles your actual data shape. You stop getting &lt;code&gt;item.name&lt;/code&gt; when your field is &lt;code&gt;item.service&lt;/code&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  2. Specify Library + Version
&lt;/h3&gt;

&lt;p&gt;This is the one people skip and then wonder why the code doesn't work.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Instead of:
"using styled-components"

// Say:
"using styled-components v6 — note that .attrs() syntax changed, don't use the old form"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or for a table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"using TanStack Table v8 (not v7) — use useReactTable, not useTable"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Version context collapses the output to the right API surface. Without it, you'll get a mix of v7 and v8 patterns stitched together — which compiles and immediately breaks at runtime.&lt;/p&gt;




&lt;h3&gt;
  
  
  3. Show an Existing Pattern
&lt;/h3&gt;

&lt;p&gt;This is the highest-leverage thing you can do. Paste one example of something that already works in your codebase and say "follow this pattern."&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Here's how we currently build column definitions in Optix.&lt;/span&gt;
&lt;span class="c1"&gt;// Follow this exact pattern for the new component:&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getColWidth&lt;/span&gt; &lt;span class="o"&gt;=&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="nx"&gt;ColKey&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;ColWidth&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;COL_WIDTHS&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="na"&gt;minWidth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;COL_WIDTHS&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="na"&gt;maxWidth&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;COL_WIDTHS&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="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the AI isn't guessing your conventions. It's extending them. The output slots in like it was written by a teammate.&lt;/p&gt;




&lt;h3&gt;
  
  
  4. Tell It What NOT to Do
&lt;/h3&gt;

&lt;p&gt;Negative constraints are underrated. Explicitly excluding bad patterns saves a round of corrections.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Don't use index as key. Don't use `any`. Don't add inline styles.
Don't use gap for column spacing — we had alignment bugs with that, use the width strategy above.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The last one is real. We had a &lt;code&gt;Table&lt;/code&gt; component where column headers and body rows were misaligned because of mixed flex sizing strategies. Once I added "don't use gap for column spacing" to my prompts, the AI stopped suggesting the broken pattern.&lt;/p&gt;




&lt;h3&gt;
  
  
  5. Name Your Domain Terms
&lt;/h3&gt;

&lt;p&gt;AI hallucinates less when you establish the vocabulary upfront.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;In our codebase:
- "MTD" = month-to-date spend
- "EOM forecast" = projected end-of-month cost
- "commitment" = Reserved Instances or Savings Plans
- "coverage" = % of on-demand usage covered by commitments
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you ask it to "add an EOM forecast tooltip to the commitment panel," it doesn't invent a definition. It uses yours.&lt;/p&gt;




&lt;h2&gt;
  
  
  Putting It All Together: A Real Prompt
&lt;/h2&gt;

&lt;p&gt;Here's an actual prompt structure I use for Optix components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Context:
- Stack: React 18, TypeScript, styled-components v6, TanStack Table v8
- Platform: Optix (cloud cost intelligence dashboard)
- Domain: RI = Reserved Instances, SP = Savings Plans, coverage = % on-demand covered

Types:
[paste relevant interfaces]

Existing pattern to follow:
[paste one working component or utility]

Constraints:
- No `any` types
- No inline styles
- Use getColWidth() for all column sizing (not gap/flex tricks)
- Follow existing RowContainer pattern for row layout

Task:
Build a [component name] that [specific requirement].
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It takes 3 extra minutes to write. It saves 30 minutes of rewriting.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Mental Model
&lt;/h2&gt;

&lt;p&gt;Think of it like onboarding a new engineer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You wouldn't hand a new hire a Jira ticket and say "build this." You'd give them a codebase tour, show them an existing component, explain the conventions, and tell them where the bodies are buried.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;AI needs the same onboarding. It's fast and capable — but it has zero context about your project unless you give it some.&lt;/p&gt;

&lt;p&gt;The more specific your context, the less generic the output.&lt;/p&gt;




&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Without context&lt;/th&gt;
&lt;th&gt;With context&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Generic types (&lt;code&gt;any&lt;/code&gt;, &lt;code&gt;object&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Your exact interfaces&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wrong library version&lt;/td&gt;
&lt;td&gt;Correct API surface&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Foreign patterns&lt;/td&gt;
&lt;td&gt;Your team's conventions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plausible-looking bugs&lt;/td&gt;
&lt;td&gt;Code that slots in&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Paste your types&lt;/strong&gt; before describing the task&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pin the library version&lt;/strong&gt; and any breaking API changes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Show one existing pattern&lt;/strong&gt; and say "follow this"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add negative constraints&lt;/strong&gt; for known footguns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Define your domain terms&lt;/strong&gt; upfront&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. No magic prompting frameworks. Just context.&lt;br&gt;
&lt;em&gt;Tags: &lt;code&gt;webdev&lt;/code&gt; &lt;code&gt;react&lt;/code&gt; &lt;code&gt;typescript&lt;/code&gt; &lt;code&gt;ai&lt;/code&gt; &lt;code&gt;productivity&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
