From Vibe Coding to Harness Engineering and Spec-Driven Development: A Full-Stack Practice Guide

    This article examines why ad-hoc AI-assisted coding struggles to support real delivery and explains how Harness Engineering and Spec-Driven Development (SDD) address that gap. It covers reusable principles for setting up a controlled environment around AI coding tools, writing machine-verifiable acceptance criteria, and two practical examples—an AI data-query platform and a document-compliance platform. It also lists common anti-patterns and a phased approach for teams to adopt these practices.

    1. The Starting Problem: Why “Conversational Coding” Can’t Support Real Delivery

    Over the past two years, generative AI has moved into the software development workflow, giving rise to a way of working commonly known as Vibe Coding: developers describe their intent in natural language, an AI coding tool directly produces runnable code, and the human only adds follow-up prompts when the output falls short. This approach is extremely efficient in low-risk scenarios such as prototype validation, scripting, and UI drafts, but it has three structural weaknesses.

    First, intent is not traceable. Requirements are scattered across the conversation as context—no versioning, no review, no baseline—so the team cannot answer “why is this logic written this way?” Second, constraints are not enforceable. Requirements like “validate all inputs,” “exceptions must be observable,” or “data access must go through a unified gateway” tend to be forgotten by the model in long contexts when they exist only inside prompts. Third, quality is not measurable. Without testing and static analysis as gates, defects in generated code flow straight into the main branch.

    Moving from Vibe Coding toward engineering maturity is therefore not about adopting a cleverer conversational technique. It is about upgrading “uncontrolled natural-language collaboration” into “verifiable specifications and executable guardrails.” This is exactly the problem that Harness Engineering and Spec-Driven Development aim to solve.

    2. Concept Alignment: Precise Definitions of Three Key Terms

    Vibe Coding refers to an exploratory development mode in which natural language is the primary interface, immediate feedback drives the process, and human fallback provides the quality guarantee. It suits tasks with high uncertainty and short lifecycles.

    Harness Engineering refers to the practice of building a “runtime harness” for the AI coding process, including context supply, tool permissions, execution sandboxes, automated validation, and observable feedback. It cares not about how smart the model is, but about what environment the model works in.

    Spec-Driven Development (SDD) refers to producing a structured specification first—requirements, interface contracts, data models, and acceptance criteria—then driving implementation and testing from that specification, with the human responsible for spec quality and final decisions. It turns “writing code” into “stating clearly what you want and letting machines verifyably satisfy it.”

    The relationship among the three is progressive rather than substitutive: Vibe Coding provides exploration speed, SDD provides intent certainty, and Harness provides execution certainty.

    3. Environment Setup: Placing AI Coding Tools Inside a Controlled Harness

    Regardless of which AI coding assistant or command-line agent you use, the reusable setup principles are the same.

    1. Repository as context. Use a concise project description file to document the tech stack, directory conventions, commit rules, and forbidden actions, so you don’t repeat this information in every conversation.
    2. Least privilege. Grant permissions to write files, execute commands, and access the network according to task level; high-risk operations require explicit confirmation.
    3. Sandboxing and rollback. Run inside a container or on a dedicated working branch so any generated output can be discarded with a single action.
    4. Automated validation. Chain formatting, static analysis, unit tests, and type checks into one command that serves as the sole definition of “done.”
    5. Observable feedback. Preserve execution logs and failure summaries so the model can self-correct based on real errors, instead of relying on humans to copy and paste.

    A minimal example of a validation entry point:

    1. # Unified quality gate: any output must pass all checks to be considered done
    2. task verify # runs fmt -> lint -> typecheck -> test in sequence

    Once this command reliably exists, the behavior of an AI coding tool shifts from “submit when writing is finished” to “submit only when standards are met”—the key turning point at which efficiency and quality improve at the same time.

    4. Specs First: Writing Machine-Executable Acceptance Criteria

    The success of SDD depends on spec quality. A sound spec typically has four parts: goals and boundaries, data and interface contracts, exception and degradation strategies, and an acceptance checklist. The acceptance checklist must be decidable—avoid unverifiable statements such as “good performance” or “smooth experience.”

    1. ## Spec: Document Ingestion
    2. - Goal: Support uploading documents and generating searchable entries; online preview and editing are excluded.
    3. - Contract: POST /documents, inputs file and tags; returns id and status.
    4. - Exceptions: Unsupported format returns 415; exceeding limits returns 413; a parse failure moves to failed status with the reason retained.
    5. - Acceptance:
    6. 1) Uploading a 10MB text document returns 201 and becomes searchable;
    7. 2) Uploading an invalid format returns 415 and does not persist to the database;
    8. 3) A parsing exception is reflected in queryable status within 3 seconds.

    The value of a spec is that it serves simultaneously as the task brief, the source of test cases, and the review artifact. Reviewing a spec costs far less than reviewing an implementation.

    5. Practice One: Full-Stack Implementation of an AI Data-Query Platform

    Goal: Users ask questions in natural language, and the system returns query results and charts, with the query scope constrained by permissions.

    Layered design: the access layer handles authentication and rate limiting; the semantic layer parses the question into a constrained structured query; the execution layer retrieves data through a unified data-access service; and the presentation layer handles charts and explanatory text.

    Key engineering constraints: the semantic layer is only allowed to produce query structures within a whitelist and must not concatenate arbitrary statements; every query must carry tenant and permission filters; questions that cannot be parsed return a clarification prompt rather than a guess.

    1. {
    2. "metric": "monthly_active_users",
    3. "dimension": ["region"],
    4. "filters": [{"field": "tenant_id", "op": "=", "value": "t_01"}],
    5. "limit": 100
    6. }

    Acceptance focuses include: unauthorized queries must be rejected; empty results must produce a clear message; slow queries must have timeout and degradation paths. Writing these three items into the spec significantly reduces the rework rate of generated code.

    6. Practice Two: Extending a Document-Compliance Platform

    Goal: Add compliance-checking capabilities to an existing platform, output issue locations and remediation suggestions, and preserve a complete audit trail.

    The transformation strategy uses the Strangler Pattern: add a sidecar service to handle compliance checks, route traffic through a unified gateway, and progressively replace the old path, avoiding the uncontrollable risk of a one-time rewrite.

    Core design: rules are described in configuration and support versioning; each check generates an immutable report recording the rule version, an input digest, and the conclusion; human review conclusions are written back to form a closed-loop sample set.

    1. rule: sensitive_info_present
    2. version: 3
    3. severity: high
    4. action: block
    5. evidence: ["page", "offset", "snippet_hash"]

    The engineering focus is “reproducible evidence”: reports store only digests and hashes, not original content; rule changes go through review and can be rolled back; audit logs are sent to a centralized logging service with alerting configured.

    7. Common Anti-Patterns and Recommendations for Team Adoption

    Anti-patterns include: treating prompts as requirements documents; skipping specs and generating code directly; letting the model decide architecture layers on its own; substituting “it looks like it runs” for quality gates; and running large-scale experimentation on the main branch.

    Adoption recommendations follow three steps: first, pilot SDD and quality gates in low-risk modules to build templates; second, bake the validation commands and spec templates into the repository as the team’s default process; third, allocate the degree of automation according to each module’s risk level, keeping manual review and stricter permission boundaries on core paths. For metrics, focus on rework rate, defect escape rate, and review duration, rather than simply counting lines of generated code.

    The conclusion is clear: the next stage of competitiveness in AI-assisted programming does not belong to those who write more clever prompts, but to those who build more solid specs, guardrails, and feedback loops. When the environment is sufficiently controlled, the spec is sufficiently clear, and validation is sufficiently automated, AI can shift from “rapidly producing drafts” to “reliably delivering software.”