Skip to content
Follow
← all articles

gof-patterns-article · Part 1

code-agents · 30 min read

GoF patterns when the agent writes the code

In 36 runs, a coding agent given a plain ticket chose well, and naming Strategy built classes that did not pay. What you need GoF for now is reading the diff.

Marcin

Java since 2007, .NET since 2010 · Azure · lately deep in LLMs

Watch on YouTube

Why I tested this

I started coding more than twenty years ago and learned the Gang of Four (GoF) patterns as a university student. I've spent a lot of time since then teaching them to juniors. I care about code quality.

Coding agents changed who writes the first draft, and they write a growing share of the code you ship. I take that as the premise and put no number on it. I've noticed that an LLM sometimes overengineers: it adds layers nobody asked for, and the result isn't the best code it could have written. If you've reviewed code for years, that's a fixable problem. You read the diff, simplify it, or ask for a specific pattern by name. But what about a developer who can't do that yet? A junior, or someone who believes the agent makes this kind of knowledge unnecessary, has a much harder time telling a good structure from a decorated one.

So I wanted to answer three questions, on an example small enough to read in full. Does the agent write good-quality code from an ordinary ticket? Does it use a design pattern when one fits? And if it doesn't, what can you do to make it?

I set up a test to find out, with an AI assistant doing the legwork at my instruction. A small .NET pricing service, three tickets, four ways of writing each one, three runs apiece: 36 runs of one model. My first design didn't hold up. The task I'd built to show where a pattern pays turned out not to need one, because discounts that differ only by a rate are data. So I added a task where a pattern is defensible and ran everything again.

The answers weren't the ones my questions assumed. From a plain ticket, in the tasks where no pattern pays, the agent added no unneeded production types. The overengineering showed up when the ticket asked for a pattern or dictated the design. A ticket for one temporary discount rule got a three-line change in 3 of 3 runs. With four words appended to the same ticket, it got an interface and two classes in 3 of 3 runs. The four words were "Use the Strategy pattern."

So the question about juniors moves from "can you name the right pattern for the agent?" to "can you recognize what the agent built, and judge whether it pays?" My answer fits in two sentences. Given a plain ticket that states the business facts, the agent already chooses well. What you need the patterns for now is reading its diff: recognizing a pattern in it, including one with no class, and judging whether the change that pattern makes easier is real.

Here's the route. First, what Norvig argued about Strategy in 1996, because it's still the best frame for this. Then the experiment in brief, and one section per task: what each way of writing the ticket produced, and the one result in that task that surprised me, shown in code. Then the skill: what it changed against the plain ticket, and what it takes to make the agent use it. Each task ends with what an experienced reader sees in the diff that the results table doesn't show, because that's where the years of pattern knowledge still pay. The limits come after that, and they're real. It ends with what I found and what I'd recommend.

One picture runs through all of it. Think of a kitchen order ticket. It says what was ordered and when it has to go out. It doesn't say which pan to use. Your seat is at the pass, the counter where finished plates wait for a last look before they go to the table. The picture is a device, not evidence, and no claim below depends on it.

What Norvig said about Strategy in 1996

Strategy is the one pattern I work through here. My paraphrase: Strategy puts a family of interchangeable algorithms behind one common shape, so the code that needs one of them can take any of them.

Strategy, one shape for many rules The pricing code uses one shared discount rule shape. Three interchangeable rules fit it: Loyal at 5% off, Student at 10% capped at 30, and Partner tiered at 10% or 15%. STRATEGY · ONE SHAPE, ANY RULE Pricing code Total(order) Discount rule one shared shape Loyal 5% off Student 10% · capped at 30 Partner tiered · 10% or 15% uses implements
FIG. 1The pricing code depends only on the shared shape, so a new customer type is one more rule that fits it.

The argument that matters for 2026 is thirty years old. In May 1996, Peter Norvig gave a talk at the Object World conference called "Design Patterns in Dynamic Programming," and its slides are still online. In the talk he reports that a study of the Gang of Four book (Design Patterns: Elements of Reusable Object-Oriented Software, by Gamma, Helm, Johnson, and Vlissides, 1994, copyright 1995) found 16 of 23 patterns have a qualitatively simpler implementation in Lisp or Dylan than in C++, for at least some uses of each pattern. He sorts those 16 by cause, and Strategy is one of four he credits to first-class functions, along with Command, Template-Method, and Visitor.

On Strategy, his point is that the strategy is a variable whose value is a function, so with first-class functions the pattern is invisible, and you don't need separate classes that differ in one or a few well-understood ways. He adds one caveat: you may still want strategy objects, a function plus data such as make(<strategy>, fn: f, cost: 5, speed: 4), but not a class per instance.

That isn't "patterns are obsolete." The claim has a qualifier, and the cause Norvig names for Strategy is a language feature. C# has a close counterpart: a Func<T, TResult> can hold a method or a lambda expression and be passed as a parameter. Reading that as the feature Norvig points at is my inference.

A coding agent doesn't change the language. So the 2026 question isn't what the language can do. It's who chooses the form, and who checks the choice. In kitchen terms, the pans are the same ones; what changed is who's cooking.

The experiment

Every run starts from the same small C# solution: a .NET 10 Shop library, an xUnit test project, and one production file. PriceCalculator.Total switches on CustomerType. Regular customers pay full price, Loyal customers get 5% off, and any other customer type falls through a _ => 0m fallback and gets no discount. Keep that fallback in mind; the first task comes back to it. From baseline/Shop/Pricing.cs, lines 14 to 18:

var discount = order.Customer switch
{
    CustomerType.Loyal => subtotal * 0.05m,
    _ => 0m
};

There are three tasks, each a ticket a product owner might write:

  • Employee adds a customer type at 20% and says more customer types are coming. I designed it as the case where a pattern pays; it turned out to be a rate, and rates are data.
  • Promotion adds one rule meant to be temporary: an extra 3% off orders of 1,000 or more. The plain ticket doesn't say it's temporary; only one of the four ways does. No pattern pays here.
  • Student and Partner adds two customer types whose rules have different shapes (Student 10% capped at 30, Partner 10% up to 1,000 and 15% of the whole order above it), one receipt line per customer type, and more customer types announced. Here a pattern is defensible.

Each ticket went to the agent four ways, verbatim, as the single message of a fresh session:

  • (a) the plain ticket;
  • (b) the plain ticket plus "Use the Strategy pattern.";
  • (c) the plain ticket plus design rules, with no pattern name;
  • (d) the plain ticket again, with a design-patterns skill installed.

That's 3 tasks, 4 ways and 3 repetitions: 36 runs of one model, claude-opus-5-5 in Claude Code 2.1.310 with no effort setting of my own, on one day, each from a fresh copy of the baseline in a clean configuration. A first batch of 24 runs on the first two tasks was the pilot; it showed the Employee task couldn't prove its point, so the third task was added and everything ran again. A script counts new production types (class, interface, record, struct and enum declarations) and lines from each diff. The AI assistant that ran the experiment classified the structure of each result by hand, and I didn't review those classifications run by run. All 36 runs ended with the tests passing.

The 36 runs are in a demo repository at commit b1e0c56: the baseline, the skill, the verbatim prompts in EXPERIMENT.md, and for every run its diff, test log and transcript.

Figure 2 shows what the first three ways built in the two tasks where no pattern pays.

What each ticket variant built in the Employee and promotion tasks A grid of two tasks by three ticket variants. The plain ticket built a rate table in the Employee task and an inline change in the promotion task, with no new types. Appending 'Use the Strategy pattern.' built Strategy classes in both: four new types in the Employee task, three in the promotion task. Design rules built a class per discount in the Employee task (four or five new types) and an inline change with a removal note in the promotion task (no new types). TICKET VARIANTS · WHAT EACH BUILT (A) PLAIN (B) + STRATEGY NAMED (C) + DESIGN RULES EMPLOYEE · NEW CUSTOMER TYPE AT 20% PROMOTION · TEMPORARY THRESHOLD RULE Rate table 0 new types Strategy classes 4 new types Class per discount 4, 5, 4 new types Inline change 0 new types Strategy classes 3 new types Inline change 0 types · removal note
FIG. 2The plain ticket added no new types in either task; naming Strategy added them in both, and the design rules in the Employee task.

Task 1: the rate that looked like a pattern

This is the plain Employee ticket, from EXPERIMENT.md:

Add a new customer type, Employee, with a 20% discount. Sales plans to add another customer type with its own discount about once a month; partners and students are next. Keep the tests passing and add a test for the new type.
WayWhat it built, 3 of 3 runsNew production typesLines added
(a) plaina rate table022 / 15 / 22
(b) + "Use the Strategy pattern."an interface, one rate class and a registry4 each48 / 45 / 45
(c) + design rulesan interface and a class per discount4 / 5 / 463 / 74 / 62

The plain ticket did the sensible thing: customer types that differ only by a rate became a dictionary of rates. Naming Strategy built an interface and classes for three numbers, which measures obedience rather than judgment, since (b) told it to. The design rules for (c) read: "Adding a customer type must not require changing the code of the existing discounts, and each discount must be testable on its own." That's a fair description of what Strategy is for, and the agent took it literally: a class per discount. You asked the cook to keep every pan separate, and the cook got out a pan per dish.

What surprised me: two runs, one ticket, two behaviors

The interesting difference wasn't between the ways of writing the ticket. It was between two runs of the same plain ticket. Both built the rate table. One of them also changed what happens to a customer type that has no rate. From the third plain-ticket run:

@@ -8,14 +8,20 @@ public record Order(CustomerType Customer, IReadOnlyList<OrderLine> Lines);
 
 public static class PriceCalculator
 {
+    // To add a customer type: add it to CustomerType and give it a rate here.
+    public static readonly IReadOnlyDictionary<CustomerType, decimal> DiscountRates =
+        new Dictionary<CustomerType, decimal>
+        {
+            [CustomerType.Regular] = 0m,
+            [CustomerType.Loyal] = 0.05m,
+            [CustomerType.Employee] = 0.20m,
+        };
+
     public static decimal Total(Order order)
     {
         var subtotal = order.Lines.Sum(l => l.UnitPrice * l.Quantity);
-        var discount = order.Customer switch
-        {
-            CustomerType.Loyal => subtotal * 0.05m,
-            _ => 0m
-        };
-        return subtotal - discount;
+        if (!DiscountRates.TryGetValue(order.Customer, out var rate))
+            throw new InvalidOperationException($"No discount rate defined for customer type {order.Customer}.");
+        return subtotal - subtotal * rate;
     }
 }

The _ => 0m fallback is gone. A customer type without a rate now throws. The same run added a test that every customer type must have a rate:

public void Every_customer_type_has_a_discount_rate() =>
    Assert.All(Enum.GetValues<CustomerType>(), t => Assert.True(
        PriceCalculator.DiscountRates.ContainsKey(t), $"Missing discount rate for {t}"));

Another plain-ticket run of the same ticket kept the old behavior, and said so in a comment:

@@ -8,14 +8,19 @@ public record Order(CustomerType Customer, IReadOnlyList<OrderLine> Lines);
 
 public static class PriceCalculator
 {
+    // To add a customer type: add it to CustomerType and give it a rate here.
+    // Types not listed get no discount.
+    private static readonly IReadOnlyDictionary<CustomerType, decimal> DiscountRates =
+        new Dictionary<CustomerType, decimal>
+        {
+            [CustomerType.Loyal] = 0.05m,
+            [CustomerType.Employee] = 0.20m,
+        };
+
     public static decimal Total(Order order)
     {
         var subtotal = order.Lines.Sum(l => l.UnitPrice * l.Quantity);
-        var discount = order.Customer switch
-        {
-            CustomerType.Loyal => subtotal * 0.05m,
-            _ => 0m
-        };
+        var discount = subtotal * DiscountRates.GetValueOrDefault(order.Customer, 0m);
         return subtotal - discount;
     }
 }

Neither is wrong. They are two different policies for a case the ticket never mentioned, and only one of them is the old behavior. Across the two customer-type tasks, 22 of the 24 runs replaced the fallback with code that fails for an unmapped customer type (an explicit throw in 20, a dictionary indexer with no fallback in 2), and the same 22 added an every-type test. Only two runs, both in the Employee task, kept the fallback, and they're the two without the test. Totals for every defined customer type are unchanged, so no number in the results table shows any of this. The promotion adds no customer type and isn't affected.

The agent had a reason, and one of the skill runs wrote it down:

// Adding a customer type: add the enum value and its rate here.
// Every CustomerType must have an entry; a missing one throws rather than silently charging full price.

That's a fair argument. It may even be the better behavior. But nobody ordered it. In the kitchen, the cook changed a side dish, and the plate still looks right.

This is where experience pays, and it isn't pattern knowledge. An experienced reviewer reads TryGetValue and throw and asks what happens to the customer type that isn't in the table yet, because they've seen that question cause an incident. The review comment writes itself, and it asks rather than rules: "The ticket asked for an Employee type. The diff also replaces the _ => 0m fallback with a throw for any type without a rate, and adds a test that every type has one. Totals for Regular, Loyal and Employee are unchanged. Do we want unmapped types to fail from now on, or keep the old fallback?"

It's also why I word the restraint claim narrowly. The plain-ticket runs in the Employee and promotion tasks added no unneeded production types: 0 of 6, and 0 of 12 with the pilot. That's a claim about added types and nothing wider.

Task 2: one temporary rule

This is the plain promotion ticket:

Orders with a subtotal of 1,000 or more get an extra 3% off the amount left after the customer discount. Keep the tests passing and add a test for the new rule.
WayWhat it built, 3 of 3 runsNew production typesLines added
(a) plainan inline change018 / 18 / 18
(b) + "Use the Strategy pattern."an interface and two classes3 each43 / 50 / 47
(c) + design rulesan inline change (in one run a private method), marked for removal013 / 22 / 13

The design rules for (c) were "a promotion for this quarter only; it will be removed at the end of December, so keep the change small and easy to delete." That sentence mixes a fact with an instruction, so these runs can't say which part did what. What changed is the marking: all three (c) runs put a comment on the rule saying it will be removed, and no other run did. The structure stayed small and inside PriceCalculator, as in the plain runs, whose ticket never even says the rule is temporary; one (c) run moved the rule into a private method.

What surprised me: four words, three types

This is the contrast from the opening. Figure 3 shows it, and the two diffs below are the first run of each.

The same temporary rule in two shapes From the plain promotion ticket the agent changed Total() inline: three added lines and no new types. With 'Use the Strategy pattern.' appended it built an interface, two implementing classes and a Total() that applies the list: three new production types. PROMOTION · ONE RULE, TWO SHAPES (A) · PLAIN (B) · STRATEGY NAMED · 3 TYPES Total() 3 lines inline Total() applies the list Interface IDiscountStrategy Class CustomerTypeDiscount Class LargeOrderDiscount
FIG. 3The same temporary rule from the plain ticket and from the ticket with "Use the Strategy pattern." appended, as the first run of each built it.

From the plain ticket, the whole production change:

@@ -16,6 +16,8 @@ public static class PriceCalculator
             CustomerType.Loyal => subtotal * 0.05m,
             _ => 0m
         };
-        return subtotal - discount;
+        var afterDiscount = subtotal - discount;
+        var bulkDiscount = subtotal >= 1000m ? afterDiscount * 0.03m : 0m;
+        return afterDiscount - bulkDiscount;
     }
 }

From the same ticket with "Use the Strategy pattern." appended, the added declarations:

public interface IDiscountStrategy
{
    // Returns the amount after this discount is applied to the running amount.
    decimal Apply(Order order, decimal subtotal, decimal amount);
}

public sealed class CustomerTypeDiscount : IDiscountStrategy
{
    public decimal Apply(Order order, decimal subtotal, decimal amount) => order.Customer switch
    {
        CustomerType.Loyal => amount - amount * 0.05m,
        _ => amount
    };
}

public sealed class LargeOrderDiscount : IDiscountStrategy
{
    public const decimal Threshold = 1000m;

    public decimal Apply(Order order, decimal subtotal, decimal amount) =>
        subtotal >= Threshold ? amount - amount * 0.03m : amount;
}

Those four words added three production types to one rule that the task treats as temporary. I expected the agent to push back, or at least to keep the pattern small. It did neither: it built what it was told, every time. Naming a pattern in the ticket is choosing the pan for the cook, and whatever you name gets built. In the Employee and promotion tasks, the (b) runs added two to three times the lines of the plain runs.

An experienced developer wouldn't have written that sentence into this ticket, and that's the point. Knowing Strategy includes knowing what it costs: an interface and a class per case are paid for by the next case, and a rule with an end date has no next case. The agent doesn't weigh that when it's told what to build. The person writing the ticket does, and so does the person reviewing the diff.

Task 3: two rules of different shapes

This is the plain Student and Partner ticket:

Add two new customer types. Student: 10% off, but never more than 30 per order. Partner: 10% off when the subtotal is up to 1,000, and 15% off the whole order when it is above 1,000. Every customer's discount must also appear on the receipt as one line, for example "Loyal: 5% off" or "Student: 10% off, max 30". Sales plans to add another customer type with its own discount rule about once a month. Keep the tests passing and add tests for the new behavior.
WayWhat it built, 3 of 3 runsNew production typesLines added
(a) plainStrategy as classes7 / 8 / 7100 / 123 / 109
(b) + "Use the Strategy pattern."Strategy as classes7 each123 / 121 / 116
(c) + design rulesStrategy as classes8 / 7 / 7210 / 150 / 159

This is the task where a pattern is defensible. The experiment's write-up gives the reasoning, a check made before any run: without a pattern, the simplest correct answer is two parallel switch expressions over four customer types, one for the amount and one for the receipt line, so every new customer type edits both. A parameter table no longer fits, because it would need a bag of optional fields. With a pattern, each customer type's amount and receipt line live in one place. That makes Strategy the defensible answer, not the only correct one.

The design rules made the biggest diffs of the whole experiment, up to 210 lines, and one of those runs added six new test types.

What surprised me: nobody had to ask

The plain ticket got Strategy as classes in 3 of 3 runs, without the word appearing anywhere in the prompt. Naming the pattern in (b) changed almost nothing, because the agent was already there. From the first plain-ticket run, the interface and one of its four classes:

/// <summary>A customer type's discount rule and how it is described on the receipt.</summary>
public interface IDiscountPolicy
{
    decimal DiscountFor(decimal subtotal);
    string Description { get; }
}

public sealed class PartnerDiscount : IDiscountPolicy
{
    public decimal DiscountFor(decimal subtotal) => subtotal * (subtotal > 1000m ? 0.15m : 0.10m);
    public string Description => "10% off, 15% off above 1,000";
}

So the agent recognized the case on its own. It didn't reach for Strategy in the Employee task, where the customer types differ only by a number, and it did reach for it here, where the rules differ in shape and the ticket announces more of them. That's the judgment I set out to test, and on this model, on these tasks, the agent had it.

What experience adds here is the second half of review: judging whether the change the pattern makes easier is real. The questions I'd ask of any diff like this come from how the tasks were designed, and they're my inference, not a checklist the experiment validated. Is the rule temporary? The promotion has an end date, so a small inline change is enough. If the rule stays, do the cases differ in shape, or only in a number? In the Employee task it's only a number, so a table was enough. If they differ in shape, would every new case edit two parallel places? Here it would, so the classes pay for themselves. The same three questions explain every row above.

Three questions for a diff Is the rule temporary? If yes, an inline change, as in the promotion. If not, do the cases differ in shape or only in a number? A number means a rate table, as for Employee. Shape leads to the last question: would every new case edit two parallel places? If yes, Strategy classes pay, as for Student and Partner. THREE QUESTIONS · WHEN THE CLASSES PAY Temporary? the rule has an end date Inline change Promotion Shape or number? how the cases differ Rate table Employee Two places? every new case edits both Strategy classes Student and Partner yes no number shape yes
FIG. 4Each question settles one task: the end date stops at an inline change, a number at a rate table, and only two parallel places make the classes pay.

So GoF knowledge can act in three places, shown in Figure 5: naming a pattern in the ticket, stating design rules in the ticket, and recognizing a pattern in the diff. On this model, on these tasks, the (b) and (c) runs argue against the first two. The third is where the experienced developer sits.

Where GoF knowledge can act when an agent writes the code A ticket goes to the agent, which may load the skill, writes a diff, and you review it. GoF knowledge can act in three places: naming a pattern in the ticket, stating design rules in the ticket, and recognizing a pattern in the diff. The review is the focus. GOF KNOWLEDGE · WHERE IT ACTS Skill variant (d) Ticket what changes Agent picks a form Diff what it wrote Review you read it Naming in the ticket Rules in the ticket Recognition in the diff
FIG. 5GoF knowledge can act in three places; on this model and these tasks the runs argue against the two in the ticket and for the one in the diff.

The skill: same ticket, what changes

The fourth way kept the plain ticket and installed a skill: a single file, .claude/skills/gof-patterns/SKILL.md, that Claude Code can load when the task matches its description. An AI assistant drafted it at my instruction, and I accepted it. It was written knowing the Employee and promotion tasks, so its rules match them; the Student and Partner task came later. The skill file didn't change between the batches. So what follows shows what a skill that encodes the right signals does, not how skills do in general. This is the description Claude matches on, and the two lists that matter:

---
name: gof-patterns
description: Decide whether a Gang of Four design pattern is warranted before using one. Use when adding a new variant, type or behavior to object-oriented code, when code branches on a type or kind, or when a pattern such as Strategy, Factory, Decorator, Observer, Command or State is being considered.
---

And from the body:

## Do not use a pattern when

- There is one variant, or a second one with no sign of a third.
- The change is temporary (a promotion, a migration, a flag that will be removed). Make it small and easy to delete.
- The pattern would add more types than the behavior it holds. An interface with one implementation, or a factory for one product, is a cost with no return.
- The language already covers it: a delegate or `Func<>` is a strategy, an `event` is an observer, a `switch` expression over a closed set is often enough.
## Before you finish

1. Name the concrete change the pattern makes easier. If you cannot point to it in the requirement, remove the pattern.
2. Count the types you added. If there are more types than variants, say why in one line.
3. Keep the existing tests passing and add a test per new variant.

Claude Code loads a skill's description into every session and the full file only when the skill is invoked, by Claude when the task matches the description or by you. Against the plain ticket, the skill changed this:

Task(a) plain(d) plain + skillSkill loaded
Employeerate table, 0 new types, 15 to 22 lines0 new types; a switch in 2 runs, a table in 1; 21 to 22 lines3 of 3
Promotioninline, 0 new types, 18 linesinline, 0 new types, 15 to 19 lines0 of 3
Student and PartnerStrategy as classes, 7 to 8 new types, 100 to 123 linesStrategy as a Func in a record, 2 to 3 new types, 64 to 77 lines3 of 3

In the Employee task the skill loaded and changed nothing that matters: no Strategy, no new types, a different but equivalent form. In the promotion it never loaded, so that row says nothing about the skill. A skill that never fires does nothing; it's a very well-written file at that point.

The Student and Partner row is the one that changed. Same decision, different form: Strategy without a class per rule. From the first skill run:

// A customer type's discount: how much to take off a subtotal, and how to describe it on the receipt.
public record Discount(string ReceiptLine, Func<decimal, decimal> AmountFor);

public static class Discounts
{
    // To add a customer type: add it to CustomerType and give it one entry here.
    private static readonly Dictionary<CustomerType, Discount> ByCustomer = new()
    {
        [CustomerType.Regular] = new("Regular: no discount", _ => 0m),
        [CustomerType.Loyal] = new("Loyal: 5% off", subtotal => subtotal * 0.05m),
        [CustomerType.Student] = new("Student: 10% off, max 30", subtotal => Math.Min(subtotal * 0.10m, 30m)),
        [CustomerType.Partner] = new("Partner: 10% off, 15% off above 1,000",
            subtotal => subtotal * (subtotal > 1000m ? 0.15m : 0.10m)),
    };

    public static Discount For(CustomerType customer) =>
        ByCustomer.TryGetValue(customer, out var discount)
            ? discount
            : throw new ArgumentOutOfRangeException(nameof(customer), customer, "No discount defined for this customer type.");
}

At the pass, this is a dish with no name on the menu. Nothing in the code says Strategy, and it is Strategy: a family of interchangeable discount rules behind one shape, chosen per customer type. Reading it that way is my inference from Norvig's caveat about strategy objects: a record that bundles a function with a receipt line is a strategy object without a class per instance.

Strategy in 1996 and in 2026 In 1996 the language changed, from C++ to Lisp and Dylan with first-class functions, and Strategy became invisible. In these runs the language stayed C#; the author changed to an agent, the strategy object stayed in the diff as a Func record, and spotting it falls to the reader. STRATEGY · 1996 VS 2026 1996 · THE LANGUAGE CHANGES 2026 · THE AUTHOR CHANGES C++ a class per case Lisp · Dylan first-class functions Strategy invisible Agent the new author Func record Strategy stays Reader has to spot it
FIG. 6In 1996 the language changed and Strategy became invisible; in these runs the author changed, and the strategy object stayed for the reader to spot.

In 1996 the language changed and the pattern got simpler or disappeared. In these runs the language didn't change: it's the same C# in every cell, with Func available in all of them. What changed between (a) and (d) is the form the agent chose. In (d) the agent made the pattern invisible again, by choice. I mean that in one narrow sense: the classes are gone, while the strategy object, a function plus data, is still in the diff for a reader who knows the pattern. Someone who doesn't know the pattern sees a record and a dictionary. An experienced developer sees Strategy, and can ask the right question about it.

Making the agent use the skill

In the promotion task the skill never loaded on its own, so I ran a third batch to see what a user can do about that: 18 more runs, the same three plain tickets, the same skill file, and two more ways to bring the skill in.

  • (e) puts /gof-patterns in front of the ticket, which invokes the skill explicitly.
  • (f) adds one sentence to the ticket: "Use the gof-patterns skill."
Task(a) plain(d) skill, left to Claude(e) /gof-patterns(f) asked by name
Employeerate table, 3 of 3switch 2, table 1; loaded 3 of 3switch, 3 of 3rate table, 3 of 3
Promotioninline, 3 of 3inline, 3 of 3; loaded 0 of 3inline, 3 of 3inline, 3 of 3; loaded 3 of 3
Student and Partnerclasses, 3 of 3Func record, 3 of 3; loaded 3 of 3Func record, 3 of 3classes 2, Func record 1; loaded 3 of 3

Both ways load it. Asked by name, Claude loaded the skill itself in 9 of 9 runs, all three promotion runs included. The explicit invocation loads it by definition. It leaves no trace in the transcript, so I checked it separately: with the slash, a probe model quoted the skill's text word for word, and without it, it couldn't.

What loading changed is another matter. In the promotion task, with the skill loaded in all six runs, the agent did what the plain ticket did: an inline change, no new types, and no comment marking the rule as temporary. The skill says a temporary change should stay small and easy to delete, but the plain ticket never says the rule is temporary, so that line had nothing to match. In the Employee task no run added a type either way, and the side dish from Task 1 varied again: three of the six runs kept a no-discount fallback this time. In the Student and Partner task the explicit invocation gave the Func record in 3 of 3, as (d) did, while asking by name gave classes in 2 of 3, as the plain ticket did, with the same skill loaded every time.

What loading the skill changed With the skill loaded by the slash command or by asking for it by name, the Promotion task still got an inline change in all six runs, as with the plain ticket. The Employee task still added no types, and the fallback was kept in some runs and thrown in others. In the Student and Partner task the plain ticket built Strategy classes; the slash command gave a Func record in three of three runs, and asking by name gave classes in two of three. THE SKILL LOADED · WHAT CHANGED PLAIN TICKET (A) SKILL LOADED (E) OR (F) PROMOTION EMPLOYEE STUDENT AND PARTNER Inline change 0 new types Inline change loaded 6 of 6 · 0 new types Rate table 0 new types No new types fallback kept or thrown Strategy classes 3 of 3 Func record 3 of 3 Strategy classes 2 of 3 /gof-patterns by name
FIG. 7Loading the skill changed the structure only in the Student and Partner task, and there the way it was loaded decided between a Func record and classes.

So a skill isn't a switch. Making it load is the easy part: name it, or invoke it. Whether it changes the code depends on what the ticket gives it to work with, and in these runs it changed the structure only where the task already had several shapes. My inference from that is the last place the experienced developer sits in this story: knowing the promotion is temporary and saying so on the ticket, knowing when a skill is worth invoking, and reading the diff afterwards either way.

These 18 runs are in the demo repository under runs/2026-10-31-c/, with their own RESULTS.md, added in commit f398be0.

The strongest objection is my own data

The objection goes like this. If the plain ticket was the best prompt in every task, GoF knowledge can be delegated entirely. The agent picked a table, a small inline change and Strategy as classes without being told, and the skill, where it loaded, changed only the form. So you need neither pattern names in the prompt nor pattern knowledge in your head.

On this model, on these tasks, I concede most of that. The plain ticket didn't need a pattern name. The objection stops in three places.

First, the facts came from whoever wrote the ticket: that more customer types are coming, that a rule is temporary. No variant withheld them, so the data can't prove they drove the agent's choice, but supplying them is still the writer's job (my inference).

Second, somebody reads the diff. Part of that reading needs GoF knowledge: the Func record only reads as Strategy to someone who knows the pattern, and judging whether a pattern pays is the same knowledge. Part of it doesn't: the changed fallback in 22 of 24 runs is plain review. Both parts take experience, and neither shows in a total.

Third, the scope is narrow: one model, three small tasks, three runs per cell, a skill written knowing two of the tasks. The next section has the full list.

Limits, in plain words

This is one model: claude-opus-5-5 in Claude Code 2.1.310, with no effort set. The runs don't record the effort value; the documentation gives medium as the default for Opus 5.5 as of 2026-10-30. Anthropic's prompting guidance, in the copy saved on 2026-10-29, says to treat advice that names a model as measured on that model, and its Overeagerness note, which describes extra files and unrequested abstractions, names Claude Opus 4.5 and 4.6, not the model tested here. I hold this article to the same rule: none of it carries over to another model without a check of your own.

It's three small tasks, with three runs per cell, which supports counts and not rates. The clean configuration wasn't empty: project-only settings removed user-level plugins, hooks and skills, but Claude Code's own built-in plugins and bundled skills stayed in every variant. In 10 of the 36 runs the agent never tried to run the tests itself; in each of those runs some of its read-only exploration commands had been refused. The script ran the tests after every run. The structure classification is the assistant's, and I didn't review it run by run.

Is there published work that measures agents choosing or overapplying GoF patterns from a ticket? None found in a search on 2026-10-30. An arXiv query returned no entries, and the search didn't reach Semantic Scholar, DBLP, the ACM Digital Library, or the ICSE, FSE, and ASE 2026 programs, so the question is open. A comparison across models is a separate piece of work.

Run it yourself

Every cell can be checked in the demo repository: runs/2026-10-29-b/table.md and RESULTS.md sit behind the tables above, and each run's folder has its diff.patch, numstat.txt and transcript. To rerun the batch on your own model and version (it cost 9.07 USD at list price):

./run-experiment.sh runs/mine /tmp/gof-work 1 36
python3 tabulate.py runs/mine > runs/mine/table.md

Each run is started like this, from a fresh copy of the baseline, with only build, test and read-only commands allowed:

"$claude_bin" -p "$prompt" --setting-sources project --strict-mcp-config --no-chrome \
  --no-session-persistence --permission-mode acceptEdits --permission-prompts none \
  --allowedTools "Bash(dotnet build:*)" "Bash(dotnet test:*)" "Bash(git ls-files:*)" "Bash(git status:*)" "Bash(git diff:*)" "Bash(git log:*)" "Bash(ls:*)" "Bash(cat:*)" "Bash(find:*)" "Bash(grep:*)" "Bash(head:*)" "Bash(tail:*)" \

Use the commit that adds the third batch, f398be0, or a later one, not b1e0c56: it updates the script to take the variants as a fifth argument (the third batch used "e f") and to make the output path absolute, which the test step needs (the third batch's RESULTS.md says why). A rerun gives you a new sample from your own model and version, not a check of mine.

If you're new to Claude Code, my Claude Code Playbook course starts from a first safe session.

What I found, and what I'd recommend

I started with three questions. Here's what these runs say about them, on this model and these tasks.

Does the agent write good-quality code from an ordinary ticket? Yes. From plain tickets it chose a rate table, a three-line change, and a set of classes, and in the two tasks where no pattern pays it added no unneeded production types.

Does it use a design pattern when one fits? Yes. In the Student and Partner task the plain ticket got Strategy as classes in 3 of 3 runs without anyone naming it.

If it doesn't, what can you do to make it? I'd now ask that question differently, because pushing for a pattern is where things went wrong. Naming Strategy got it built every time, including three new production types for one temporary rule. A design rule did the same for customer types that differ only by a rate. The skill loaded every time once I asked for it by name or invoked it, but loading it changed the structure only in the Student and Partner task, and with the same skill loaded, asking by name still got classes in 2 of 3 runs. The lever that held up in every task was the simplest one: a plain ticket that states the facts.

So does experience still matter? More than the opening assumed, just somewhere else. The agent picked the pan without help. What it didn't do was tell me that a fallback had become a throw, that four words had cost three types, or that a record holding a Func was Strategy. Each of those took someone who had seen the pattern, and its failure modes, many times before. The knowledge moved from the ticket to the review, and the review is where an experienced developer earns their seat at the pass.

If you work with a coding agent, this is what I'd do. It follows from the runs above, so it carries the same limits.

  • Write the ticket from facts: what changes, which cases are announced, and until when. Leave pattern names and design rules out; in these runs they built structure that didn't pay.
  • Read the diff for the pattern. Ask whether the rule is temporary, then whether the cases differ in shape or only in a number, and then whether a new case would edit two parallel places. Remember that a Func in a record can be Strategy too.
  • Read the diff for what nobody asked for. In 22 of the 24 runs of the two customer-type tasks the agent changed what happens for an unmapped customer type, and no total showed it.
  • If you rely on a skill, check that it loads, and name it or invoke it when it matters. Then read the diff anyway: in two of the three tasks, loading it didn't change the decision.
  • Rerun a cell on your own model before you lean on any of this.

If you're deciding what to expect from a junior, look for whether they can read the pattern in the diff, not whether they can name it in a prompt. If you teach patterns, as I have for years, I'd teach them as shapes to recognize in code someone else wrote, and as costs to weigh, not as words to put in a prompt. That last part is my opinion; the runs didn't test teaching.

That's a smaller claim than "patterns still matter," and I think it's the one these runs earn.

Sources