<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="/feed.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://justin.poehnelt.com/feed/typescript.xml</id>
    <title>Justin Poehnelt: typescript</title>
    <updated>2026-11-26T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <author>
        <name>Justin Poehnelt</name>
        <email>justin.poehnelt@gmail.com</email>
        <uri>https://justin.poehnelt.com/</uri>
    </author>
    <link rel="alternate" href="https://justin.poehnelt.com/tags/typescript/"/>
    <link rel="self" href="https://justin.poehnelt.com/feed/typescript.xml"/>
    <subtitle>Posts by Justin Poehnelt tagged "typescript".</subtitle>
    <icon>https://justin.poehnelt.com/favicon-32x32.png</icon>
    <rights>© 2026 Justin Poehnelt. Licensed under CC BY-SA 4.0.</rights>
    <entry>
        <title type="html"><![CDATA[Finishing Agent Migrations with ast-grep]]></title>
        <id>https://justin.poehnelt.com/posts/finishing-agent-migrations-ast-grep/</id>
        <link href="https://justin.poehnelt.com/posts/finishing-agent-migrations-ast-grep/"/>
        <updated>2026-11-26T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[What 212 benchmark runs taught me about migrating TypeScript to Effect with coding agents, ast-grep ignore lists, and throwaway skills.]]></summary>
        <content type="html"><![CDATA[<aside aria-label="Summary" class="tldr my-4 rounded-r border-l-4 border-callout-summary-border bg-callout-summary p-4 svelte-1f0iuj8"><ul><li>Coding agents stop when their check command passes, even when 5% to 25% of the old code remains.</li> <li>One <a href="https://ast-grep.github.io" rel="nofollow"><code>ast-grep</code></a> rule per old pattern blocks new matches in CI, and its <code>ignores</code> list tracks every remaining file.</li> <li>Across 212 benchmark runs, rules forced 100% completion, and adding a throwaway migration skill cut shortcuts by 88% on real code.</li></ul></aside> <p>At the <a href="https://ai.engineer/code/2026/schedule" rel="nofollow">AI Engineer Code Summit</a>, I shared how I finished a stalled <a href="https://effect.website" rel="nofollow">Effect</a> migration across a 348,000-line TypeScript codebase and benchmarked 212 agent migrations (<a href="https://justin.poehnelt.com/posts/one-rule-one-throwaway-skill/">slides</a>).</p> <p>Agents write most of my code now, and a lot of it is slop. Moving to Effect puts errors and dependencies into the return type, <code>Effect&#x3C;User, UserNotFound | DbError, Database></code>, so the TypeScript compiler rejects unhandled failures. Getting an existing codebase there with agents left mine half finished for months, with two ways to do everything.</p> <h2 id="two-months-of-half-finished-effect">Two months of half-finished Effect</h2> <p>My production app was three months old, 348,000 lines of TypeScript and Svelte, and about 99% written by agents. I started migrating server-side leaf packages to Effect 3 while keeping each module’s Promise export (<code>getUser</code>) beside the new Effect export (<code>getUserEffect</code>), using a two-line prompt with no lint rules and no skill:</p> <pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-text relative">migrate packages/neo4j-core to https://effect.website/docs
don't change the public interface</code></pre> <p>Two months later, every file compiled and the test suite passed, while error handling had decayed:</p> <ul><li>Agents had mapped one error 29 different ways.</li> <li>264 of 345 error-mapping calls discarded the original cause.</li> <li>One catch-all error class, <code>ServiceFailure</code>, ended up in 844 files, the way <code>any</code> spreads through a loose TypeScript migration.</li> <li>Nested fallbacks swallowed failures, so failed reads returned empty data.</li></ul> <h2 id="one-rule-an-ignore-list-and-two-skills">One rule, an ignore list, and two skills</h2> <p>In late September, I stopped migrating whole packages by prompt and switched to five steps per pattern:</p> <ol><li>Pick one convention, such as one tagged error per failure or reading time from Effect’s <code>Clock</code>.</li> <li>Ban the old pattern with an <code>ast-grep</code> rule so any new match fails CI.</li> <li>Put existing matches on the rule’s <code>ignores</code> list by file path to track what remains.</li> <li>Write a throwaway skill showing how to replace matches and shrink <code>ignores</code>.</li> <li>Keep a separate permanent skill describing finished conventions for new code.</li></ol> <p><code>ast-grep</code> matches the syntax tree rather than raw text, so formatting and variable names do not change what matches. This rule bans <code>Date.now()</code> inside <code>Effect.gen</code> so tests can control time through <code>Clock</code>. It started with 27 files on <code>ignores</code> and hit zero the same day (a companion rule banning <code>Promise.all</code> inside <code>Effect.gen</code> went from 8 files to zero in six days):</p> <pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-yaml relative">id: no-date-now-in-effect
severity: error
message: Use Clock, not Date.now().
rule:
  pattern: Date.now()
  inside:
    pattern: Effect.gen($$$)
    stopBy: end
ignores:
  # Delete each entry once it is fixed.
  - packages/key-value-cache/src/r2.ts
  # ... 26 more files</code></pre> <p>Keeping the two skills separate lets you delete the migration instructions when you finish. Earlier in the summer, I put Zod-to-Effect Schema migration steps inside my permanent <code>effect</code> skill, and agents kept reading them three weeks after Zod was gone. Now my permanent <code>effect</code> skill describes only finished code (changed 29 times since July), while each migration gets a temporary skill like <code>api-catalog-migration</code> that gets deleted in the PR emptying <code>ignores</code>. <a href="https://github.com/humanlayer/humanlayer" rel="nofollow">HumanLayer</a> uses the same split: <code>effect-program-design</code> for production Effect and <code>migrate-orpc-to-effect</code> to move one async handler at a time.</p> <h2 id="agents-migrate-the-slop-too">Agents migrate the slop too</h2> <p>One page in my app loaded team members with <code>.catch(() => [])</code>, so a failed database read rendered an empty list. When an agent migrated that file to Effect, it kept the bug and wrote a comment defending it:</p> <pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-ts relative">// Before: a failed read becomes an empty list
await listMembers(id).catch(() => []);

// Migrated by an agent: Effect syntax, same hidden failure
yield* listMembers(id).pipe(Effect.orElseSucceed(() => []));</code></pre> <p>My first rule matched only <code>.catch(() => [])</code>, so the migrated bug passed CI until the rule banned both shapes:</p> <pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-yaml relative">rule:
  any:
    - pattern: $READ.catch(() => [])
    - pattern: Effect.orElseSucceed(() => [])</code></pre> <p>A codemod cannot fix a match like that because someone has to decide what the page renders when the query fails. Moving one module per pull request keeps those product decisions small. Whenever an agent invented a new bad pattern, I added a line to the permanent skill and a matching <code>ast-grep</code> rule:</p> <table><thead><tr><th>Permanent skill addition</th><th>Matching <code>ast-grep</code> rule</th></tr></thead><tbody><tr><td>Setup failures are defects</td><td>Ban <code>Effect.try</code> around setup code</td></tr><tr><td>One tagged error per failure</td><td>Ban new uses of catch-all <code>ServiceFailure</code></td></tr><tr><td>Read current time from <code>Clock</code></td><td>Ban <code>Date.now()</code> inside <code>Effect.gen</code></td></tr><tr><td>Use <code>HttpClient</code> for outbound HTTP</td><td>Ban <code>Promise.race</code> in server code</td></tr></tbody></table> <p><code>ServiceFailure</code> dropped from 844 files to zero within four days of its rule landing. Across 31 rules, ignored file paths fell from 881 to 61, 14 lists emptied, and 23 PRs shrank an ignore list on our busiest day.</p> <h2 id="production-errors-spiked-then-dropped">Production errors spiked, then dropped</h2> <figure class="my-0 flex flex-col gap-3"><a href="https://justin.poehnelt.com/images/aie-migration-impact.svg" aria-label="View full size image: Daily production errors in Sentry (top) and lines of code changed (bottom), August 10 to November 7, 2026. Errors spike past 16,000 per day during the September 19 to October 3 cleanup window, then fall below 300 by mid-October." data-original-src="aie-migration-impact.svg" data-lightbox="" class="block cursor-zoom-in"><img src="https://justin.poehnelt.com/images/aie-migration-impact.svg" alt="Daily production errors in Sentry (top) and lines of code changed (bottom), August 10 to November 7, 2026. Errors spike past 16,000 per day during the September 19 to October 3 cleanup window, then fall below 300 by mid-October." width="760" height="364" class="rounded-sm mx-auto" data-original-src="aie-migration-impact.svg" loading="lazy" fetchpriority="auto" decoding="async"></a> <figcaption class="mt-0 text-xs italic text-center">Daily production errors in Sentry (top) and lines of code changed (bottom), August 10 to November 7, 2026. Errors spike past 16,000 per day during the September 19 to October 3 cleanup window, then fall below 300 by mid-October.</figcaption></figure> <p>Before the cleanup window (September 19 to October 3), Sentry logged about 1,200 production errors a day. Once silent fallbacks started throwing typed failures, daily volume jumped past 16,000 reported events plus thousands dropped under rate limits, then fell below 300 a day by mid-October once those failure paths were handled. One codebase with dozens of changes landing at once cannot isolate what caused that drop, so I built a benchmark to test each piece on its own.</p> <h2 id="212-benchmark-migrations">212 benchmark migrations</h2> <p>I ran 212 unattended Effect v4 migrations in isolated OrbStack Ubuntu VMs (<a href="https://github.com/jpoehnelt/better-auth-effect" rel="nofollow">harness and data</a>):</p> <ul><li><strong>Real code (32 runs on Claude Opus 5.5):</strong> <a href="https://github.com/better-auth/better-auth" rel="nofollow">Better Auth</a> <code>sso</code> (216 matches, 662 tests, 3 runs per setup), Better Auth <code>api-key</code> (88 matches, 193 tests, 3 runs per setup), and <a href="https://github.com/panva/jose" rel="nofollow"><code>jose</code></a> (255 matches, 540 tests, 2 runs per setup).</li> <li><strong>Synthetic code (180 runs on Claude Sonnet 5.5):</strong> Services I built to test missing shared dependencies, public interface preservation, and a 64-run <code>2x2x2</code> factorial with Effect’s linter.</li></ul> <p>Every run got the same prompt (<code>Migrate {{PATHS}} to Effect v4. You are running unattended. Nobody can answer questions during this run, so make the calls yourself and finish.</code>), the shared Effect foundation, and <code>pnpm migration:check</code> running typecheck and tests. I froze the treatments before watching any v2 run:</p> <ul><li><strong>Nothing:</strong> Foundation and <code>migration:check</code> only.</li> <li><strong>Skill:</strong> Adds a throwaway <code>effect-v4-migration</code> skill (old-to-new table, foundation contract, worked example, and “Never” list, with no mention of <code>ast-grep</code>).</li> <li><strong>Rules:</strong> Adds four <code>ast-grep</code> rules (raw <code>throw</code>, <code>try</code>, cause-dropping catches, and raw <code>APIError</code> throws) to <code>migration:check</code>.</li> <li><strong>Both:</strong> Includes both the throwaway skill and the four rules.</li></ul> <p>After each run, the scorer restored the original test files, counted remaining matches outside test-pinned functions, and ran eight hidden <code>ast-grep</code> rules to count shortcuts:</p> <table><thead><tr><th>32 Opus 5.5 runs (8 per setup)</th><th>Nothing</th><th>Skill</th><th>Rules</th><th>Both</th></tr></thead><tbody><tr><td>Finished runs (0 sites left)</td><td>0 of 8</td><td>5 of 8</td><td>8 of 8</td><td>8 of 8</td></tr><tr><td>Mean shortcuts per run (median, range)</td><td>10.1 (6, 1 to 39)</td><td>4.0 (4, 0 to 10)</td><td>16.4 (8.5, 5 to 43)</td><td>2.0 (2, 0 to 5)</td></tr><tr><td>Median tokens per run</td><td>17.9M</td><td>46.6M</td><td>26.0M</td><td>40.8M</td></tr><tr><td>Total cost across 8 runs</td><td>$71.14</td><td>$109.80</td><td>$82.82</td><td>$113.99</td></tr><tr><td>Cost per finished run</td><td>none finished</td><td>$21.96</td><td>$10.35</td><td>$14.25</td></tr></tbody></table> <figure class="my-0 flex flex-col gap-3"><a href="https://justin.poehnelt.com/images/aie-migration-scatter.svg" aria-label="View full size image: Shortcuts per 100 starting sites against share of sites left across 32 Claude Opus 5.5 runs. Rules and Both finish 8 of 8 runs in the right-hand band, Skill finishes 5 of 8, and Nothing finishes 0 of 8." data-original-src="aie-migration-scatter.svg" data-lightbox="" class="block cursor-zoom-in"><img src="https://justin.poehnelt.com/images/aie-migration-scatter.svg" alt="Shortcuts per 100 starting sites against share of sites left across 32 Claude Opus 5.5 runs. Rules and Both finish 8 of 8 runs in the right-hand band, Skill finishes 5 of 8, and Nothing finishes 0 of 8." width="760" height="420" class="rounded-sm mx-auto" data-original-src="aie-migration-scatter.svg" loading="lazy" fetchpriority="auto" decoding="async"></a> <figcaption class="mt-0 text-xs italic text-center">Shortcuts per 100 starting sites against share of sites left across 32 Claude Opus 5.5 runs. Rules and Both finish 8 of 8 runs in the right-hand band, Skill finishes 5 of 8, and Nothing finishes 0 of 8.</figcaption></figure> <h2 id="rules-forced-agents-to-finish">Rules forced agents to finish</h2> <p>Across all 32 Opus runs and all 64 Sonnet factorial runs, 96 of 96 runs ended with their own <code>migration:check</code> green. Agents stop when the check passes.</p> <p>Without rules, <code>Nothing</code> finished 0 of 8 real-code runs (leaving 4.5% to 25% unmigrated), and <code>Skill</code> missed all three <code>sso</code> runs by 1 or 2 of 216 sites because an unmigrated helper still compiles and passes tests. Even a 1-in-8 miss rate leaves about six half-migrated packages in a 50-package repo for future agents to copy. With <code>Rules</code> or <code>Both</code>, every Opus and Sonnet run finished at 100%.</p> <p>A permanent end-state skill (same Effect v4 conventions, no old-to-new steps) also fell short on <code>sso</code> without rules, stopping with 32 to 40 of 216 sites left because nothing showed how to wrap public helpers whose tests expected a <code>throw</code>:</p> <table><thead><tr><th>Better Auth SSO plugin</th><th>Nothing</th><th>Permanent skill</th><th>Throwaway skill</th></tr></thead><tbody><tr><td>Sites migrated without rules</td><td>77%</td><td>84%</td><td>99%</td></tr><tr><td>Sites migrated with rules</td><td>100%</td><td>100%</td><td>100%</td></tr><tr><td>Mean cost per run, with rules</td><td>$12.26</td><td>$18.38</td><td>$16.81</td></tr></tbody></table> <h2 id="rules-alone-let-shortcuts-through">Rules alone let shortcuts through</h2> <p>A rule says what old pattern fails the scan, not what should replace it. On <code>sso</code> (216 sites), <code>Rules</code> alone cleared the scan with the smallest edit that removed <code>throw</code> and <code>try</code>:</p> <table><thead><tr><th>Totals across 3 <code>sso</code> runs</th><th>Nothing</th><th>Skill</th><th>Rules</th><th>Both</th></tr></thead><tbody><tr><td><code>Effect.promise</code> on a call that can reject</td><td>30</td><td>0</td><td>47</td><td>0</td></tr><tr><td><code>Effect.orDie</code></td><td>0</td><td>0</td><td>15</td><td>0</td></tr><tr><td>Unexplained catch turning failure into success</td><td>8</td><td>2</td><td>25</td><td>0</td></tr></tbody></table> <p><code>Effect.promise</code> and <code>Effect.orDie</code> turn rejections into untyped crashes. Both remove <code>throw</code> and <code>try</code> from the scan while hiding failures from the type checker. (On the smaller <code>api-key</code> plugin and <code>jose</code>, shortcut counts in <code>Rules</code> stayed close to <code>Nothing</code>.)</p> <p>None of the eight <code>Rules</code>-only runs in v2 edited <code>sgconfig.yml</code> or appended to <code>ignores</code>. In an earlier discarded round that accepted inline exemption comments (<code>KL-001</code> to <code>KL-058</code>), agents invented fake IDs (<code>KL-059</code> onward) 23 to 37 times in a run, which v2 eliminated by banning unverified comment exemptions.</p> <h2 id="missing-shared-code-and-broken-public-interfaces">Missing shared code and broken public interfaces</h2> <p>When the shared foundation in <code>@better-auth/core</code> lacked a transaction adapter in round 1 on <code>sso</code>, <code>Nothing</code> and <code>Rules</code> built local workarounds inside the plugin, while every skill run stopped and quoted its instruction: “If any of these is missing, stop and report it. Don’t build your own.” Deleting a shared service from the synthetic repo on purpose reproduced the split on Sonnet 5.5: all 16 skill runs reported the missing service (13 stopped with no code edits), while all 16 runs without the skill built a duplicate copy inside the leaf module.</p> <p>Rules also pushed agents through public interfaces unless the prompt named them. On <code>sso</code>, 3 of 3 runs in <code>Skill</code>, <code>Rules</code>, and <code>Both</code> changed exported helper signatures called by tests. On synthetic code, a <code>// synchronous on purpose</code> comment failed to stop 4 of 8 <code>Rules</code> runs and 5 of 8 <code>Both</code> runs because the prompt’s instruction to remove thrown errors overrode the comment. Listing those functions in the prompt, ignore list, and skill cut interface breakages to 0 of 32 while <code>Rules</code> and <code>Both</code> still finished 8 of 8 runs.</p> <h2 id="behavior-tool-calls-and-token-cost">Behavior, tool calls, and token cost</h2> <p>With one sentence in the skill asking for a comment on every fallback, agents commented 75% (<code>Skill</code>) and 77% (<code>Both</code>) of fallbacks on real code versus 0% (<code>Nothing</code>) and 14% (<code>Rules</code>), and 78% versus 2% and 9% on synthetic code. Skill runs also added more unprompted edge-case comments (median 13.5 and 12 per real-code run vs. 5 in <code>Nothing</code>).</p> <figure class="my-0 flex flex-col gap-3"><a href="https://justin.poehnelt.com/images/aie-migration-timeline.svg" aria-label="View full size image: Heat strips of when agents read files, edited code, and ran tests from start to end of a run on Claude Opus 5.5 and Claude Sonnet 5.5. On Sonnet 5.5, the skill moves median first edit from 51% to 28% into the run." data-original-src="aie-migration-timeline.svg" data-lightbox="" class="block cursor-zoom-in"><img src="https://justin.poehnelt.com/images/aie-migration-timeline.svg" alt="Heat strips of when agents read files, edited code, and ran tests from start to end of a run on Claude Opus 5.5 and Claude Sonnet 5.5. On Sonnet 5.5, the skill moves median first edit from 51% to 28% into the run." width="760" height="436" class="rounded-sm mx-auto" data-original-src="aie-migration-timeline.svg" loading="lazy" fetchpriority="auto" decoding="async"></a> <figcaption class="mt-0 text-xs italic text-center">Heat strips of when agents read files, edited code, and ran tests from start to end of a run on Claude Opus 5.5 and Claude Sonnet 5.5. On Sonnet 5.5, the skill moves median first edit from 51% to 28% into the run.</figcaption></figure> <ul><li>Sonnet 5.5 without the skill read files for half the run before its first edit (median 51%, with or without rules), versus 28% with the skill.</li> <li>Opus 5.5 with the skill read and ran shell commands throughout the run to check edits against reference examples, while <code>Rules</code> kept tests running until the end.</li> <li>Every setup ran <code>migration:check</code> at the end. Running <code>ast-grep</code> from a post-edit hook per file is the next change I want to test.</li></ul> <table><thead><tr><th>Median per Opus run</th><th>Nothing</th><th>Skill</th><th>Rules</th><th>Both</th></tr></thead><tbody><tr><td>Wall-clock minutes</td><td>18</td><td>24</td><td>23</td><td>29</td></tr><tr><td>Total tool calls</td><td>117</td><td>219</td><td>137</td><td>178</td></tr><tr><td>Shell commands</td><td>76</td><td>152</td><td>94</td><td>140</td></tr><tr><td>File edits and writes</td><td>29</td><td>44</td><td>33</td><td>35</td></tr><tr><td>Dedicated <code>Read</code> tool calls</td><td>6</td><td>7</td><td>4</td><td>2</td></tr></tbody></table> <p>Agents called <code>Read</code> 2 to 7 times per run and used <code>cat</code>, <code>sed</code>, and <code>grep</code> instead (one run wrote 29 Python scripts for bulk edits). All 32 Opus runs used 940 million tokens ($377.76 total), 98% of them cache reads (923M cache reads, 11.9M cache writes, 5.2M output, 7,860 uncached input). Skill runs used 2.6x the median tokens of <code>Nothing</code> (46.6M vs. 17.9M), but <code>Nothing</code> spent $71.14 for zero finished runs while <code>Both</code> finished 8 of 8 at $14.25 per run.</p> <h2 id="effects-linter-checks-style-not-migration-progress">Effect’s linter checks style, not migration progress</h2> <p>A 64-run <code>2x2x2</code> factorial on Sonnet 5.5 (8 runs per cell, $1.56 to $2.02 per run) tested adding <code>@effect/language-service</code>:</p> <table><thead><tr><th>8 runs per cell (Sonnet 5.5)</th><th>Nothing</th><th>+ linter</th><th>Skill</th><th>+ linter</th><th>Rules</th><th>+ linter</th><th>Both</th><th>+ linter</th></tr></thead><tbody><tr><td>Finished runs</td><td>0</td><td>2</td><td>8</td><td>7</td><td>8</td><td>8</td><td>8</td><td>8</td></tr><tr><td>Mean shortcuts per run</td><td>7.6</td><td>6.5</td><td>0.8</td><td>0.9</td><td>3.5</td><td>4.2</td><td>0.8</td><td>1.6</td></tr><tr><td>Mean linter warnings</td><td>2.8</td><td>0</td><td>0.4</td><td>0</td><td>3.9</td><td>0</td><td>0.5</td><td>0</td></tr></tbody></table> <p>The linter cleared its own warnings every time, and runs with the skill already averaged 0.2 warnings versus 1.7 without it. Completion and shortcuts stayed flat (25 of 32 finished with the linter vs. 24 of 32 without, and 3.3 vs. 3.2 shortcuts) because Effect’s linter checks Effect style rather than plain <code>throw</code>, <code>Effect.promise</code>, or <code>Effect.orDie</code>.</p> <p>Real-code targets had 2 or 3 runs per cell on one frontier model, I wrote the synthetic services myself, and the public-interface fixes landed together across prompt, rules, and skill. Even with those limits, the gap between setups exceeded run-to-run variation across every target.</p> <h2 id="checklist-for-an-agent-migration">Checklist for an agent migration</h2> <p>Put every completion rule in the check before starting an unattended migration:</p> <ol><li><strong>Check command:</strong> Run <code>ast-grep</code>, the type checker, and the original tests in one script outside the paths the agent edits.</li> <li><strong>Pattern rules:</strong> Write one <code>ast-grep</code> rule per old pattern, fail CI on new matches, and track existing files in <code>ignores</code>.</li> <li><strong>Shortcut rules:</strong> Ban <code>Effect.promise</code> on failable calls, <code>Effect.orDie</code>, cause-dropping mappers, and unverified suppressions.</li> <li><strong>Public interfaces:</strong> List preserved function signatures in the prompt and <code>ignores</code>, because prompts override code comments.</li> <li><strong>Throwaway skill:</strong> Show old-to-new examples, require a comment on fallbacks, stop on missing shared services, and delete the skill when <code>ignores</code> is empty.</li></ol> <p>I turned this checklist and starter templates into the <a href="https://github.com/jpoehnelt/skills/tree/main/eng-migration" rel="nofollow"><code>eng-migration</code></a> skill:</p> <pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-bash relative">npx skills install jpoehnelt/skills/eng-migration</code></pre>]]></content>
        <author>
            <name>Justin Poehnelt</name>
            <email>justin.poehnelt@gmail.com</email>
            <uri>https://justin.poehnelt.com/</uri>
        </author>
        <category label="agents" term="agents"/>
        <category label="ai" term="ai"/>
        <category label="ast" term="ast"/>
        <category label="benchmark" term="benchmark"/>
        <category label="claude code" term="claude code"/>
        <category label="typescript" term="typescript"/>
        <category label="code" term="code"/>
        <published>2026-11-18T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[One Rule, One Throwaway Skill]]></title>
        <id>https://justin.poehnelt.com/posts/one-rule-one-throwaway-skill/</id>
        <link href="https://justin.poehnelt.com/posts/one-rule-one-throwaway-skill/"/>
        <updated>2026-11-26T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Slides from my AI Engineer Code Summit talk on using ast-grep rules and a temporary skill to migrate TypeScript to Effect.]]></summary>
        <content type="html"><![CDATA[<p>At the <a href="https://ai.engineer/code/2026/schedule" rel="nofollow">AI Engineer Code Summit</a>, I shared how I used ast-grep rules to block new uses of old patterns in CI and a throwaway skill to show agents how to migrate TypeScript code to Effect. For the full story and data from all 212 benchmark runs, read <a href="https://justin.poehnelt.com/posts/finishing-agent-migrations-ast-grep/">Finishing Agent Migrations with ast-grep</a>.</p> <p>I turned the checklist and starter templates from the talk into the <a href="https://github.com/jpoehnelt/skills/tree/main/eng-migration" rel="nofollow"><code>eng-migration</code></a> skill (<code>npx skills install jpoehnelt/skills/eng-migration</code>).</p> <div class="not-prose my-6 overflow-hidden rounded-xl border border-border bg-card text-card-foreground"><iframe src="https://justin.poehnelt.com/talks/2026-aie-ast-grep/index.html?embedded=true" title="One Rule, One Throwaway Skill slides" class="block aspect-video w-full" allowfullscreen></iframe> <div class="flex flex-wrap items-center justify-between gap-x-4 gap-y-2 border-t border-border px-4 py-3 text-sm"><span class="text-muted-foreground">Focus the deck and use arrow keys, or swipe.</span> <a href="https://justin.poehnelt.com/talks/2026-aie-ast-grep/" rel="external" class="rounded-md border border-border px-3 py-1.5 font-medium hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring">Open standalone slides</a></div></div> <div class="not-prose mx-auto my-8 max-w-md"><figure class="my-0 flex flex-col gap-3"><a href="https://justin.poehnelt.com/images/aie-code-summit-2026-lineup.png" aria-label="View full size image: AI Engineer Code Summit&#x27;s Agents and Software Factories lineup, including Justin Poehnelt, on November 10, 2026 in San Francisco." data-original-src="aie-code-summit-2026-lineup.png" data-lightbox="" class="block cursor-zoom-in"><picture><source srcset="https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.Dkcuyje1.avif 1080w, https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.BvWkcnWU.avif 960w, https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.C2YRmpQw.avif 640w, https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.wI3ymRv7.avif 400w" sizes="(min-width: 512px) 448px, calc(100vw - 64px)" type="image/avif"><source srcset="https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.u3u8coHu.webp 1080w, https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.Ch1K_EpL.webp 960w, https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.DQ9MvE2_.webp 640w, https://justin.poehnelt.com/_app/immutable/assets/aie-code-summit-2026-lineup.CR_OuyrH.webp 400w" sizes="(min-width: 512px) 448px, calc(100vw - 64px)" type="image/webp"> <img src="https://justin.poehnelt.com/images/aie-code-summit-2026-lineup.png" alt="AI Engineer Code Summit&#x27;s Agents and Software Factories lineup, including Justin Poehnelt, on November 10, 2026 in San Francisco." class="mx-auto w-full rounded-lg border border-border" data-original-src="aie-code-summit-2026-lineup.png" loading="lazy" fetchpriority="auto" decoding="async" width="1080" height="1350"></picture></a> </figure></div>]]></content>
        <author>
            <name>Justin Poehnelt</name>
            <email>justin.poehnelt@gmail.com</email>
            <uri>https://justin.poehnelt.com/</uri>
        </author>
        <category label="agents" term="agents"/>
        <category label="ai" term="ai"/>
        <category label="typescript" term="typescript"/>
        <category label="code" term="code"/>
        <published>2026-11-10T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Google Drive Picker TypeScript Types Updated]]></title>
        <id>https://justin.poehnelt.com/posts/google-drive-picker-typescript/</id>
        <link href="https://justin.poehnelt.com/posts/google-drive-picker-typescript/"/>
        <updated>2024-11-04T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[A DefinitelyTyped update that replaced community Google Drive Picker types with autogenerated types from the official reference source.]]></summary>
        <content type="html"><![CDATA[<div role="note" class="note my-4 rounded-r border-l-4 border-callout-note-border bg-callout-note p-4 svelte-15n01j6"><p>Update: See <a href="https://justin.poehnelt.com/posts/react-wrapper-google-drive-picker/">React Wrapper for Google Drive Picker</a> for a React component with built-in types.</p></div> <p>Last week I submitted a <a href="https://github.com/DefinitelyTyped/DefinitelyTyped/pull/70926" rel="nofollow">pull request to the DefinitelyTyped repository</a> for the Google Drive Picker API. Not a big deal in itself, but these types are generated from the same source as the <a href="https://developers.google.com/drive/picker/reference/picker" rel="nofollow">Google Drive Picker reference documentation</a> and <em>should</em> be more correct and consistent than the community types that were previously in the DefinitelyTyped repository.</p> <p>The versions of <a href="https://www.npmjs.com/package/@types/google.picker?activeTab=versions" rel="nofollow"><code>@types/google.picker</code></a> in this switchover are:</p> <ul><li><code>@types/google.picker@0.0.43</code>: old community types</li> <li><code>@types/google.picker@0.0.44</code>: new autogenerated types</li></ul> <p>You can update with the following command:</p> <pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-sh relative">npm install -D @types/google.picker@^0.0.44</code></pre> <p>If you find any mistakes or inconsistencies in the types, please open an issue at <a href="https://issuetracker.google.com/issues/new?component=191628" rel="nofollow">https://issuetracker.google.com/issues/new?component=191628</a> and not the DefinitelyTyped repository since the Google team will need to make the changes.</p>]]></content>
        <author>
            <name>Justin Poehnelt</name>
            <email>justin.poehnelt@gmail.com</email>
            <uri>https://justin.poehnelt.com/</uri>
        </author>
        <category label="code" term="code"/>
        <category label="google" term="google"/>
        <category label="google workspace" term="google workspace"/>
        <category label="drive" term="drive"/>
        <category label="picker" term="picker"/>
        <category label="typescript" term="typescript"/>
        <category label="definitelytyped" term="definitelytyped"/>
        <published>2024-11-04T00:00:00.000Z</published>
    </entry>
    <entry>
        <title type="html"><![CDATA[Strongly Typed Yup Schema in TypeScript]]></title>
        <id>https://justin.poehnelt.com/posts/strongly-typed-yup-schema-typescript/</id>
        <link href="https://justin.poehnelt.com/posts/strongly-typed-yup-schema-typescript/"/>
        <updated>2022-10-01T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[A TypeScript pattern that uses generics and conditional types to make Yup schemas strongly typed, with examples that satisfy the compiler.]]></summary>
        <content type="html"><![CDATA[<p>This weekend I have been exploring <a href="https://www.typescriptlang.org/docs/handbook/2/conditional-types.html" rel="nofollow">conditional types in TypeScript</a> to use with Firestore. These take the basic form of <code>T extends U ? X : Y</code> and are used to create a new type based on the type of <code>T</code>. I was curious if I could use this to create a strongly typed Yup schema.</p> <p>The basic idea is to create a generic function that takes a Yup schema and a type. The function will return a Yup schema that is strongly typed to the type. The function will use a conditional type to determine the type of the schema and return the appropriate schema.</p> <div class="snippet-component my-4 overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-sm relative group"> <div id="snippet-s1" data-snippet-body="" class="p-0 [&#x26;_pre]:!my-0 [&#x26;_pre]:!rounded-none [&#x26;_pre]:!border-0 [&#x26;_pre]:!bg-transparent [&#x26;_pre]:!p-0 [&#x26;_code]:!px-4 [&#x26;_code]:!pt-3 [&#x26;_code]:!pb-5 overflow-hidden data-[collapsed=true]:max-h-[22rem]"><pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-typescript relative">import * as yup from "yup";

export type ConditionalSchema&#x3C;T> = T extends string
  ? yup.StringSchema
  : T extends number
    ? yup.NumberSchema
    : T extends boolean
      ? yup.BooleanSchema
      : T extends Record&#x3C;any, any>
        ? yup.AnyObjectSchema
        : T extends Array&#x3C;any>
          ? yup.ArraySchema&#x3C;any, any>
          : yup.AnySchema;

export type Shape&#x3C;Fields> = {
  [Key in keyof Fields]: ConditionalSchema&#x3C;Fields[Key]>;
};
</code></pre></div> </div> <p>With those two generic types, we can create a strongly typed Yup schema. These can obviously be extended to include more types and better handle arrays and objects.</p> <p>Some example usage that keeps the TypeScript compiler happy:</p> <div class="snippet-component my-4 overflow-hidden rounded-lg border border-border bg-background text-foreground shadow-sm relative group"> <div id="snippet-s2" data-snippet-body="" class="p-0 [&#x26;_pre]:!my-0 [&#x26;_pre]:!rounded-none [&#x26;_pre]:!border-0 [&#x26;_pre]:!bg-transparent [&#x26;_pre]:!p-0 [&#x26;_code]:!px-4 [&#x26;_code]:!pt-3 [&#x26;_code]:!pb-5 overflow-hidden data-[collapsed=true]:max-h-[22rem]"><pre class="shiki shiki-themes github-light-default github-dark-default"><code class="language-typescript relative">interface Foo {
  stringField: string;
  booleanField: boolean;
}

yup.object&#x3C;Shape&#x3C;Foo>>({
  stringField: yup.string().default(""),
  booleanField: yup.boolean().default(false),
});
</code></pre></div> </div> <p>And it works!</p>]]></content>
        <author>
            <name>Justin Poehnelt</name>
            <email>justin.poehnelt@gmail.com</email>
            <uri>https://justin.poehnelt.com/</uri>
        </author>
        <category label="code" term="code"/>
        <category label="yup" term="yup"/>
        <category label="typescript" term="typescript"/>
        <category label="generics" term="generics"/>
        <published>2022-10-01T00:00:00.000Z</published>
    </entry>
</feed>