Agentic Pattern Libraryby Vikas Goyal
← All patterns
73

Reference Skeleton

Also known as: reference application, golden-path repo, exemplar codebase

Anchor coding agents to a small working reference app that shows how the team builds things.

TrackAI-native software delivery FamilyBuild Maturity Emerging ChangesContext
01

Problem

In a new system, agents have no existing code to imitate, so each session invents its own structure, error handling and naming. Written conventions help, but agents follow working examples far more reliably than prose. The first weeks of a greenfield project set patterns that are expensive to undo.

  • Agents copy what they see.
  • Conventions written as prose are ambiguous.
  • A reference that isn’t maintained misleads.
  • Too rich a reference turns into a framework nobody understands.
02

Solution

Build a small, compilable reference app that shows the team’s way of handling each recurring concern: one request path end to end, one background job, error handling, logging, configuration, tests at each level, and the CI pipeline. Agents can draft it, but people review it closely, because everything built later copies it. Keep it running and tested in CI. The memory file tells agents to follow it (“new endpoints follow /reference”), and new services are scaffolded from it. When a convention changes, change the reference first, and later work follows.

03

Diagram

Reference appone path end to endtests · logging · CI Memory file“follow /reference” Agent session 1new endpoint Agent session 2queue consumer Agent session 3new service Reviewlogic, not style CIreference stays green copied by every session

One small, reviewed example sets the pattern; every agent session copies working code instead of guessing from prose.

04

When to use

Use it when

  • Greenfield systems and new services
  • Several teams or many agents building similar components
  • Conventions drift between agent sessions
  • Platform teams offering a golden path

Avoid it when

  • Mature codebases with consistent examples to copy already
  • One-off prototypes
  • Teams that can't keep the reference compiling
05

Trade-offs

Latency Agents read a few files before starting
Cost Building and maintaining the reference
Complexity A small app kept green in CI
Reliability Consistent structure across agent sessions

Gains

  • Consistent structure across many agent-built components
  • Reviews focus on logic, not style and structure
  • Conventions change in one place

Costs

  • The reference needs an owner and upkeep
  • Shortcuts in the reference get copied everywhere
  • Too much in it slows understanding
06

Worked example

Scenario
The Linkwatch team starts its new click-analytics service.
  1. ReferenceA 400-line service with one ingest endpoint, one queue consumer, structured logging, typed config, unit and integration tests, and CI.
  2. Memory file“New endpoints and consumers follow /reference: copy its structure and tests.”
  3. BuildAgents add 6 endpoints in a week. Structure is consistent, so reviewers spend their time on the logic.
  4. DriftOne agent pulls in a different logging library. The reviewer points to the reference and it’s replaced.
  5. ChangeThe team switches config libraries. The reference is updated first, and the next agent tasks follow it.
07

Failure modes

FailureSymptomMitigation
Rotting referenceReference no longer builds, so agents ignore itKeep it in CI and fix it like production code
BloatReference grows into a frameworkOne minimal example per concern
Copied shortcutsDemo hacks appear in production codeNo shortcuts in the reference; it is production quality
Ignored referenceAgents still invent their own structurePoint to it in the memory file; reviewers enforce it