Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

How spec-driven development improves AI coding quality

Code with precision, not vibes

October 22, 2025
Rich Naszcyniec
Related topics:
Artificial intelligenceDeveloper productivity
Related products:
Red Hat AI

    Imagine you're a maestro standing before a grand orchestra, baton in hand, ready to weave a symphony from chaos. Now picture a lively jazz jam session where musicians riff off each other's vibes, creating magic on the fly—but sometimes, they hit a sour note. That's the whimsical world of AI-assisted coding.

    AI coding assistants are like those talented musicians, helping us build solutions quickly. But relying solely on impromptu interactions ("vibe coding") can lead to brilliant bursts of creativity mixed with brittle code that might crumble under pressure.

    Enter spec coding, where you, the human conductor, lay out a clear score (specifications) to guide the AI ensemble toward harmonious, reliable results. This smart, structured collaboration keeps humans firmly in control. If you're wondering how to maximize the efficiency of your AI tools without sacrificing quality, keep reading. This approach isn't about ditching the fun; it's about making the music last.

    The vibes and specs of AI coding

    Let's start with vibe coding, the free-spirited pioneer of AI-assisted development. Picture this: You're knee-deep in a project, chatting back and forth with your AI buddy, one prompt at a time. "Hey, add this feature," you say, and poof, code appears. It's iterative, interactive, and a blast for quick prototypes or brainstorming. Many of us discovered the power of AI coding this way, and it's still the go-to approach for countless developers.

    But while vibe coding shines in its flexibility, those ad-hoc exchanges can result in code that's speedy but not always sturdy. Think of it as a jazz improv that thrills in the moment but might not hold up for a full concert tour.

    On the flip side, spec coding (short for specification coding) puts specifications first. It's like drafting a detailed blueprint before building your dream house, ensuring every nail and beam aligns perfectly. Here, humans define the "what" (the functional goals of the code) and the "how" (rules like standards, architecture, and best practices), while the AI handles the heavy lifting (code generation).

    You can mix and match specs for different projects, languages, or even teams, turning one-off efforts into reusable symphonies. This approach improves developer productivity without skimping on quality. Stakeholders get involved early through clear functional specs, which cuts down the time-to-value and makes your AI investments sing with better ROI.

    The goal: Precision meets playfulness

    At its core, spec coding aims for orchestral precision: Think 95% or higher accuracy in implementing specs on the first go, with code that's error-free and unit tested. Humans craft the "what," focusing on user stories or natural-language descriptions of desired outcomes, while setting "how" guardrails for everything from security to deployment. This empowers AI with context so it generates code that adheres to corporate standards, like using specific APIs or testing frameworks.

    Multiple "how" specs can play together harmoniously—say, one for architecture, another for documentation, and others for testing or security. Keep the specs scoped tightly to avoid overlap, and voilà: Your AI can generate code in a mix of programming languages, all while learning from past hiccups via a "lessons learned" file. This feedback loop is valuable and reduces AI coding agent errors over time. In a business context, it democratizes AI coding, pulling in diverse stakeholders and accelerating AI-infused applications. More brains (human and silicon) equal faster innovation and smarter resource use.

    How to get started with spec coding

    Ready to conduct? There's no one-size-fits-all workflow yet, though tools like Kiro and GitHub's spec-kit are tuning up. In the meantime, here's a simple yet practical guide to kick things off with any AI coding assistant.

    Crafting your specifications

    First, compose your functional spec. This is the "what" melody, pure and without requiring knowledge of a programming language. Use user stories like "As a user, I want to have the CRM system automatically make updates when I state activities such as: “I just had a meeting with Rich Naszcyniec at MegaCorp and we discussed the Red Hat AI Platform." Keep it in natural language for easy reading. After all, specs should invite collaboration.

    Pro tip: Enlist AI for "vibe spec-ing," that playful back-and-forth to draft or even reverse-engineer specs from existing code. A general-purpose language model works well here. It's like jamming with a friend to outline your hit song before recording.

    Add language-agnostic specifications

    Next, layer in the programming language-agnostic "how": Define data structures, component contracts, architecture (for example, "Use REST for all exposed APIs"), security, and so on. This helps keep things flexible, letting you swap and mix programming languages without rewriting the core tune.Fine-tune with language-specific details

    Then, fine-tune with language-specific specs. For each language, detail versions, features, and preferences (for example, "Stick to Swift 6.2 toolchain, fallback to 6.1"). Don't forget testing: Specify frameworks, scopes, and how tests self-correct code. AI often resolves bugs on round two thanks to this.

    Specify documentation and granular rules

    Documentation gets its own spec, too: Outline READMEs, architecture overviews, or language quirks (for example, "Use Apple's DocC for Swift"). Architecture specs can get granular, like mandating packages such as your favorite open source project for OpenAI calls while letting AI choose other implementations for all other REST calls.

    Run the code generation prompt

    With specs in hand, it's showtime for code generation. Set up a project folder, tuck your specifications into a specs subfolder, and prompt your AI:

    Using the Specs folder, generate Swift code that implements the code required to meet all specification requirements. Code generation isn’t complete until the code compiles error-free and passes all unit tests. As coding errors are corrected, log those errors and fixes in a file named LessonsLearned.md in the specs folder. Whenever you encounter an error that needs to be fixed, check the lessons learned file to see if you already know how to fix it.

    Then sit back and watch as AI iterates, fixing errors and building a knowledge base. This structured flow cuts development time, boosting utility from your infrastructure and improving ROI.

    Review, refine, and remix

    No performance is perfect without rehearsal. AI handles initial reviews to ensure compilation and unit tests pass, but humans take the spotlight for validation: Test functionality, assess quality, and ensure maintainability. It's your chance to applaud or tweak.

    Need application code corrections? Options abound in this ongoing debate. Purists regenerate all code from updated specs, keeping them as the ultimate truth (great for consistency, but resource-hungry). Others treat AI-generated code as a draft, hand-editing for familiarity (upside: deeper understanding; downside: specs drift if not synced). Or vibe it out with interactive sessions where AI proposes changes, you approve, and lessons get logged, blending human insight with AI speed.

    Post-project, tune up those specs. Review your AI lessons learned to tune up your specifications (AI can help here, too), and roll reusable "how" specifications to your next gig. Over time, your spec library becomes a greatest-hits album, refining with each project. This iterative polish means progressively faster cycles, more AI-powered solutions, and stakeholders beaming at the efficiency.

    Wrapping the encore: Why spec coding hits the high notes

    Spec coding transforms AI from a solo act into a full orchestra under your baton, delivering robust, scalable code with human ingenuity at the helm. By adding specifications to your workflow, you don't just coding faster; you build smarter. This leads to results like better team productivity, wider collaboration, and a higher return on investment from your AI tools.

    Ready to grab the baton? Experiment with spec coding on a simple application and witness the difference. Or, for a fun challenge, time a vibe-coded version versus a spec-coded one. You'll likely see the efficiency increase.

    • I’ve published two open source spec projects on GitHub that help simplify infusing AI into applications using OpenAI-compatible endpoints like those available using vLLM in Red Hat AI.
      • SwiftChatCompletionsDSL for using OpenAI-compatible chat completions endpoints.
      • SwiftResponsesDSL for using OpenAI-compatible responses endpoints.
    • Learn how Red Hat is leveraging coding agents in our AI projects in Chris Wright's post AI-assisted development: Supercharging the open source way.
    • Finally, if you're going to accelerate application development with AI, and produce more AI infused applications, you need a plan. Take a look at the article Building an adaptable enterprise: A guide to AI readiness by Mike Ferris for four strategies to build an adaptable enterprise.
    Last updated: October 27, 2025

    Related Posts

    • Open source AI coding assistance with the Granite models

    • Retrieval-augmented generation with Llama Stack and Python

    • Integrate a private AI coding assistant into your CDE using Ollama, Continue, and OpenShift Dev Spaces

    • How to enable Ansible Lightspeed intelligent assistant

    • How to run AI models in cloud development environments

    • How to integrate vLLM inference into your macOS and iOS apps

    Recent Posts

    • Red Hat Hardened Images: Top 5 benefits for software developers

    • How EvalHub manages two-layer Kubernetes control planes

    • Tekton joins the CNCF as an incubating project

    • Federated identity across the hybrid cloud using zero trust workload identity manager

    • Confidential virtual machine storage attack scenarios

    What’s up next?

    Learn how to set up a cloud development environment (CDE) using Ollama, Continue, Llama3, and Starcoder2 LLMs with OpenShift Dev Spaces for faster, more efficient coding.

    Start the activity
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.