Skip to content

stephenli2000/Structured_Vibe_Coding

Repository files navigation

Repository: https://github.com/stephenli2000/Structured_Vibe_Coding
License: BSD. Use at your own risk; PRs welcome. Keep changes tiny, logs clear, and defaults sensible.

Author's experience:

Using this methodology, I've generated 99% of production code with Claude, Gemini, and GPT — across both small features and large complex tasks — over the past 1.5 years, on a monthly subscription budget of $20–$60. My background: decades in C/C++, Linux, Git, Python, and AI.


1. Philosophy: Structured Vibe Coding

This toolkit is for software engineers comfortable with the command line.

  • Chat-only workflow: AI is changing fast — don't lock yourself in to any one model or tool.
  • Requirements, design, and coding: Have AI confirm each stage before moving to the next.
  • Git and diff: Communicate with the AI through git history and diffs so it can reason over the exact context you see.

For small features, you don't need the Blueprint Method — jump straight to Vibe Coding Tools.

For larger features, asking an AI to design architecture and write code at the same time often leads to hallucinations and context drift. Use The Blueprint Method: a three-phase methodology that shifts AI from a guessing machine to a precise execution engine.

1.1. Who is this for?

  • Minimize cost. Flat-rate chat subscriptions instead of token-metered agentic tools — predictable spend for solo developers, students, contractors, and small teams.
  • Switch models freely. The same text bundle drops into any chat — Private AI (self-hosted Llama, DeepSeek, Qwen), Claude, GPT, Gemini — so you pick the best model per task without changing tools.
  • Learn a portable discipline. The Blueprint Method (requirements → design → code, with verification gates) outlives any specific tool or model.

2. The Blueprint Method

A methodology that gets explicit confirmation at each step: requirements → design → coding. Humans and AI stay aligned without rework or context drift.

2.1. Prerequisites

Move your design, requirement, and test documents into Markdown format, DESIGN.md in the repository.

VS Code, with a few extensions, gives you a Word/Google Docs-like editing experience for Markdown:

  • Export Google Docs to HTML ZIP, then convert the HTML into Markdown with Pandoc:
    pandoc GoogleDocExport.html --wrap=none --markdown-headings=atx -f html-native_divs-native_spans -t gfm-smart --extract-media=. -o CleanedDocExport.md
    
  • Use Mermaid sequenceDiagram for inline interaction sequences.
  • Use Mermaid graph TD for inline flowcharts and architecture diagrams.
  • Use drawio for diagrams, then export to SVG and embed inline in your Markdown.
  • Use GitHub Flavored Markdown (GFM) for tables.
  • Use the Markdown All-in-One extension for section numbering and the Table of Contents.

2.2. Align Requirements Between AI and Human

Feed the AI your change request and ask it to audit for edge cases before any code is written.

2.2.1. change_request_prompt.md

Audit change_request_prompt.md for clarity, missing edge cases, and logical gaps. Rewrite it into strict Given-When-Then acceptance criteria, and propose updates to change_request_prompt.md reflecting the new scope. Wait for my approval before writing any code. Do not include details already implemented in the codebase.

The Ground Truth Principle: Treat the codebase as the absolute source of truth. Markdown design files are historic intent. If they clash, the code wins.

2.3. Co-Design with AI

Have the AI map out how the change request integrates into the codebase by updating your design docs (DESIGN.md or any Mermaid diagrams).

2.3.1. DESIGN.md & coding_prompt.md

Based on the approved change_request_prompt.md and the codebase context, update DESIGN.md. Wait for my approval. Then generate a strict step-by-step coding_prompt.md for execution. Wait for my approval. Do not include in coding_prompt.md any details already implemented in the codebase.

The Ground Truth Principle: Treat your codebase as the absolute source of truth. Design docs are historic intent. If they clash, the code wins.

2.4. Code and Test with Human Verification

Feed the AI the generated coding_prompt.md and force it to code incrementally.

2.4.1. Code and Tests

Execute step 1 of the coding_prompt.md. Write complete, production-ready code with no placeholders. Stop and wait for me to verify the tests pass before moving to step 2.


3. Vibe Coding Tools

Keep it simple. These small scripts package the right text or code so you can drop a file, folder, or file type into a chat-based AI. No lock-in to any model or tool.

3.1. Quick Start

python3 -m venv venv && source venv/bin/activate
# run any tool with: python3 <tool>.py [args]
  1. Run a tool below to generate a single text file.
  2. Attach or paste that file into your coding chat.
  3. Prompt the AI for what you want — review, refactor, tests, bug fix, or a Blueprint Method phase.

3.2. concatenate_text_files.py

Snapshot all text files in a repo.

What: Recursively collects text-like files (.py, .md, .json, etc.), skips noisy folders (.git/, node_modules/, dist/, etc.), and writes one bundle with a header per file.

Why: Share the whole project context in chat without zipping.

Usage:

python3 concatenate_text_files.py path/to/project
# → creates ./<project>.txt containing all included files with headers

The script supports --code-only and --py-only options to reduce the number of files included in the package.


3.3. concatenate_python_files.py

Bundle a script plus its local imports.

What: Traces local Python imports starting from one or more entry scripts and concatenates those files into a single text artifact.

Why: Give AI the exact Python dependency closure it needs for reasoning, without external packages.

Usage:

python3 concatenate_python_files.py project_root/ path/to/main.py [another.py ...]
# → writes project_root_concatenated.txt

3.4. save_commits.py

Package the files changed in a commit or range.

What: Finds files changed in one commit (or between two commits) and writes their contents to a single text file with commit headers.

Why: Share focused diffs for targeted reviews or debugging.

Usage:

# Single commit
python3 save_commits.py --this f9e8d7c

# Range (base..this)
python3 save_commits.py --base a1b2c3d --this f9e8d7c
# → writes <this>.txt or base-this.txt

3.5. analyze_folder.py

Quick repo inventory.

What: Scans a directory, groups files by type, totals sizes, and shows a small table (count, total size, example largest file). No bundle output — just fast insight.

Why: Decide what to package (and what to ignore) before chatting.

Usage:

python3 analyze_folder.py              # analyze current folder
python3 analyze_folder.py path/to/dir  # analyze a specific directory

4. Workflow Examples

4.1. Whole-project review

  1. python3 concatenate_text_files.py ./myappmyapp.txt
  2. Attach myapp.txt in chat.
  3. Ask: "Review for structure, add tests for X, and propose a minimal refactor."

4.2. Python bug fix in a small tool

  1. python3 concatenate_python_files.py ./tools ./tools/runner.pytools_concatenated.txt
  2. Attach; ask: "There's a crash when input is empty. Fix it and add doctests."

4.3. Focused PR feedback

  1. python3 save_commits.py --base abc123 --this def456abc123-def456.txt
  2. Attach; ask: "Explain risk, edge cases, and missing tests in this change."

4.4. The Blueprint Method

  1. python3 concatenate_text_files.py ./myapp --code-onlymyapp_code.txt
  2. Attach myapp_code.txt along with your requirement_prompt.md.
  3. Follow the prompts in Section The Blueprint Method to design and execute without context drift.

5. FAQ

Why text instead of zip? Text is immediately visible and searchable in chat, avoids unzip friction, and keeps you and the AI tightly in sync.

Does this include third-party dependencies? No — these tools focus on your source and local imports. Mention external packages in your prompt or attach your change_request_prompt.md.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages