From Q&A Assistants to Spec-Driven Coding: How AI Collaboration Actually Works

    Spec-driven coding is a collaboration model, not a product: you write verifiable specs first, then use AI tools to generate architecture, code, tests, and change notes. This article maps five collaboration levels from Q&A to terminal autonomy, what a spec should contain, and how repo gates, tests, and risk should decide how much you delegate.

    In many developers’ mental models, “using AI to write code” is reduced to which chat model or coding assistant to pick, and whether to pay for a stronger tier. That view stays at the tool layer and skips the real question: what contract do humans and models actually work under? Spec-driven coding (often called spec coding) feels unfamiliar not because it is technically hard, but because coverage is dominated by tool roundups and one-prompt-to-code demos.

    Spec-driven coding is a family of development practices, not a product name. Inline completion, conversational Q&A, and agent environments with plans, skills, and task breakdowns can all implement the same idea: write a verifiable specification first, then have the model generate architecture, code, tests, and change notes against it. Tools are the vehicle; specs, boundaries, and review are the mode.

    Why shift from “which tool” to a collaboration contract

    Classic delivery splits requirements, design review, coding, testing, and release across roles and stages. Large models compress those stages into one session. Speed goes up; accountability blurs. A vague one-liner lets the model invent architecture assumptions, dependencies, and security defaults. If those land in the repo unconfirmed, debugging often costs more than writing the code by hand.

    The core of spec-driven work is turning implicit assumptions into explicit clauses. A spec need not be a heavy requirements document, but it should cover business goals, input/output contracts, error handling, data bounds, non-functional constraints (performance, permissions, observability), and acceptance criteria. Generation then becomes something you can check, not a fragment that “looks like it runs.”

    In engineering governance, specs also: (1) break natural-language work into trackable steps you can interrupt; (2) give code review something to compare against besides style; (3) leave an audit trail—when something breaks, you check whether the spec was violated instead of arguing about what the model “meant.”

    Five collaboration levels: from assistive to autonomous

    These are not competing product lines. They are operating modes a team should switch among by risk.

    1. Q&A assistant: the model never touches the repo

    The common entry point. You ask; the model answers; you paste. Least privilege, low cognitive load—good for APIs, errors, and algorithm comparison. Context is fragmented, so advice goes stale or fights project style. Fine for learning and local questions, not as the main delivery path.

    2. Pair driving (Copilot-style): line-level suggestions and confirm loops

    The model proposes completions or rewrites in the editor; you accept, reject, or tweak. Granularity is “is this snippet right?” Boilerplate gets cheaper, but cross-file architecture, API consistency, and tests still need human watch. Without a spec, pairing becomes endless local patches: each yes/no optimizes near the cursor while the design drifts.

    3. Task-board driven (quest-style): features as pauseable steps

    Interaction moves from “accept this line” to “manage a task stream.” For “implement login,” the model should not dump all code. It should list trackable steps: user table and constraints, register/login APIs, token checks, frontend form and error states, tests and logs. Each step can be inspected, parameterized, paused, or rerun. Focus shifts to “where is the feature, and which acceptance item is blocked?”

    The board is a model-maintained checklist: visible and interruptible. For medium-complexity features this is often the best cost/benefit: generation speed with human gates.

    4. Full spec delegation (often nicknamed YOLO)

    You mainly supply the spec; the model designs, implements, tests, and even suggests deploy. Fast and dangerous. Use only when the environment is disposable, data is non-sensitive, and failure is cheap. Auth, money, personal data, or production config means outsourcing change control to an unaccountable generator. A safer industry pattern: let the model propose the full flow; merge and release still require human gates.

    5. Terminal autonomy: runtime privileges for the model

    The extreme of full delegation: the model may run commands, install dependencies, change config, start/stop services, operate the VCS, and trigger pipelines. In theory, “ship from one sentence.” In practice, attack surface and operator error both grow. Any write-capable automation needs command allowlists, secret isolation, change preview, mandatory review, one-click rollback, and full audit logs. Without those, it is incident rehearsal, not engineering capability.

    Distinguish vibe coding from spec-driven work. The former is a mood and a sentence; the model invents everything. The latter writes verifiable clauses first. The same coding tools can serve both; governance is not the same.

    What a spec should look like: from wish to acceptance

    Write executable specs as bullets, not prose, so models and reviewers align.

    • Goals and non-goals: what to do and what not to do, to stop scope creep.
    • Roles and permissions: who can call what; anonymous vs logged-in; whether admin is separate.
    • Data model: fields, constraints, index intent, encryption or redaction of sensitive fields.
    • API contracts: paths, methods, request/response examples, error-code meaning.
    • State and flow: success path, retries, idempotency, concurrency and locking.
    • Security: injection, session fixation, brute force, secret storage, log redaction.
    • Observability: key metrics, structured logs, tracing fields.
    • Acceptance: given inputs and expected outputs, coarse performance bars, regression scope.

    Sketch (login, structure only—not a vendor API):

    1. Goal: email+password login; issue short-lived access tokens and revocable refresh tokens.
    2. Non-goal: no third-party account linking this iteration.
    3. Failure: lock after a failure threshold; return a uniform error code; do not leak whether the account exists.
    4. Acceptance: wrong password must not mutate the user record; after refresh-token rotation, the old token is immediately invalid.

    With clauses like these, each task-board step maps to an acceptance item, and pair edits are less likely to sneak a “debug backdoor” onto main.

    Engineering support, not “better prompting”

    The mode runs on the repo and pipeline, not longer prompts.

    Repo: directories, style, commit messages, branching. Keep generated diffs small and reviewable; do not mix refactor, feature, and formatting in one commit.

    Quality gates: static analysis, unit and API tests, dependency and secret scanning. Turn spec acceptance into automated assertions, not “looks fine.”

    Environment split: strict separation of dev, staging, and production. If terminal autonomy exists, confine it to throwaway containers or clearly isolated experiments. Production changes go through review and release systems, not a chat window.

    Cloud capabilities as generic categories: object storage for static assets and backups, queues for notifications, containers for services, logs and monitoring for alerts. Which vendor you use does not change how you write the spec; it does change whether network policy, identity, and audit close the loop. If the team already uses infrastructure such as Baidu AI Cloud, put identity, network, and logging policy in the spec’s non-functional section instead of patching holes later.

    Human duties do not vanish: product owns the spec, engineering owns design tradeoffs, testing owns boundaries, operations owns the release window. Models can draft those documents; they cannot sign them.

    How to pick a level: risk and reversibility, not coolness

    Three simple rules.

    First, high reversibility and small blast radius (docs, internal scripts, prototype pages): pair driving or a short task board is fine. Second, identity, payments, privacy, or bulk delete: spec first, confirm stepwise on a task board, never terminal-attach production. Third, the less the team knows the domain, the lower the autonomy: models sound more confident on unfamiliar stacks and pick worse defaults.

    Common mistakes: treating a generated plan as a completed design review; treating generated tests as a test strategy (they often repeat happy paths and miss auth and concurrency); treating “it compiles” as “it can ship.” Spec-driven work exists to fix those mismatches.

    Summary

    Spec-driven coding is not “which assistant tier.” It is how you write the contract between people and models, and where the gates sit. Q&A is for unblocking. Pairing is for local speed. Task boards split features into pauseable steps. Full delegation and terminal autonomy belong in strongly isolated experiments. Write goals, contracts, security, and acceptance as bullets, then attach tests, permissions, and audit. Intelligent coding then converges from vibe and velocity into repeatable engineering. Individuals should practice writing requirements clearly; teams should put model output through the same quality gates as human commits. Tools will change; contracts and boundaries are the asset you can accumulate.