05 / how i buildHow I build
Don't chase the models. Build a stable scaffold they rise into. That scaffold is a harness: it blends deterministic craft (Python, AST analysis, skills written in markdown) with probabilistic model judgement, the best of both worlds working together. As my context engineering sharpens and the models improve underneath it, the two compound. A rising tide that lifts both.
Here's a concrete one. I built a /restructure skill this year. It reorganises code that's grown too big and broken the Single Responsibility Principle. Instead of the model reading a whole codebase and guessing where to act, Python scans the file system and scores every file for "tension": AST analysis for size and coupling, git history for churn, a test-coverage safety multiplier. The model gets hard data on where the tension actually sits, complexity times impact, and spends its judgement on the restructuring, not on hunting for the problem. Deterministic code finds the facts. The model does the thinking. I've built a library of patterns like it since.
Another: lexicographic rules beat pattern taxonomies for classification. A lexicographic rule orders cues by importance and acts on the first one that discriminates, like a dictionary comparing the first letter and only checking the second if those tie. Far more robust than pulling a set of patterns out of the data and forcing everything new into them. I'd assumed AI would do best fed a ready-made pattern library. Turns out it works the patterns out itself, given a simple lexicographic steer.
The scaffold rests on plain deterministic craft. It's the one line I keep coming back to:
When faced with two or more alternatives that deliver roughly the same value, take the path that makes future change easier.
— Andrew Hunt & David Thomas, The Pragmatic Programmer
My take on Sandi Metz's 99 Bottles OO exercise puts that to work: polymorphism instead of conditionals, methods of five lines or fewer, each class with a single reason to change. The 0, 1 and 6 cases become subclasses that override only what differs. It's the same discipline the /restructure skill automates.
class BottleNumber:
@classmethod
def from_number(cls, number):
return {
0: BottleNumber0(number),
1: BottleNumber1(number),
6: BottleNumber6(number),
}.get(number, BottleNumber(number))
def __init__(self, number):
self.number = number
def quantity(self):
return str(self.number)
def container(self):
return "bottles"
def successor(self):
return BottleNumber.from_number(self.number - 1)
class BottleNumber0(BottleNumber):
def quantity(self):
return "no more"
def successor(self):
return BottleNumber.from_number(99)
View the full file on GitHub →More on GitHub: