<?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: yunbow</title>
    <description>The latest articles on Forem by yunbow (@yunbow).</description>
    <link>https://forem.com/yunbow</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%2F3909809%2F85412494-b63e-47d7-a160-a99184f2c7b4.png</url>
      <title>Forem: yunbow</title>
      <link>https://forem.com/yunbow</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/yunbow"/>
    <language>en</language>
    <item>
      <title>Why AI Doesn't Code What You Designed: The Structural Gap Between Specs and Implementation</title>
      <dc:creator>yunbow</dc:creator>
      <pubDate>Tue, 05 May 2026 06:29:37 +0000</pubDate>
      <link>https://forem.com/yunbow/why-ai-doesnt-code-what-you-designed-the-structural-gap-between-specs-and-implementation-5fb8</link>
      <guid>https://forem.com/yunbow/why-ai-doesnt-code-what-you-designed-the-structural-gap-between-specs-and-implementation-5fb8</guid>
      <description>&lt;p&gt;You write a detailed design doc. You paste it into your AI assistant. You wait.&lt;/p&gt;

&lt;p&gt;The output compiles. Tests pass. And yet — it's not quite what you designed. The auth middleware is in the wrong layer. The error handling pattern differs from the rest of the codebase. The field names don't match the schema.&lt;/p&gt;

&lt;p&gt;You fix it. Next task, same thing.&lt;/p&gt;

&lt;p&gt;This happens constantly, and it's not a model capability problem. &lt;strong&gt;It's a structural problem in how we communicate design intent to AI.&lt;/strong&gt; And "write better prompts" is not the solution — it's a band-aid.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why "Better Prompts" Doesn't Scale
&lt;/h2&gt;

&lt;p&gt;The instinct when AI misses the mark: add more detail to the prompt. Describe the pattern more explicitly. Give an example.&lt;/p&gt;

&lt;p&gt;This works — sometimes, for that one task.&lt;/p&gt;

&lt;p&gt;The problem: design intent isn't a single instruction. It's institutional knowledge accumulated over months. It's the reason two experienced engineers on your team write recognizably similar code without coordinating on every PR. It's the unspoken answer to "what does good look like here?"&lt;/p&gt;

&lt;p&gt;You can't fit that into a prompt. And even if you could, you'd need to paste it every single time.&lt;/p&gt;

&lt;p&gt;Think about onboarding a new engineer. You don't brief them on your entire codebase in the first conversation. You give them documentation, you pair with them, you let them absorb context over weeks. The conventions transfer gradually because there's a persistent learning mechanism.&lt;/p&gt;

&lt;p&gt;With AI, there's no persistent learning mechanism by default. Every conversation starts from scratch. Your prompt is one-time context. Your design intent is institutional knowledge that needs to live somewhere the AI can always access.&lt;/p&gt;




&lt;h2&gt;
  
  
  Three Structural Gaps
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Gap 1: Implicit Conventions Stay Implicit
&lt;/h3&gt;

&lt;p&gt;Every team has them. Rules that are enforced in code review but never written down because "everyone knows that."&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"We use &lt;code&gt;ActionResult&amp;lt;T&amp;gt;&lt;/code&gt; for Server Actions"&lt;/li&gt;
&lt;li&gt;"Zod schemas live in &lt;code&gt;lib/schemas/&lt;/code&gt;, not colocated with components"&lt;/li&gt;
&lt;li&gt;"Don't use &lt;code&gt;useEffect&lt;/code&gt; for data fetching — we have Server Components for that"&lt;/li&gt;
&lt;li&gt;"Always call &lt;code&gt;auth()&lt;/code&gt; before any database access in an API route"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These live in your engineers' heads. When a new hire submits a PR that violates them, a reviewer catches it and leaves a comment. The new hire learns. The knowledge transfers.&lt;/p&gt;

&lt;p&gt;AI doesn't get those review comments. It generates code, the review happens, but the AI's context doesn't update. Next task, same violation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The cost:&lt;/strong&gt; every AI output needs a manual convention-correction pass. The faster AI can generate code, the more convention-correction work piles up.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gap 2: Specs Describe WHAT, Not HOW or WHY
&lt;/h3&gt;

&lt;p&gt;Your design doc says "implement user authentication with session management." Good.&lt;/p&gt;

&lt;p&gt;What it doesn't say:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Auth middleware belongs in the route handler, not a global Next.js middleware&lt;/li&gt;
&lt;li&gt;Sessions are stored in the database, not JWT (because you had a security incident)&lt;/li&gt;
&lt;li&gt;Use NextAuth's &lt;code&gt;auth()&lt;/code&gt; helper, not direct session inspection&lt;/li&gt;
&lt;li&gt;All session-dependent routes return 401, not redirect to login&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These "how" and "why" constraints are the engineering culture. They're the decisions your team made, the tradeoffs you've accepted, the patterns you've settled on. A spec that describes the what gives AI enough rope to generate something plausible that violates all of the above.&lt;/p&gt;

&lt;p&gt;An AI-effective spec would include the constraints that shape implementation, not just the behavior.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gap 3: No Feedback Loop for Rule Violations
&lt;/h3&gt;

&lt;p&gt;Human code review creates a feedback loop. Author submits code → reviewer catches violations → author adjusts → over time, author internalizes the rules.&lt;/p&gt;

&lt;p&gt;AI-generated code breaks this loop in two ways.&lt;/p&gt;

&lt;p&gt;First, the feedback doesn't persist. You can tell Claude "in this project, Server Actions always return &lt;code&gt;ActionResult&amp;lt;T&amp;gt;&lt;/code&gt;" in one conversation. Next conversation, you tell it again.&lt;/p&gt;

&lt;p&gt;Second, the volume overwhelms the feedback loop. One engineer might submit 3 PRs a week. With AI assistance, they might submit 20. Reviewers who were previously keeping up now face a backlog. Review quality degrades under volume. Violations start slipping through.&lt;/p&gt;

&lt;p&gt;At scale, violations accumulate faster than review can catch them. Plausible-but-wrong patterns spread across the codebase. Six months later, you have a refactoring problem that looks like technical debt but is actually accumulated convention drift.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Compounding Effect
&lt;/h2&gt;

&lt;p&gt;A single convention violation in one file: minor, easy to fix.&lt;/p&gt;

&lt;p&gt;10 AI-generated files with the same violation: a pattern.&lt;/p&gt;

&lt;p&gt;50 AI-generated files with diverse convention violations: an architectural consistency problem. Different error handling here, different auth patterns there, schemas mixed into component files, raw Prisma objects returned from APIs.&lt;/p&gt;

&lt;p&gt;This is the state many teams are in now — not because AI is bad, but because they're using AI without the infrastructure to give it their institutional knowledge.&lt;/p&gt;

&lt;p&gt;From retrospectives I've reviewed and conversations with teams adopting AI tools: teams without explicit guidelines consistently report spending significantly more time — often 2–4× — on "cleanup" and "consistency work" than teams with structured rule systems. A common pattern: the team celebrates 3× faster feature generation, then quietly absorbs the same hours back in review cycles, convention-fixing passes, and cross-file inconsistency cleanup. The productivity gains from AI generation are real; they're being partially eaten by convention-drift cleanup.&lt;/p&gt;




&lt;h2&gt;
  
  
  What "Design Intent" Actually Means
&lt;/h2&gt;

&lt;p&gt;When I say "design intent," I mean more than the features described in a spec. I mean:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Naming conventions and why they exist.&lt;/strong&gt; Not just "use camelCase" but "function names that fetch data start with &lt;code&gt;get&lt;/code&gt;, mutations start with &lt;code&gt;update&lt;/code&gt; or &lt;code&gt;create&lt;/code&gt;, and no function is named &lt;code&gt;handle&lt;/code&gt; because it tells you nothing."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which patterns are preferred and which are deprecated.&lt;/strong&gt; "We use Server Components for data fetching. &lt;code&gt;useEffect&lt;/code&gt; for data fetching was how we did it two years ago and there's still some in the codebase — don't follow it."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Security invariants.&lt;/strong&gt; "Every external-facing API route must validate the session. This is not a preference, it's a requirement. There are no exceptions."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The tradeoffs you've accepted.&lt;/strong&gt; "We verbose-type everything even when TypeScript could infer it. We know this is more code. We've decided explicit types are worth it for this team."&lt;/p&gt;

&lt;p&gt;These don't belong in a design doc — they're too foundational, too stable. They belong in a persistent context that every AI interaction can access.&lt;/p&gt;




&lt;h2&gt;
  
  
  Rethinking What a Spec Is For
&lt;/h2&gt;

&lt;p&gt;A traditional specification document is written for humans. It describes desired behavior, UI flows, data models, and edge cases. The reader is assumed to already know your team's conventions.&lt;/p&gt;

&lt;p&gt;An AI-effective specification is different. It still describes behavior. But it also includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;constraints&lt;/strong&gt; that shape implementation ("use NextAuth, not custom JWT")&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;non-options&lt;/strong&gt; ("do not introduce a new state management library")&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;patterns&lt;/strong&gt; that must be followed ("Server Actions must follow the &lt;code&gt;ActionResult&amp;lt;T&amp;gt;&lt;/code&gt; pattern")&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;why&lt;/strong&gt; behind significant decisions ("we use Prisma's typed client because we've been burned by SQL injection in the past")&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider the difference between these two spec sections:&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;Implement an API endpoint that allows authenticated users to update their profile information.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;AI-effective:&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Implement an API route at &lt;code&gt;app/api/profile/route.ts&lt;/code&gt; that allows authenticated users to update their profile.&lt;/p&gt;

&lt;p&gt;Implementation constraints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;auth()&lt;/code&gt; from &lt;code&gt;@/lib/auth&lt;/code&gt; to verify the session&lt;/li&gt;
&lt;li&gt;Accept only &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;image&lt;/code&gt; fields — no other fields should be updatable via this endpoint&lt;/li&gt;
&lt;li&gt;Validate input with a Zod schema before any database operation&lt;/li&gt;
&lt;li&gt;Return &lt;code&gt;{ data: user }&lt;/code&gt; on success with only safe fields selected (no &lt;code&gt;passwordHash&lt;/code&gt;, &lt;code&gt;emailVerified&lt;/code&gt;, or internal IDs)&lt;/li&gt;
&lt;li&gt;Return &lt;code&gt;{ error: "..." }&lt;/code&gt; with appropriate HTTP status on failure&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;The second version leaves less room for AI to infer its own patterns. It specifies the how alongside the what.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution Direction: Externalizing Tacit Knowledge
&lt;/h2&gt;

&lt;p&gt;The fix isn't writing better prompts. It's building an infrastructure that makes your team's tacit knowledge persistent and accessible.&lt;/p&gt;

&lt;p&gt;The practical shape of this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. A persistent context file (&lt;code&gt;CLAUDE.md&lt;/code&gt; or equivalent)&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Keep it to 3 directive lines — a project header, "follow these guidelines," and "upper sections take priority." The rest is a list of file references pointing to your actual rule files. This loads on every interaction, but because it's just an index, it doesn't dilute Claude's attention on your task.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Guideline files for L3 specifics&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Naming conventions, security invariants, error handling patterns — these live in dedicated files (&lt;code&gt;docs/ai-dev-os/03_guidelines/common/security.md&lt;/code&gt;, etc.) and are loaded contextually when relevant. A rule submodule like &lt;code&gt;ai-dev-os-rules-typescript&lt;/code&gt; provides these for TypeScript/Next.js projects out of the box.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. AI-effective specs for larger tasks&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
For non-trivial features, include implementation constraints in the spec alongside behavioral requirements — which auth helper to use, which patterns to follow, which approaches to avoid. Write the spec like you're briefing a developer who knows nothing about your codebase's conventions.&lt;/p&gt;

&lt;p&gt;This is a systems-design problem, not a prompting problem. You design the system once. The AI operates within it on every task.&lt;/p&gt;

&lt;p&gt;The next article in this series walks through building this infrastructure for a Next.js project — step by step, with before/after code.&lt;/p&gt;




&lt;p&gt;The structural gap between specs and implementation isn't inherent to AI. It's a gap we created by giving AI our "what" without our "how."&lt;/p&gt;

&lt;p&gt;Closing it requires treating your team's conventions as infrastructure, not tribal knowledge.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What's the most persistent spec-drift you've hit with AI coding tools? Drop it in the comments — I'm cataloging these to improve guideline templates.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Next in this series: Codifying Tacit Knowledge: The Missing Layer Between Your Team's Conventions and Your AI Assistant (link will be added on publish)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Under 30-Minute Setup: AI Coding Guidelines for Your Next.js Project (Before/After Code)</title>
      <dc:creator>yunbow</dc:creator>
      <pubDate>Tue, 05 May 2026 01:49:14 +0000</pubDate>
      <link>https://forem.com/yunbow/under-30-minute-setup-ai-coding-guidelines-for-your-nextjs-project-beforeafter-code-fnp</link>
      <guid>https://forem.com/yunbow/under-30-minute-setup-ai-coding-guidelines-for-your-nextjs-project-beforeafter-code-fnp</guid>
      <description>&lt;p&gt;Your Next.js project has an AI assistant. The question isn't whether to use AI — it's whether the code it generates follows your project's conventions.&lt;/p&gt;

&lt;p&gt;This is a hands-on walkthrough. In under 30 minutes (10 via CLI, 20 manually), you'll install &lt;a href="https://github.com/yunbow/ai-dev-os" rel="noopener noreferrer"&gt;AI Dev OS&lt;/a&gt; into an existing Next.js project using Claude Code. By the end, your AI will consistently apply your naming conventions, security patterns, and architectural rules — without you reminding it every prompt.&lt;/p&gt;

&lt;p&gt;All examples show before/after code so you can see exactly what changes.&lt;/p&gt;




&lt;h2&gt;
  
  
  What You're Installing (5 min)
&lt;/h2&gt;

&lt;p&gt;AI Dev OS uses a 4-layer model. For a Next.js project, here's what goes where:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CLAUDE.md                     ← L1 + L2: Always loaded, project philosophy
.claude/guidelines/
  nextjs.md                   ← L3: App Router, Server Actions, Middleware
  typescript.md               ← L3: Type conventions, naming rules
  security.md                 ← L3: Auth patterns, input validation
.claude/commands/             ← L4: Reusable Skills for common tasks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rules you care about most day-to-day live in &lt;code&gt;guidelines/&lt;/code&gt;. They're loaded when relevant — not every single prompt — so they don't dilute Claude's attention on your actual task.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Node.js &amp;gt;= 18
Next.js &amp;gt;= 14 (App Router)
Claude Code CLI installed
TypeScript (strict mode strongly recommended)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Already have a running Next.js project? Good — work from there. Starting fresh also works.&lt;/p&gt;




&lt;h2&gt;
  
  
  Option A: CLI Setup (10 min)
&lt;/h2&gt;

&lt;p&gt;The fastest path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ai-dev-os init &lt;span class="nt"&gt;--rules&lt;/span&gt; typescript &lt;span class="nt"&gt;--plugin&lt;/span&gt; claude-code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE.md&lt;/code&gt; — guidelines index (3 directive lines + file references)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docs/ai-dev-os/&lt;/code&gt; — rule submodule with L1–L3 guidelines for TypeScript/Next.js&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.claude/plugins/ai-dev-os/&lt;/code&gt; — Skills, Agents, and Hooks (L4)&lt;/li&gt;
&lt;li&gt;Pre-commit hooks for automated rule verification&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After it runs, open &lt;code&gt;CLAUDE.md&lt;/code&gt; and add your project-specific guideline files to the &lt;code&gt;## Project-Specific Guidelines&lt;/code&gt; section (3 files is the recommended starting point).&lt;/p&gt;

&lt;p&gt;Verify the setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ai-dev-os doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output should show all guideline files detected and no configuration conflicts.&lt;/p&gt;




&lt;h2&gt;
  
  
  Option B: Manual Setup (20 min)
&lt;/h2&gt;

&lt;p&gt;Manual setup takes longer but gives you a clear mental model of what each file does. Recommended if you want to adapt the rules heavily.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Add the rule submodule and copy the CLAUDE.md template
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Add L1–L3 rules for TypeScript/Next.js&lt;/span&gt;
git submodule add https://github.com/yunbow/ai-dev-os-rules-typescript.git docs/ai-dev-os
git submodule update &lt;span class="nt"&gt;--init&lt;/span&gt;

&lt;span class="c"&gt;# Add Claude Code plugin (Skills, Agents, Hooks)&lt;/span&gt;
git submodule add https://github.com/yunbow/ai-dev-os-plugin-claude-code.git .claude/plugins/ai-dev-os

&lt;span class="c"&gt;# Copy the CLAUDE.md template&lt;/span&gt;
&lt;span class="nb"&gt;cp &lt;/span&gt;docs/ai-dev-os/templates/nextjs/CLAUDE.md.template ./CLAUDE.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; is an index file — 3 directive lines followed by references to guideline files in the submodule. Open it and fill in your project name, then add project-specific guideline files in the &lt;code&gt;## Project-Specific Guidelines&lt;/code&gt; section:&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;## Project-Specific Guidelines&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-business-rule.md
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-external-api.md
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-compliance.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3 files is the recommended starting point. Create these files in &lt;code&gt;docs/guidelines/&lt;/code&gt; and document the rules specific to your project (auth provider choices, external service integrations, business constraints).&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Understand what the submodule provides
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;docs/ai-dev-os/&lt;/code&gt; submodule already contains comprehensive L3 guidelines. Key files for a Next.js project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docs/ai-dev-os/03_guidelines/
  frameworks/nextjs/
    overview.md         ← App Router conventions, tech stack overview
    api.md              ← API route patterns (auth check, field selection)
    server-actions.md   ← ActionResult&amp;lt;T&amp;gt; pattern, Zod validation
    auth.md             ← NextAuth integration
    database.md         ← Prisma usage, no raw SQL
  common/
    security.md         ← Auth invariants, data exposure prevention
    validation.md       ← Zod schema placement and usage
    error-handling.md   ← Error patterns
    naming.md           ← Naming conventions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These files contain the concrete rules with examples — including the patterns shown in the Before/After section below. You don't write these; they come with the submodule.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Create the ActionResult type
&lt;/h3&gt;

&lt;p&gt;If you don't have it already:&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;// types/action.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;ActionResult&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="nl"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;T&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="nl"&gt;error&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This conditional type handles the common &lt;code&gt;void&lt;/code&gt; case — Server Actions that return no data can use &lt;code&gt;return { success: true }&lt;/code&gt; without a &lt;code&gt;data&lt;/code&gt; field, while actions that return data get a fully typed &lt;code&gt;{ success: true; data: T }&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Verification: Test Before/After
&lt;/h2&gt;

&lt;p&gt;The best way to confirm your setup is working: ask Claude the same task twice — before applying guidelines, after.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Test prompt:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create an API route at app/api/profile/route.ts that returns 
the current user's profile data from the database.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; (no guidelines, typical output):&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/prisma&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Request&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="nx"&gt;userId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;request&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&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;x-user-id&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;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;prisma&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;findUnique&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt; &lt;span class="p"&gt;}&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;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Problems: takes user ID from a header (trivially spoofable), returns the entire user object including password hash and tokens, no error handling if user not found. Also note the import uses &lt;code&gt;prisma&lt;/code&gt; from &lt;code&gt;@/lib/prisma&lt;/code&gt; — in the conventions we're setting up, the db client is exposed as &lt;code&gt;db&lt;/code&gt; from &lt;code&gt;@/lib/db&lt;/code&gt; for consistency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt; (with guidelines loaded):&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="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/auth&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/db&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Response&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;session&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;auth&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;session&lt;/span&gt;&lt;span class="p"&gt;)&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;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Unauthorized&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="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;401&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="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&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;findUnique&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&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;id&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;id&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="na"&gt;name&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="na"&gt;email&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="na"&gt;image&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="na"&gt;createdAt&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="p"&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;user&lt;/span&gt;&lt;span class="p"&gt;)&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;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Not found&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="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;404&lt;/span&gt; &lt;span class="p"&gt;})&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;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;data&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Auth from session (not headers). Explicit field selection. Error cases handled. Consistent response shape.&lt;/p&gt;




&lt;h2&gt;
  
  
  Before / After: Server Action
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Test prompt:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Create a Server Action to update the current user's display name.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt;:&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;prisma&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/prisma&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateDisplayName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&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="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;prisma&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;update&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user_id_here&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&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;Problems: hardcoded placeholder ID, no validation, no auth, no return value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;:&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;zod&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ActionResult&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/types/action&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/auth&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/db&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;UpdateNameSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Name is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Name too long&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;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateDisplayName&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormData&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ActionResult&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;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;session&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;auth&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;session&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Unauthorized&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;parsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;UpdateNameSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safeParse&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;formData&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;name&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;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;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&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;update&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&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;id&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Loading Guidelines in Practice
&lt;/h2&gt;

&lt;p&gt;The Skills bundled with &lt;code&gt;ai-dev-os-plugin-claude-code&lt;/code&gt; handle contextual loading automatically. For example, the &lt;code&gt;/api&lt;/code&gt; skill loads the relevant framework and security guidelines before generating code.&lt;/p&gt;

&lt;p&gt;You can also reference guidelines directly in your prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@docs/ai-dev-os/03_guidelines/frameworks/nextjs/server-actions.md
Create a Server Action to update the current user's display name.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or add a project-specific skill in &lt;code&gt;.claude/commands/api.md&lt;/code&gt; that loads your project-specific rules alongside the framework guidelines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Load the API and security guidelines, then complete the task:

@docs/ai-dev-os/03_guidelines/frameworks/nextjs/api.md
@docs/ai-dev-os/03_guidelines/common/security.md
@docs/guidelines/your-business-rule.md

Task: $ARGUMENTS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now in Claude Code: &lt;code&gt;/api Create a route for updating user preferences&lt;/code&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Add your project-specific rules.&lt;/strong&gt; The submodule provides the framework-level rules. Create &lt;code&gt;docs/guidelines/&lt;/code&gt; files for your project's business logic, external API integrations, and compliance requirements — these go in the &lt;code&gt;## Project-Specific Guidelines&lt;/code&gt; section of &lt;code&gt;CLAUDE.md&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Commit the submodule reference to git.&lt;/strong&gt; Team members who clone the repo run &lt;code&gt;git submodule update --init --recursive&lt;/code&gt; and get the full guideline set automatically.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Keep the submodule updated.&lt;/strong&gt; Run &lt;code&gt;git submodule update --remote docs/ai-dev-os&lt;/code&gt; to pull the latest rules, or pin to a specific version with &lt;code&gt;git checkout v1.x.x&lt;/code&gt; inside the submodule.&lt;/p&gt;




&lt;p&gt;The full ruleset (with Python/FastAPI support) is at &lt;a href="https://github.com/yunbow/ai-dev-os" rel="noopener noreferrer"&gt;github.com/yunbow/ai-dev-os&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;What Next.js patterns does your team enforce that keep slipping through AI-generated code? I'm collecting edge cases to improve the default ruleset.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>typescript</category>
      <category>aitools</category>
      <category>aidevos</category>
    </item>
    <item>
      <title>200 Lines in CLAUDE.md Dropped My Code Quality to 79% — Splitting into 3 Files Got It to 96.9%</title>
      <dc:creator>yunbow</dc:creator>
      <pubDate>Mon, 04 May 2026 00:29:54 +0000</pubDate>
      <link>https://forem.com/yunbow/200-lines-in-claudemd-dropped-my-code-quality-to-79-splitting-into-3-files-got-it-to-969-1glm</link>
      <guid>https://forem.com/yunbow/200-lines-in-claudemd-dropped-my-code-quality-to-79-splitting-into-3-files-got-it-to-969-1glm</guid>
      <description>&lt;p&gt;More rules should mean better output. That's the intuition.&lt;/p&gt;

&lt;p&gt;I spent weeks building a comprehensive &lt;code&gt;CLAUDE.md&lt;/code&gt; — 200 lines covering naming conventions, security rules, error handling, architectural patterns, import ordering, type safety requirements, and more. I was proud of it. I'd thought through every scenario.&lt;/p&gt;

&lt;p&gt;Then I scored the output.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;79.0 / 100.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My carefully crafted documentation was actively making AI performance worse. Here's the experiment, what I found, and how restructuring it to 4 files (the original &lt;code&gt;CLAUDE.md&lt;/code&gt; trimmed to ~35 lines, plus 3 topic-specific guideline files) pushed the score to &lt;strong&gt;96.9&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Experiment
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Project:&lt;/strong&gt; Next.js 14 + TypeScript + Prisma + NextAuth&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I measured:&lt;/strong&gt; Code quality across 5 dimensions, scored by a structured rubric applied to 20 generated files (mix of API routes, Server Actions, components, utility functions). I applied the rubric manually — each file scored 0–100 per dimension, then averaged across all files. All generation tasks used the same prompts to isolate the config variable:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;What was scored&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Naming&lt;/td&gt;
&lt;td&gt;Variable names, function names, file naming — match project conventions?&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Auth checks present, input validation, no sensitive data exposure&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Error handling&lt;/td&gt;
&lt;td&gt;Consistent pattern, proper types, no silent failures&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Type safety&lt;/td&gt;
&lt;td&gt;No &lt;code&gt;any&lt;/code&gt;, proper inference, Zod schemas where needed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test coverage&lt;/td&gt;
&lt;td&gt;Unit tests generated alongside implementation files&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Baseline:&lt;/strong&gt; 200-line monolithic &lt;code&gt;CLAUDE.md&lt;/code&gt; containing all rules&lt;/p&gt;




&lt;h2&gt;
  
  
  Why More Rules Made Things Worse
&lt;/h2&gt;

&lt;p&gt;I expected a positive correlation: more rules → better adherence. I got the opposite. Here's why.&lt;/p&gt;

&lt;h3&gt;
  
  
  Position sensitivity
&lt;/h3&gt;

&lt;p&gt;Claude reads the entire &lt;code&gt;CLAUDE.md&lt;/code&gt; on every interaction. A 200-line file isn't huge in absolute terms, but attention is not uniformly distributed across a long document. Rules near the end — in my case, security invariants starting at line 160 — received demonstrably less weight than rules at the top.&lt;/p&gt;

&lt;p&gt;In my tests, moving the security section from line 160 to line 20 pushed security scores from 68% to 81% — without changing a single rule. The content was identical. Position was the only variable.&lt;/p&gt;

&lt;p&gt;Why: the user's prompt arrives at the end of the context window. Rules at the bottom of &lt;code&gt;CLAUDE.md&lt;/code&gt; are immediately adjacent to the prompt and compete with everything above them for the model's attention during generation. The further up a rule is, the less it competes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rule conflicts
&lt;/h3&gt;

&lt;p&gt;When L1 philosophy rules and L3 specific rules live in the same file, conflicts appear. My L1 section said "prefer explicitness." My L3 section said "keep implementations concise." When generating a Server Action, the AI had to arbitrate between these — and sometimes picked the wrong tradeoff for the context.&lt;/p&gt;

&lt;h3&gt;
  
  
  The result by dimension
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;200-line CLAUDE.md&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Naming&lt;/td&gt;
&lt;td&gt;81%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;68%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Error handling&lt;/td&gt;
&lt;td&gt;77%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Type safety&lt;/td&gt;
&lt;td&gt;82%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test coverage&lt;/td&gt;
&lt;td&gt;86%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Overall&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;79.0%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Security being the lowest made sense in retrospect. Security rules are naturally verbose and were buried at the bottom.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Fix: Two-Tier Context
&lt;/h2&gt;

&lt;p&gt;The insight: &lt;code&gt;CLAUDE.md&lt;/code&gt; should contain only what the AI needs to know for &lt;strong&gt;every single interaction&lt;/strong&gt;. Everything else should be loaded on demand.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CLAUDE.md                         ← Always loaded (3 directive lines + file refs)
docs/ai-dev-os/03_guidelines/
  frameworks/nextjs/              ← Next.js App Router, Server Actions, etc.
  common/security.md              ← Auth patterns, input validation
  common/validation.md            ← Zod usage
  ...                             ← Referenced from CLAUDE.md
docs/guidelines/                  ← Your project-specific rules (3 files recommended)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The rule of thumb:&lt;/strong&gt; &lt;code&gt;CLAUDE.md&lt;/code&gt; is an index file, not a rules file. Keep it to 3 lines of directives and a list of file references. The actual rules live in the referenced files.&lt;/p&gt;

&lt;h3&gt;
  
  
  What CLAUDE.md looks like
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Project: [Your App Name] - Claude Code Guidelines&lt;/span&gt;

Please write code following the guidelines below for this project.
In case of conflicts, upper sections take priority.

&lt;span class="gu"&gt;## Development Guidelines&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; docs/ai-dev-os/03_guidelines/frameworks/nextjs/overview.md - Overview &amp;amp; tech stack
&lt;span class="p"&gt;-&lt;/span&gt; docs/ai-dev-os/03_guidelines/frameworks/nextjs/server-actions.md - Server Actions (ActionResult pattern)
&lt;span class="p"&gt;-&lt;/span&gt; docs/ai-dev-os/03_guidelines/common/security.md - Security
&lt;span class="p"&gt;-&lt;/span&gt; docs/ai-dev-os/03_guidelines/common/validation.md - Validation
&lt;span class="p"&gt;-&lt;/span&gt; docs/ai-dev-os/03_guidelines/common/error-handling.md - Error handling
...

&lt;span class="gu"&gt;## Project-Specific Guidelines&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-business-rule.md
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-external-api.md
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-compliance.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it — 3 directive lines, then file references. The philosophy, coding conventions, and security invariants are all in the referenced files in &lt;code&gt;docs/ai-dev-os/&lt;/code&gt;, which come from the rule submodule.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the topic files contain
&lt;/h3&gt;

&lt;p&gt;The submodule (&lt;code&gt;ai-dev-os-rules-typescript&lt;/code&gt;) provides:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docs/ai-dev-os/03_guidelines/common/security.md&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every auth pattern with examples&lt;/li&gt;
&lt;li&gt;Field selection rules for Prisma queries&lt;/li&gt;
&lt;li&gt;Input validation requirements&lt;/li&gt;
&lt;li&gt;Rate limiting requirements for auth endpoints&lt;/li&gt;
&lt;li&gt;Logging requirements for security events&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;docs/ai-dev-os/03_guidelines/frameworks/nextjs/server-actions.md&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Server Action patterns with full examples (&lt;code&gt;ActionResult&amp;lt;T&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Middleware structure&lt;/li&gt;
&lt;li&gt;Data fetching patterns (no &lt;code&gt;useEffect&lt;/code&gt; for data)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;docs/ai-dev-os/03_guidelines/common/naming.md&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Import ordering&lt;/li&gt;
&lt;li&gt;Type naming conventions&lt;/li&gt;
&lt;li&gt;Error type definitions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your project-specific rules go into &lt;code&gt;docs/guidelines/&lt;/code&gt; — 3 files is the recommended starting point.&lt;/p&gt;

&lt;h3&gt;
  
  
  Loading on demand
&lt;/h3&gt;

&lt;p&gt;In Claude Code, the Skills bundled with the plugin (&lt;code&gt;ai-dev-os-plugin-claude-code&lt;/code&gt;) handle contextual loading automatically. For manual invocation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Load the Next.js guidelines, then complete the task:

@docs/ai-dev-os/03_guidelines/frameworks/nextjs/overview.md
@docs/ai-dev-os/03_guidelines/common/security.md

Task: $ARGUMENTS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usage: &lt;code&gt;/nextjs Create an API route for updating user preferences&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For Cursor: the Cursor plugin (&lt;code&gt;.cursor/rules/&lt;/code&gt;) provides scoped &lt;code&gt;.mdc&lt;/code&gt; files with &lt;code&gt;globs&lt;/code&gt; patterns — no manual setup needed after running the CLI.&lt;/p&gt;

&lt;p&gt;For Kiro: the Kiro plugin copies steering rules to &lt;code&gt;.kiro/steering/&lt;/code&gt; with appropriate &lt;code&gt;include&lt;/code&gt; conditions — no manual configuration needed.&lt;/p&gt;




&lt;h2&gt;
  
  
  After the Split
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;200-line CLAUDE.md&lt;/th&gt;
&lt;th&gt;File-reference split&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Naming&lt;/td&gt;
&lt;td&gt;81%&lt;/td&gt;
&lt;td&gt;98%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;68%&lt;/td&gt;
&lt;td&gt;95%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Error handling&lt;/td&gt;
&lt;td&gt;77%&lt;/td&gt;
&lt;td&gt;97%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Type safety&lt;/td&gt;
&lt;td&gt;82%&lt;/td&gt;
&lt;td&gt;99%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Test coverage&lt;/td&gt;
&lt;td&gt;86%&lt;/td&gt;
&lt;td&gt;95%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Overall&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;79.0%&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;96.9%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Security improved the most: from 68% to 95%. Moving security rules to a dedicated file and explicitly loading them for auth/API work meant they were in context when they mattered and not diluting attention when they didn't.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Refactor Your Own CLAUDE.md
&lt;/h2&gt;

&lt;p&gt;If yours has grown to 100+ lines, here's the audit process I used:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Categorize every rule&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Go through your &lt;code&gt;CLAUDE.md&lt;/code&gt; line by line and tag each rule:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;[always]&lt;/code&gt; — needs to apply to every single generated line&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;[task:X]&lt;/code&gt; — only relevant when working on task type X&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;[rarely]&lt;/code&gt; — edge case that doesn't need to be in persistent context&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Move all rules to topic files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Rules in &lt;code&gt;[task:X]&lt;/code&gt; and &lt;code&gt;[rarely]&lt;/code&gt; move to dedicated files (&lt;code&gt;security.md&lt;/code&gt;, &lt;code&gt;testing.md&lt;/code&gt;, etc.) in &lt;code&gt;docs/guidelines/&lt;/code&gt; or a rule submodule. Replace the inline content in &lt;code&gt;CLAUDE.md&lt;/code&gt; with file references.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Reduce CLAUDE.md to 3 directive lines + references&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; should contain:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A project header&lt;/li&gt;
&lt;li&gt;"Please write code following the guidelines below."&lt;/li&gt;
&lt;li&gt;"In case of conflicts, upper sections take priority."&lt;/li&gt;
&lt;li&gt;A list of file references (not inline rules)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If &lt;code&gt;CLAUDE.md&lt;/code&gt; still has inline rules rather than file references, you haven't finished the refactor.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Set up loading mechanisms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Claude Code: The &lt;code&gt;ai-dev-os-plugin-claude-code&lt;/code&gt; plugin includes Skills and Agents that load the relevant guideline files contextually&lt;/li&gt;
&lt;li&gt;Cursor: The &lt;code&gt;ai-dev-os-plugin-cursor&lt;/code&gt; provides scoped &lt;code&gt;.mdc&lt;/code&gt; files with &lt;code&gt;globs&lt;/code&gt; patterns&lt;/li&gt;
&lt;li&gt;Kiro: The &lt;code&gt;ai-dev-os-plugin-kiro&lt;/code&gt; installs steering rules into &lt;code&gt;.kiro/steering/&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Score before and after&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Run the same 5–10 generation tasks with your old config and your new config. If you don't have a formal rubric, just note which rules are adhered to. You'll see the pattern.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Counter-Intuitive Takeaway
&lt;/h2&gt;

&lt;p&gt;The impulse to "add more to your CLAUDE.md" when you notice rule violations is natural — and usually wrong.&lt;/p&gt;

&lt;p&gt;If the AI isn't following a rule, the first question isn't "should I add more detail?" It's "is this rule in the right place?" If it's a convention only relevant to one type of task, moving it to a topic file and loading it contextually will do more than elaborating on it in the always-on context.&lt;/p&gt;

&lt;p&gt;Less in &lt;code&gt;CLAUDE.md&lt;/code&gt;. More in the right place at the right time.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Next in the series: 30-Minute Setup: AI Coding Guidelines for Your Next.js Project (link will be added on publish)&lt;/em&gt;&lt;/p&gt;

</description>
      <category>aitools</category>
      <category>codequality</category>
      <category>devtools</category>
      <category>aidevos</category>
    </item>
    <item>
      <title>Why High-Context Culture Makes AI Coding Harder — A Japanese Developer's Perspective</title>
      <dc:creator>yunbow</dc:creator>
      <pubDate>Sun, 03 May 2026 12:10:41 +0000</pubDate>
      <link>https://forem.com/yunbow/why-high-context-culture-makes-ai-coding-harder-a-japanese-developers-perspective-123a</link>
      <guid>https://forem.com/yunbow/why-high-context-culture-makes-ai-coding-harder-a-japanese-developers-perspective-123a</guid>
      <description>&lt;p&gt;I'm a software engineer in Japan. I've been using AI coding assistants — Claude Code, Cursor, Copilot — for about one years now.&lt;/p&gt;

&lt;p&gt;At some point I started keeping informal notes on how many prompt revisions it took to get production-quality output. After a few months, a pattern was hard to ignore.&lt;/p&gt;

&lt;p&gt;For tasks I described in Japanese: &lt;strong&gt;4–6 revisions on average.&lt;/strong&gt;&lt;br&gt;
Watching colleagues who worked primarily in English: &lt;strong&gt;1–3.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Same AI. Same model. Roughly similar task complexity. Different language — and apparently, different results.&lt;/p&gt;

&lt;p&gt;I started asking why.&lt;/p&gt;


&lt;h2&gt;
  
  
  The Most Invisible Problem in a High-Context Language
&lt;/h2&gt;

&lt;p&gt;Japanese ranks among the world's most high-context languages. What that means practically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Subject omission is grammatically normal. "Did it" is a complete sentence. Who did what to whom lives in context.&lt;/li&gt;
&lt;li&gt;Vague expressions are socially preferred over explicit ones. "Somehow it feels off" is a complete critique in a code review.&lt;/li&gt;
&lt;li&gt;Politeness layers add indirection at every level. Direct requests sound rude. Softened requests carry meaning only if you know what's being softened.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of this is a flaw. It's a communication system that works — between humans who share context.&lt;/p&gt;

&lt;p&gt;AI assistants do not share your context.&lt;/p&gt;

&lt;p&gt;When I write "please handle this appropriately," I know what "appropriately" means in my codebase. My AI assistant does not. It makes its best guess, which is informed by the global distribution of code it was trained on — not by the six months of implicit decisions my team has accumulated.&lt;/p&gt;

&lt;p&gt;The result is plausible-looking code that misses the point in ways that take hours to diagnose.&lt;/p&gt;


&lt;h2&gt;
  
  
  The 6 Tacit Knowledge Zones
&lt;/h2&gt;

&lt;p&gt;After talking to engineers across Japanese dev teams, I found the same blind spots appearing in almost every organization:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Documentation that doesn't document&lt;/strong&gt;&lt;br&gt;
Formats vary by author. Files go months without updates. The real spec lives in Slack DMs and someone's memory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Team rules that exist only in senior developers' heads&lt;/strong&gt;&lt;br&gt;
Coding conventions exist in practice — enforced silently in code review, never written down because "everyone knows."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Security as an afterthought&lt;/strong&gt;&lt;br&gt;
Security is something you consider before release, not during development. The AI doesn't know this is your team's operating assumption. It will skip security considerations unless explicitly prompted — which you won't do if you don't think about it mid-task.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Task management via word of mouth&lt;/strong&gt;&lt;br&gt;
The real priority queue is the one your team lead carries in their head and communicates in standup. The ticket system is a formality.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Testing without test cases&lt;/strong&gt;&lt;br&gt;
You test the happy path manually before shipping. Edge cases are discovered in production. The AI will generate code that matches this standard — because you didn't specify otherwise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Operations knowledge locked in one person&lt;/strong&gt;&lt;br&gt;
When something breaks at 2am, one person knows what to do. That person's knowledge doesn't exist anywhere else.&lt;/p&gt;

&lt;p&gt;Notice what these have in common: &lt;strong&gt;they're not the absence of knowledge. They're knowledge that lives in exactly one place — a person's head — and will disappear when that person leaves.&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Why AI Makes This Worse, Not Better
&lt;/h2&gt;

&lt;p&gt;The instinctive argument: "AI will fix this — it generates more documentation, writes more consistent code."&lt;/p&gt;

&lt;p&gt;The reality is the opposite.&lt;/p&gt;

&lt;p&gt;AI is excellent at transforming explicit knowledge into more explicit knowledge. Give it a well-defined spec and it produces well-defined code. Give it a type definition and it generates a correctly-typed implementation.&lt;/p&gt;

&lt;p&gt;What AI cannot do is extract tacit knowledge from the environment. It cannot interview your senior engineer. It cannot observe your code review culture. It cannot infer that your team decided six months ago that &lt;code&gt;useEffect&lt;/code&gt; for data fetching was banned after a painful production incident — because that decision exists only in the memory of the three people who were there.&lt;/p&gt;

&lt;p&gt;When you give an AI assistant a vague prompt, it fills the gaps. It uses the global distribution of code patterns it learned during training. That distribution doesn't include your team's specific decisions.&lt;/p&gt;

&lt;p&gt;The higher your tacit knowledge density — and high-context organizations tend to have higher tacit knowledge density — the larger the gap between what you intend and what the AI produces.&lt;/p&gt;


&lt;h2&gt;
  
  
  A Scenario That's More Common Than It Should Be
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;The following is a fictional but composite scenario based on failure patterns I've seen and read about. The system and people are made up. The mechanisms are real.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A team builds a medical appointment system. Development moves fast — AI-assisted, one month to MVP.&lt;/p&gt;

&lt;p&gt;What gets missed in the first week: domain knowledge. The engineers don't know that insurance category codes have a specific format. They don't know that doctor license numbers have validation rules. The AI doesn't ask. No one thinks to tell it.&lt;/p&gt;

&lt;p&gt;By month one: the same appointment conflict logic has been implemented in three different places, each slightly differently, because three developers each asked the AI to "handle booking conflicts" without knowing the others had done it. The AI gave each of them a reasonable implementation.&lt;/p&gt;

&lt;p&gt;Security holes accumulate invisibly. Patient records are accessible without proper authorization checks because the prompt said "fetch appointments for this user" and didn't say "verify the requesting user has access to this patient's records." The AI did exactly what was asked.&lt;/p&gt;

&lt;p&gt;The system ships. In the first week, a researcher discovers they can access any patient's records by modifying the URL parameter. The system goes offline.&lt;/p&gt;

&lt;p&gt;When the team tries to fix it, they discover that the implicit business logic — the stuff that existed only in the product manager's head — was never written down. No one knows what the correct behavior is for edge cases anymore.&lt;/p&gt;

&lt;p&gt;The CTO spends the next three months rebuilding from scratch, this time writing the spec before writing the code.&lt;/p&gt;

&lt;p&gt;The lesson isn't "don't use AI." The lesson is: &lt;strong&gt;the bottleneck in AI-assisted development isn't writing code. It's making implicit knowledge explicit before the AI touches anything.&lt;/strong&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  What Actually Shifts the Outcome
&lt;/h2&gt;

&lt;p&gt;I've been working on an open-source framework called &lt;a href="https://github.com/yunbow/ai-dev-os" rel="noopener noreferrer"&gt;AI Dev OS&lt;/a&gt; that's essentially a structured answer to this problem. But the framework is less important than the underlying principle.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Prompt in the language that minimizes ambiguity for the task&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is uncomfortable to write as a Japanese developer, but: for technical specification, English or highly explicit Japanese outperforms natural conversational Japanese. Not because English is better, but because technical communication benefits from low-context precision.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;❌  「いい感じに処理してください」
✅  「ユーザーがPOSTした画像ファイルを、
    サーバーサイドでWebP形式に変換して
    S3バケット {env.BUCKET_NAME} に保存してください。
    ファイルサイズ上限は5MB。超過はValidationErrorを返すこと。」
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Write down the thing that "everyone knows" before you prompt&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The most valuable five minutes before any significant AI-assisted task: write one paragraph of the rules that your senior developer would enforce in code review. Not a full spec — just the implicit decisions that would otherwise live in their head and filter silently through review.&lt;/p&gt;

&lt;p&gt;Put it in a &lt;code&gt;CLAUDE.md&lt;/code&gt; file or &lt;code&gt;.cursorrules&lt;/code&gt;. Make it persistent. Now the AI has access to your context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Spec before code, always&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ask the AI to write the specification first: input/output types, error cases, security assumptions, business rules. Review it. Then ask for the implementation.&lt;/p&gt;

&lt;p&gt;The friction this adds is real. The bugs it prevents are also real — and much more expensive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Treat tacit knowledge as an organizational risk, not a personal style&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the person who holds the knowledge leaves, it's gone. An AI tool that depends on that person's mental model in every prompt is inheriting that fragility.&lt;/p&gt;

&lt;p&gt;The act of writing down team conventions isn't documentation overhead. It's risk reduction.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Question Worth Asking Your Team
&lt;/h2&gt;

&lt;p&gt;What's the most important unwritten rule in your codebase right now?&lt;/p&gt;

&lt;p&gt;Not the stuff in your linting config or your CONTRIBUTING.md. The real rule — the one a senior engineer would catch in review but that exists nowhere in text.&lt;/p&gt;

&lt;p&gt;If you can name it, you can write it down. If you can write it down, your AI assistant can follow it.&lt;/p&gt;

&lt;p&gt;That one rule, made explicit, is worth more than any prompt engineering technique I've found.&lt;/p&gt;

&lt;p&gt;For what it's worth: the thing I wrote down that made the biggest difference was two sentences. "Server Actions always return &lt;code&gt;ActionResult&amp;lt;T&amp;gt;&lt;/code&gt;. Never throw from a Server Action." Six months of drift, fixed by two sentences in a markdown file.&lt;/p&gt;

&lt;p&gt;Start there.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I built &lt;a href="https://github.com/yunbow/ai-dev-os" rel="noopener noreferrer"&gt;AI Dev OS&lt;/a&gt; to systematize this process for Next.js + TypeScript projects. It's open source — the framework, the templates, the reasoning. If this resonated, that's where the implementation lives.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What's the unwritten rule in your codebase? I'm genuinely curious — drop it in the comments.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>culture</category>
      <category>aitools</category>
      <category>aidevos</category>
    </item>
    <item>
      <title>AI Dev OS</title>
      <dc:creator>yunbow</dc:creator>
      <pubDate>Sun, 03 May 2026 08:07:56 +0000</pubDate>
      <link>https://forem.com/yunbow/ai-dev-os-m4i</link>
      <guid>https://forem.com/yunbow/ai-dev-os-m4i</guid>
      <description>&lt;p&gt;Articles&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/yunbow/i-built-an-oss-to-stop-ai-from-writing-inconsistent-code-every-time-claude-code-cursor-kiro-1oe1"&gt;I Built an OSS to Stop AI from Writing Inconsistent Code Every Time (Claude Code / Cursor / Kiro)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/yunbow/why-high-context-culture-makes-ai-coding-harder-a-japanese-developers-perspective-123a"&gt;Why High-Context Culture Makes AI Coding Harder — A Japanese Developer's Perspective&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>I Built an OSS to Stop AI from Writing Inconsistent Code Every Time (Claude Code / Cursor / Kiro)</title>
      <dc:creator>yunbow</dc:creator>
      <pubDate>Sun, 03 May 2026 04:07:06 +0000</pubDate>
      <link>https://forem.com/yunbow/i-built-an-oss-to-stop-ai-from-writing-inconsistent-code-every-time-claude-code-cursor-kiro-1oe1</link>
      <guid>https://forem.com/yunbow/i-built-an-oss-to-stop-ai-from-writing-inconsistent-code-every-time-claude-code-cursor-kiro-1oe1</guid>
      <description>&lt;p&gt;"Write a function to fetch the list of users." — same prompt, same codebase.&lt;/p&gt;

&lt;p&gt;Yesterday: &lt;code&gt;getUsers()&lt;/code&gt;. Today: &lt;code&gt;fetchUserList()&lt;/code&gt;. Tomorrow: &lt;code&gt;loadAllUsers()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Six months of AI-assisted coding and I kept hitting this wall. My initial reaction was "maybe I need to write better prompts." I wrote better prompts. The functions got slightly better. New inconsistencies appeared elsewhere.&lt;/p&gt;

&lt;p&gt;The problem wasn't the AI's capability. It was that &lt;strong&gt;I had never given it my team's unwritten rules.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That realization led me to build &lt;strong&gt;AI Dev OS&lt;/strong&gt; — an open-source framework that converts implicit developer knowledge into explicit, enforceable rules for AI coding assistants. It supports Claude Code, Cursor, and Kiro (Amazon's AI-native IDE).&lt;/p&gt;

&lt;p&gt;GitHub: &lt;a href="https://github.com/yunbow/ai-dev-os" rel="noopener noreferrer"&gt;github.com/yunbow/ai-dev-os&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The Root Problem: "Almost Correct" Is the Most Expensive Output
&lt;/h2&gt;

&lt;p&gt;When an AI produces obviously wrong code, you catch it immediately and discard it. Not a big deal.&lt;/p&gt;

&lt;p&gt;When an AI produces &lt;em&gt;almost correct&lt;/em&gt; code — code that compiles, passes basic tests, looks reasonable — you merge it. Six months later, your codebase has three error handling patterns, four naming styles, and no one is sure which is canonical.&lt;/p&gt;

&lt;p&gt;That's the real cost. Not obvious errors. Plausible drift.&lt;/p&gt;

&lt;p&gt;Here's why this happens structurally: your AI assistant has no access to your team's conventions by default. It doesn't know that you use &lt;code&gt;ActionResult&amp;lt;T&amp;gt;&lt;/code&gt; for Server Actions, that Zod schemas live in &lt;code&gt;lib/schemas/&lt;/code&gt; and not colocated with components, that you've banned &lt;code&gt;useEffect&lt;/code&gt; for data fetching. These conventions exist in your engineers' heads and in unwritten PR review culture — nowhere an AI can read.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Switching to a more capable model doesn't fix this.&lt;/strong&gt; A more capable model without your conventions just produces more fluent drift.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Solution: A 4-Layer Rule Framework
&lt;/h2&gt;

&lt;p&gt;The core insight of AI Dev OS: rules have different lifespans, and mixing them into one file is what causes fragility.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────────────────────────────────┐
│  L1: Design Philosophy          (2–5 year lifespan)     │
│      "We optimize for correctness and observability     │
│       over developer convenience"                       │
│                                                         │
│  L2: Technology Decisions       (1–3 years)             │
│      "Next.js App Router, Prisma, Zod, NextAuth"        │
│      "We use Tailwind — no CSS-in-JS"                   │
│                                                         │
│  L3: Concrete Coding Rules      (6–12 months)           │
│      Naming conventions, error handling patterns,       │
│      security invariants, test structure                │
│                                                         │
│  L4: Tool-Specific Config       (2–4 months)            │
│      CLAUDE.md, .cursor/.mdc files, Kiro Steering Rules │
└─────────────────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Why does this matter? When you update your AI tool's configuration (L4), you shouldn't risk destabilizing your design philosophy (L1). When you adopt a new library (L2), you shouldn't have to rewrite your security rules (L3). Separating by lifespan makes updates surgical.&lt;/p&gt;




&lt;h2&gt;
  
  
  The 7-Repository Structure
&lt;/h2&gt;

&lt;p&gt;AI Dev OS is distributed across 7 repositories, each with a clear responsibility:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ai-dev-os                     ← Core specification and theory     [available]
ai-dev-os-rules-typescript    ← L1–L3 rules for TypeScript / Next.js  [available]
ai-dev-os-rules-python        ← L1–L3 rules for Python / FastAPI  [available]
ai-dev-os-plugin-claude-code  ← L4: Skills, Agents, Hooks for Claude Code  [available]
ai-dev-os-plugin-cursor       ← L4: .mdc rules for Cursor         [available]
ai-dev-os-plugin-kiro         ← L4: Steering Rules for Kiro       [available]
ai-dev-os-cli                 ← init / update / doctor commands   [available]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;You don't need all of them.&lt;/strong&gt; If you're using Claude Code with TypeScript, you need &lt;code&gt;ai-dev-os-rules-typescript&lt;/code&gt; and &lt;code&gt;ai-dev-os-plugin-claude-code&lt;/code&gt;. Pick what fits your stack.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Get Started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option A: CLI (10 minutes)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ai-dev-os init &lt;span class="nt"&gt;--rules&lt;/span&gt; typescript &lt;span class="nt"&gt;--plugin&lt;/span&gt; claude-code
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;CLAUDE.md&lt;/code&gt; — guidelines index referencing your rule files&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;docs/ai-dev-os/&lt;/code&gt; — rule submodule (L1–L3)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;.claude/plugins/ai-dev-os/&lt;/code&gt; — Skills, Agents, Hooks (L4)&lt;/li&gt;
&lt;li&gt;Pre-commit hooks for automated rule verification&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Verify the setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx ai-dev-os doctor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option B: Manual (20 minutes, more control)
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Add the rule submodule and copy the &lt;code&gt;CLAUDE.md&lt;/code&gt; template.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git submodule add https://github.com/yunbow/ai-dev-os-rules-typescript.git docs/ai-dev-os
&lt;span class="nb"&gt;cp &lt;/span&gt;docs/ai-dev-os/templates/nextjs/CLAUDE.md.template ./CLAUDE.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt; is an index file — 3 lines of directives plus references to the guideline files in the submodule. Add your project-specific rules (3 files recommended) in the &lt;code&gt;## Project-Specific Guidelines&lt;/code&gt; section:&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;## Project-Specific Guidelines&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-business-rule.md
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-external-api.md
&lt;span class="p"&gt;-&lt;/span&gt; docs/guidelines/your-compliance.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Add the Claude Code plugin for Skills, Agents, and Hooks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git submodule add https://github.com/yunbow/ai-dev-os-plugin-claude-code.git .claude/plugins/ai-dev-os
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Claude Code loads &lt;code&gt;CLAUDE.md&lt;/code&gt; automatically on every interaction. The guideline files referenced within it are read on demand.&lt;/p&gt;




&lt;h2&gt;
  
  
  Before / After: What This Actually Changes
&lt;/h2&gt;

&lt;h3&gt;
  
  
  API Route
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt; (no guidelines):&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;// app/api/users/route.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Request&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="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&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;findMany&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;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;users&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;Problems: no auth check, exposes all user fields including sensitive ones, no error handling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt; (with AI Dev OS):&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;// app/api/users/route.ts&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/auth&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/db&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;GET&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Response&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;session&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;auth&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;session&lt;/span&gt;&lt;span class="p"&gt;)&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;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Unauthorized&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="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;401&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="nx"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&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;findMany&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;select&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&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="na"&gt;name&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="na"&gt;email&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="na"&gt;createdAt&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="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;users&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;Auth check. Field selection. Consistent response shape. The AI generated this without being asked because the rules made it the default.&lt;/p&gt;

&lt;h3&gt;
  
  
  Server Action
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Before&lt;/strong&gt;:&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormData&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="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;formData&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;name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&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;update&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&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="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;name&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;Problems: no validation, no error handling, &lt;code&gt;name&lt;/code&gt; is typed as &lt;code&gt;FormDataEntryValue | null&lt;/code&gt;, hardcoded ID.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After&lt;/strong&gt;:&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;zod&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ActionResult&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/types/action&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;auth&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/auth&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@/lib/db&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;UpdateUserSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;updateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;FormData&lt;/span&gt;
&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ActionResult&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;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;session&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;auth&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;session&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Unauthorized&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;parsed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;UpdateUserSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safeParse&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;formData&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;name&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;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;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="na"&gt;error&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;db&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;update&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;where&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&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;id&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;parsed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;success&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="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every Server Action in the codebase now follows this pattern — not because individual developers remember to, but because the AI enforces it by default.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Effect Over Time
&lt;/h2&gt;

&lt;p&gt;The value compounds. After 2 weeks with AI Dev OS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every new API route has auth checks and field selection&lt;/li&gt;
&lt;li&gt;Every Server Action validates input and returns &lt;code&gt;ActionResult&amp;lt;T&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;PR reviews stop being about convention enforcement and start being about logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After 2 months, a new engineer joining the project reads the guideline files and understands the codebase's patterns — because those patterns are now consistently applied everywhere, including the AI-generated portions.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Isn't
&lt;/h2&gt;

&lt;p&gt;AI Dev OS won't catch logical bugs. It won't validate your business rules. It won't replace code review.&lt;/p&gt;

&lt;p&gt;What it does: ensure the AI produces code that matches your codebase's established patterns. The output is still yours to review — but you're reviewing logic, not convention drift.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Check out the core spec&lt;/span&gt;
git clone https://github.com/yunbow/ai-dev-os

&lt;span class="c"&gt;# Or start with the TypeScript rules&lt;/span&gt;
git clone https://github.com/yunbow/ai-dev-os-rules-typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you've been hitting the inconsistency wall and want to talk through how to adapt the rules for your stack — drop a comment. What conventions does your team enforce that your AI assistant keeps ignoring?&lt;/p&gt;

</description>
      <category>claudecode</category>
      <category>aitools</category>
      <category>opensource</category>
      <category>aidevos</category>
    </item>
  </channel>
</rss>
