AI-powered software development is changing the way we code. In this guide, I’ll show you how to build your first complete C# API application—including a SQL backend and unit tests—without writing any code yourself. Using a “vibe coding” approach, we’ll let an AI agent powered by GitHub Copilot turn plain English prompts into working software, streamlining development for demos, prototypes, and learning.

Plus, I’m using all free accounts and components for this demo (at the time of recording), so anyone can follow along!

1. What Is Vibe Coding?

Vibe coding involves building applications using AI, allowing tools like GitHub Copilot to generate code based on your instructions. Instead of traditional coding, you:

  • Write high-level requirements in plain English

  • Use AI to generate, review, and debug code

  • Quickly iterate and improve your application

It’s a practical way to accelerate development, especially for new ideas and prototypes.

2. Setting Up Your Environment

To get started, you’ll need:

  • VS Code (with C# and Copilot extensions)

  • .NET 8 SDK

  • SQL Server 2022 Developer Edition (for this demo)

  • A free GitHub account (for Copilot Agent Mode)

  • Optional: Postman for API testing

Enable the experimental Chat Tools setting in Copilot Chat for smooth, automated execution of agent tasks.

VS Code Setting Auto Approve


VS Code Setting Auto Approve

3. Writing Your First Prompt

Start with a clear English prompt that explains your requirements:

  • What the API should do (e.g., manage a deck of playing cards)

  • Backend needs (e.g., SQL database for card state)

  • Any extra requirements (unit tests, Postman collection)

Don’t expect perfection on the first run—AI outputs can vary, and you may need several iterations to get it right. Refine prompts based on the results, and consider using both Gemini and ChatGPT for enhanced prompts.

Below, you can find my first pass prompt, which I started with, and the final prompt used in the YouTube Video that was enhanced using ChatGPT 4.1.

4. Letting AI Generate and Troubleshoot Code

  • Paste your prompt into Copilot Agent Mode and review the AI-generated plan.

  • Approve the plan and let the agent build out the project structure, API endpoints, SQL scripts, and tests.

  • Use the auto-approve setting for smoother demo execution, but review steps carefully for production use.

  • When issues arise (e.g., build errors, 404 responses), ask the AI to review and fix the code. The agent can typically identify and resolve common issues automatically.

5. Testing and Validating Your Application

  • Import the AI-generated Postman collection to test your new API endpoints.

  • Run included unit tests to validate functionality.

  • Use the SQL backend to verify that card data is stored and managed correctly.

  • Iterate by adding or adjusting prompts for additional features or more robust testing.

First Pass AI Agent Promot

I want to create a API application to simulate a deck of cards. This will use C# and MS SQL running in a SQL database.  Create a new solution folder called DeckOfCards.  Build an outline to create this application.  Let me review the outline before starting to build the code.  

When building the code, if you cannot complete a task, stop and outline the issue.

Create the SQL Data Model
I want to build an MS SQL Data model for handling a deck of cards.  This will use a database called DeckOfCards that is running locally.  This data model needs to support tracking cards for each unique deck of cards being used.  It needs to support getting a new deck of cards, returning a specific number of cards from a particular deck (drawing cards), and listing all cards not used for a specific deck.  

Return detailed error information to the caller.

Ensure to follow SQL Best Practices to create the data model, stored procedures, and name all artifacts.  

Create API Layer
Create a new project for the API application with three methods.  Ensure to create a unit test for each process that is called via the API.  Also, generate unit tests for each stored procedure in the data model.  

Create these methods using C#.  Inside each method create the data layer to connect to SQL.  

Use async, connection string, and follow .NET best practices.

Let's Play Cards AI Agent Prompt using ChatGPT 4.1

## AI Agent Prompt: Deck of Cards API with .NET 8 and MS SQL

**Objective:**
Build a .NET 8 API application (C#) that simulates a deck of cards, using a local MS SQL database for persistence. The solution folder should be named `DeckOfCards`. Before coding, generate and present a detailed project outline for review and approval.  Once the plan is approved, do not request additional approvals. Proceed to create all required items without interruption, unless an explicit approval is essential for compliance or technical reasons. This ensures a smooth, uninterrupted workflow.

---

### 1. Project Outline

* Create an outline detailing each step to build the application, covering data modeling, API design, error handling, and testing.
* Pause and present the outline for approval before proceeding. No further review is required after approval.
* If you encounter any blocking issues during implementation, stop and document the issue for review.

---

### 2. SQL Data Model

* Design an MS SQL data model to manage multiple unique decks of cards within a `DeckOfCards` database (running locally).
* The model must support:

  * Tracking cards for each unique deck.
  * Creating a new deck (with a Deck ID as a GUID string without dashes).
  * Drawing a specified number of cards from a deck.
  * Listing all unused cards for a given deck, with a count of remaining cards.
* Treat Deck IDs as strings at all times.
* Define any variables within the relevant stored procedure.
* Enforce robust error handling for cases such as invalid Deck IDs or attempts to draw more cards than remain.
* Return detailed error messages to the API caller.
* Apply SQL best practices in naming, procedure structure, and artifact organization.
* Atomatically create and deploy the database and scripts using the local SQL server. Create the database called DeckOfCards in Server Localhost, then create the tables and procedures.  Otherwise, provide a PowerShell script to fully create the database, tables, and procedures.


---

### 3. API Layer

* Create a new API project with the following endpoints, each with comprehensive unit tests (covering both positive and negative scenarios) and proper exception handling:

  * **NewDeck** (GET): Returns a new DeckGuid (GUID string without dashes).
  * **DrawCards** (POST):

    * Inputs: DeckGuid and NumberOfCards as query parameters.
    * Output: JSON array of randomly drawn cards for the specified deck.
  * **CardsUsed** (GET):

    * Input: DeckGuid as a query parameter.
    * Output: JSON array of cards remaining in the deck, including the count of cards left.
* Implement the API using C#, connecting to SQL in the data layer for each method.
* Inside the Tests project, generate unit tests for each stored procedure
    * Make sure to check for running out of cards, not able to draw anymore cards, and invaid Deck ID.  Create a case for each of these.
* Inside the Tests project, generate unit tests for each API methods.

---

### 4. Application Configuration and Best Practices

* Update the `.http` file to document the three new APIs. Remove any references to the default WeatherForecast API.
* Ensure the APIs are configured to run on HTTP port 5000. Include a correct `launchSettings.json` file.
* Update `Program.cs` for the new API, removing all WeatherForecast-related code.
* Use asynchronous programming (`async/await`), store connection strings securely, and follow .NET and C# best practices throughout.

---

**Note:**
If you cannot complete a step (such as database deployment), clearly document the issue and provide a workaround or an alternative script (e.g., PowerShell for setup).
Once complete, run all unit tests to ensure everything is working.  
Postman will be used for testing.  Provide a inport file to be used with PostMan to test each of the three APIs.  Ensure to use the HTTP endpoint.

Please take a look at my YouTube video that walks through this demo step by step.

YouTube player

Conclusion & Next Steps

Vibe coding with AI agents transforms how developers can approach rapid prototyping and demo applications. While not yet ready for production deployment without expert review, this method accelerates learning and experimentation. With tools like Copilot Agent Mode, building a C# API app is now a matter of describing what you want in plain English.

Call to Action:
Ready to try vibe coding? Start with your own prompt and share what your are building!