AI Programming in Practice: From Vibe Coding to Spec Coding
Generative models lower the cost of writing code, but turning requirements into maintainable systems still needs a collaboration method. This article contrasts conversation-first vibe coding with spec-driven development, outlines how to choose tools by capability rather than brand, and covers specs, context, verification loops, security baselines, metrics, anti-patterns, and a staged rollout.
1. Why AI programming needs a methodology
Once generative models enter development, the marginal cost of writing code drops sharply, but the cost of turning requirements into a maintainable system does not drop in lockstep. A recurring problem is that conversational prompts quickly produce a runnable prototype, yet struggle to produce changes that can be reviewed, regression-tested, and maintained over time. The bottleneck is not model capability; it is a missing collaboration protocol. Requirements live as natural-language fragments in chat history, constraints stay in people’s heads, and acceptance criteria are never written as something executable.
The core question in AI programming therefore shifts from “which tool” to “which paradigm organizes human–model collaboration.” Methodology sets the quality ceiling; tools set the efficiency floor.
2. Two paradigms and their limits
2.1 Fuzzy interaction: conversation-centered exploratory development
Intent is expressed continuously in natural language; the model generates code immediately; people correct the description based on what they see when it runs. The loop is roughly: describe the idea → generate code → run and observe → append corrections → converge.
Strengths: very short feedback and low cognitive load. It fits work where requirements are still fluid—tech-choice spikes, algorithm experiments, one-off scripts, and the shortest path to understanding an unfamiliar module.
Weaknesses: context grows linearly with the chat; early decisions get overwritten with no audit trail; constraints are implicit, so another person cannot reproduce the work; generation easily overshoots the task and creates unrelated diffs, making review more expensive than writing the code by hand.
2.2 Spec-driven: specification-centered convergent development
“What to do, what not to do, and how to accept it” is written as structured documentation first; the model then implements inside a constrained context. The flow is: write the spec → freeze interface contracts → slice tasks → generate the change → verify automatically → review by humans → archive spec and implementation together.
Strengths: changes are predictable, auditable, and parallelizable; the spec is the single source of truth between the team and the model.
Weaknesses: upfront cost is real; a vague spec cancels the gains; it assumes a reasonable degree of requirement stability.
2.3 How to choose
These are stages on one path, not substitutes. In exploration, use fuzzy interaction to shrink the solution space. Once the direction is set, freeze conclusions into a spec and drive later changes from it. Practical signals to switch: a third rework on the same module, or a change that starts crossing two or more clearly bounded components.
3. Tool capabilities: dimensions instead of brands
Coding assistants differ a lot in shape, but they cluster by where they sit: in-editor (completion and local rewrite), terminal agents (read/write the repo and run commands), cloud task runners (async independent tasks that emit change sets), and self-hosted frameworks (you control the model and runtime).
Compare these dimensions, not marketing copy:
- Context acquisition: can it retrieve relevant files by strategy instead of relying on paste?
- Execution permission granularity: can file writes and command execution be authorized in levels and logged?
- Change control: does it emit a reviewable minimal diff?
- Reproducibility: similar inputs, stable results; prompts and config versionable?
- Compliance and isolation: does code leave the environment, do secrets enter context, are audit logs complete?
4. Engineering: make specs executable assets
4.1 Organizing spec files
Split by “one capability, one spec.” Each should include goal, in-scope and out-of-scope, interface contracts, data and state, exceptions and boundaries, and executable acceptance criteria. Keep them in the same repo as the code so specs are reviewed with the change:
specs/user-auth.mdorder-state-machine.mdcontracts/auth.openapi.yaml
Acceptance criteria must be executable—for example, “invalid email returns 422 and does not write to the database,” not “validation should be thorough.”
4.2 Context engineering
Maintain a collaboration note at the repo root: stack versions, directory ownership, coding and commit conventions, forbidden actions, and verification commands, so every session does not re-explain the background. Task descriptions follow a four-part form: goal + constraints + files involved + done criteria. Open-ended questions invite scope drift.
4.3 Verification loop
Make verification part of the loop, not a late patch:
loop (at most N rounds):1 Read the spec and affected modules; list a change plan2 Generate a minimal change set3 Run static checks → unit tests → build4 On failure, return to step 2 with the full error output5 Emit the diff and change notes for human review
4.4 Security and permission baseline
Default to least privilege: do not paste real secrets or user data into prompts; run commands in an isolated environment; require human confirmation for new dependencies, network access, and production config changes; keep full operation logs for traceback. For data and compute, general cloud capabilities can host this work—for example object storage for artifacts, a container platform for isolated execution, and logging/monitoring to record and track task status. Platforms such as Baidu AI Cloud provide this kind of generic category capability; follow official documentation for configuration.
5. Metrics and anti-patterns
Do not measure “lines generated.” Measure first-pass change rate, rework rounds, review time share, escaped defects, and task lead time. If generation volume and review time both rise, specs and verification are missing.
Typical anti-patterns: treating chat history as the requirements doc; one commit that spans many modules; merging without verification; letting the model invent architecture; specs and implementation drifting until the docs are dead.
6. Rollout path
Phase 1: collaboration note and verification commands as a shared baseline. Phase 2: pilot spec-driven work on one well-bounded, well-tested module and capture templates. Phase 3: put spec review and automated verification into CI as a gate. Phase 4: scale to parallel modules and use metrics to refine spec granularity.
Closing: competitive AI programming is not who is better at tools; it is who cages uncertainty inside a spec. Paradigm sets the quality ceiling; verification sets the delivery floor. Together, the model becomes engineering capacity rather than a code generator.
