You steer the design.
AI writes and proves the code.
Let AI do what it is best at (writing Go code, tests, and exhaustive local validation) while you focus on architecture, plain-English guidance, and one final review on the Pull Request.
The Problem: Why "Prompt and Pray" Goes Sideways#
When most people try coding with an AI assistant, the first five minutes feel like magic, and the next hour feels like cleaning up a mess. Three things cause almost all of that frustration:
- What people call "hallucination" is really missing context. An AI does
not invent wrong code out of spite. It gives the best answer it can based on
whatever context is in front of it.
The mistake people make is either assuming the AI knows unspoken context a
human teammate would have, or telling the AI how to code something when it
actually knows a cleaner design. Fix that by combining repo context
(
AGENTS.md,REVIEW.md) with clear request context (your goals and preferred libraries, without prescribing how) and planning first before writing code. - AI is probabilistic, so it needs good tests and deterministic tools. Left
to itself, an AI only predicts code that looks plausible, and adding a new
feature can quietly break existing behavior you already shipped. Pairing the
AI with strong behavior tests (
go test -race) and linters (golangci-lint,gosec) gives it deterministic feedback to write better new code and gives you the regression safety net to let AI extend your codebase with confidence. - Unchecked pull requests burn time and review credits. Opening a PR before running local checks triggers failing CI builds, noisy review threads, and wasted GitHub Copilot quota on broken commits.
Why You Only Need a Terminal and a Browser (No IDE Required)#
Writing boilerplate and running validation loops is now an AI job; making architectural decisions, providing product guidance, and deciding whether to accept the finished PR is the developer's job. With a CLI harness and good guardrails, you do not need a code editor open at all while building:
- Steer architecture & intent in words (Step 2): Talk through what you want
and why in plain English, make the design calls that matter, and capture the
agreement in a structured issue (
GitHub Issues,Jiravia MCP, or localtemp/issues/). - Let AI write code & prove behavior (Steps 3 and 4): The AI writes tests
and code, verifies them with deterministic CI (
go test -race,golangci-lint,gosec), and runs its own fresh multi-agent self-review (finish-issue) before opening a PR, pausing only when an architectural trade-off needs your call. - Make the final call once on the Pull Request (Step 5): Because the AI already validated everything it could on your branch, the only time you inspect code line-by-line is once on the finished GitHub PR before clicking Merge.
The Fix: Four Small Habits#
You do not need a complicated framework to fix this. You only need four small habits in order:
1. Supply Context & Plan First
Give the AI your repo context, let it ask plain-English questions one at a time, and have it explain its plan before touching code.
2. Rely on Good Tests & Deterministic CI
Pair the AI with strong public-behavior tests, race checks, and linters via one portable scafctl command, helping AI write better code while proving existing features never break.
3. Let AI Self-Review Before the PR
Have fresh, read-only AI subagents audit the branch for bugs and forgotten docs automatically before opening a PR, saving CI runs, Copilot quota, and your attention.
4. Bound the PR Loop
Give GitHub Copilot a clear repo rulebook (REVIEW.md), wait for green CI before re-reviewing, stop at 3 rounds, and keep a human on Merge.
What You Will Build in This Walkthrough#
Inside examples/go-app/
is shorty, a tiny ~150-line Go URL shortener with two endpoints:
POST /links: takes a long URL and returns a 6-character short code.GET /{code}: redirects your browser to the original URL.
Right now, links in shorty live forever and you cannot tell whether anyone
ever clicked them. Across five short steps, you will add optional link
expiration (expires_in) and a click counter (GET /links/{code}/stats):
New to scafctl? Grab it for Linux, macOS, or Windows via the
scafctl Installation Guide
before starting Step 01. Need to look up a term, browse the bundled skills, set
up your own repository, or wire Tekton/GitHub Actions CI later? Everything extra
lives in the Reference & Lookup section at the bottom of the left sidebar so
it stays out of your way while you walk through the steps.