{"slug": "terraform-for-ai-generated-code", "title": "Terraform for AI generated code", "summary": "A developer released speccraft, an open-source Claude Code plugin that enforces a spec-first, test-driven development workflow for AI-generated code. The plugin requires every change to start with a versioned spec, blocks code edits unless corresponding tests are written first, and auto-injects project memory into each session. It also supports cross-model spec review and delegation of tasks to auxiliary agents like Codex or Gemini.", "body_md": "Over the past few weeks I've written about the workflows I developed building production systems with AI: spec-driven development, manual RAG, grounding models against hallucinations, the Terraform discipline of plan-before-apply, and what happens when you skip all of that and vibe-code your way into a mess you can't undo.\n\nEvery post in this series was pointing at the same thing.\n\nToday I'm sharing it.\n\n**Introducing speccraft: a Claude Code plugin for spec-first, test-driven AI development.**\n\nThe one-line description from the README says it better than I can:\n\n*Terraform for AI-generated code. Versioned intent. Auto-injected memory. Cross-model review. Hook-enforced TDD.*\n\nHere's what it actually does, in plain terms.\n\n**Every change starts with a spec.** /spec:new interviews you Socratically (why, what, acceptance criteria_ and writes a versioned spec file directly into your repository. Not a chat artifact. Not a prompt you'll lose at the end of the session. A durable, committed, reviewable document that defines exactly what is about to change before implementation begins.\n\nThe spec is the contract. Committing it to the repo makes that contract real.\n\n**The spec gets reviewed before code is written.** /spec:review routes the spec to auxiliary agents (Codex, Gemini, OpenCode, or a Claude subagent running a critic persona) in parallel, and synthesizes the verdicts. Ambiguity, missing edge cases, untestable criteria: these surface at the spec stage, not after the implementation is already tangled across six files.\n\n**Implementation is test-first. Not by convention. By enforcement.**\n\nA hook intercepts every edit to a production file. If no sibling test file was edited more recently in the same session, the edit is blocked.\n\nNot warned. Blocked.\n\nNow, I know what you're thinking. We've all tried the \"make no mistakes\" prompt. We've all been let down.\n\nTurns out it does work, you just have to enforce it with a hook, not a prompt.\n\nSpeccraft is how \"write tests first\" stops being advice and starts being a hard constraint. The model cannot skip the RED step and go straight to GREEN. You can override it (one-time, with a reason that gets logged) but you can't ignore it. The discipline is architectural, not aspirational.\n\n**The repo carries its own memory.** A small .speccraft/index.md (guardrails, architecture decisions, conventions) is auto-injected at every session start. The model always knows the rules of this codebase. Not because you remembered to paste them in. Because the plugin handles it.\n\n**Heavy work is delegated to auxiliary agents.** /spec:delegate codex \"Generate table-driven tests for internal/health/handler.go\": Codex or other agent runs the task, speccraft synthesizes the result. The right model for the right job, orchestrated from a single workflow.\n\nEverything in this series (the Kubernetes Operator built in two weeks, the manual RAG sessions, the hallucination loops, the race condition the model confidently couldn't fix, the Terraform analogy, the vibe-coding mess I couldn't undo), all of it was pointing at the same underlying problem.\n\nAI-assisted development is genuinely powerful. But left undisciplined, it amplifies ambition faster than it delivers correctness. Specs drift from implementations. Memory resets between sessions. Reviews are single-model and single-perspective. Tests get written after the fact, if at all.\n\nSpeccraft is the workflow I needed to build the things I was building and couldn't find anywhere else.\n\nSo I built it.\n\nIt's open source. MIT licensed. Currently Go-first, with Python support already in and more languages on the roadmap.\n\nIf you've been building with Claude Code and hitting the same walls, link in the comments.\n\n👉 [github.com/DCSTOLF/speccraft](https://github.com/DCSTOLF/speccraft)\n\n*What would you add to a workflow like this? What's the discipline you keep having to re-enforce manually?*", "url": "https://wpnews.pro/news/terraform-for-ai-generated-code", "canonical_source": "https://dev.to/dcstolf/terraform-for-ai-generated-code-4bk", "published_at": "2026-06-15 03:00:00+00:00", "updated_at": "2026-06-15 03:11:08.885270+00:00", "lang": "en", "topics": ["developer-tools", "large-language-models", "generative-ai", "ai-agents", "ai-products"], "entities": ["speccraft", "Claude Code", "Codex", "Gemini", "OpenCode", "Claude", "MIT", "GitHub"], "alternates": {"html": "https://wpnews.pro/news/terraform-for-ai-generated-code", "markdown": "https://wpnews.pro/news/terraform-for-ai-generated-code.md", "text": "https://wpnews.pro/news/terraform-for-ai-generated-code.txt", "jsonld": "https://wpnews.pro/news/terraform-for-ai-generated-code.jsonld"}}