Skip to content

stephenli2000/Structured_Vibe_Coding

Repository files navigation


1. Philosophy: Structured Vibe Coding

This tool is designed for software engineers who feel better with a command-line interface.

  • Chat‑only workflow: AI changes lightning-fast; locking in to any model or tool is not good.
  • Requirements, design, and coding: AI is similar to a human; you will need to confirm at the requirements, design, and coding/test stages.
  • Git & diff: AI is similar to a human. We need to communicate with the AI using git history & diffs so it can reason over the exact context you see.

2. The Blueprint Method

If you are implementing large features, asking an AI to design architecture and write code at the same time can lead to hallucinations and context drift. For complex tasks, we recommend The Blueprint Method: a three-phase methodology that shifts AI from a guessing machine to a precise execution engine.

  • The Blueprint Method: A methodology to get confirmation at each step: requirement-design-coding. Humans and AI get on the same page fast, with minimal back‑and‑forth.

2.1. prerequisite

Move your design, requirement, and test documents into Markdown format in the repository if you have any.

VS Code is great for rendering Markdown into Word or Google Doc-like documents if you do the following:

  • Export Google Docs to HTML ZIP, then use PanDoc to convert the HTML into an md file.
pandoc GoogleDocExport.html --wrap=none --markdown-headings=atx -f html-native_divs-native_spans -t gfm-smart --extract-media=. -o CleanedExport.md
  • Use Mermaid sequenceDiagram to generate inline flow charts.
  • Use Mermaid graph TD for inline diagrams.
  • Use drawio for diagrams, then export to svg, and embed them inline in the md file.
  • GitHub Flavored Markdown (GFM) for tables.
  • Markdown All-in-one for section numbers and Table of Contents.

2.2. Align Requirement Between AI & Human

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

2.2.1. requirement_prompt.md

Audit this `requirement_prompt.md` for clarity, missing edge cases, and logical gaps. Rewrite it into strict Given-When-Then acceptance criteria and wait for my approval before writing code. Do not include details already implemented in the codebase in the `requirement_prompt.md`.

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

2.3. Co-Design Architecture with AI (Architecture Gate)

Have the AI map out how the requirements integrate into the codebase by updating your markdown design docs or Mermaid diagrams first.

2.3.1. design.md

Based on the approved `requirement_prompt.md` and the codebase context, update our design.md files. Then, generate a strict step-by-step `coding_prompt.md` for execution. Wait for my approval. Do not include details already implemented in the codebase in the `coding_prompt.md`.

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 & Test via Human Verification Gate

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

2.4.1. coding_prompt.md

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 tiny scripts package the right text or code so you can drop a single file or a folder or a type of files into a coding chat AI. No lock‑in to any AI model or tool.

3.1. Quick Start

python3 -m venv venv && source venv/bin/activate
# run any tool with: python3 <tool>.py [args]

If you are implementing small features, you don't need to use 'The Blueprint Method'. Start with the vibe tool

  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 with 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 (e.g., .py, .md, .json, etc.), skips noisy folders (.git/, node_modules/, dist/, etc.), and writes one bundle with headers per file.

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

Use it

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.

Use it

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 changed files for 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.

Use it

# 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 by file 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.

Use it

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. 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. concatenate_python_files.py ./tools ./tools/runner.pytools_concatenated.txt
  2. Attach; ask: “There’s a crash when input is empty. Fix and add doctests.”

4.3. Focused PR feedback

  1. 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

concatenate_text_files.py ./myapp --code-only → myapp_code.txt

Attach myapp_code.txt along with your requirement_prompt.md.

Follow the Phase 1, 2, and 3 prompts outlined in the Blueprint section above to design and execute without context drift.


5. FAQ

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

Does this include third‑party deps? No—these tools focus on your source and local imports. Mention external packages in your prompt or attach requirements.txt.


6. License & Contributions

Use at your own risk; PRs welcome. Keep changes tiny, logs clear, and defaults sensible.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages