Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions architectures/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,22 @@ Don't know where to start? Here are a few golden rules:
---
## 🗺️ Map of Patterns

- [Agentic Architecture (AI Agent Orchestration)](./agentic-architecture/readme.md)
- [Backend-For-Frontend (BFF)](./backend-for-frontend/readme.md)
- [Clean Architecture](./clean-architecture/readme.md)
- [CQRS](./cqrs/readme.md)
- [Clean Architecture](./clean-architecture/readme.md)
- [Domain-Driven Design (DDD)](./domain-driven-design/readme.md)
- [Event-Driven Architecture (EDA)](./event-driven-architecture/readme.md)
- [Event Sourcing](./event-sourcing/readme.md)
- [Event-Driven Architecture (EDA)](./event-driven-architecture/readme.md)
- [Feature-Sliced Design (FSD)](./feature-sliced-design/readme.md)
- [Hexagonal Architecture](./hexagonal-architecture/readme.md)
- [MVC (Model-View-Controller)](./model-view-controller/readme.md)
- [Micro-frontends](./micro-frontends/readme.md)
- [Microservices](./microservices/readme.md)
- [MVC (Model-View-Controller)](./model-view-controller/readme.md)
- [Monolithic Architecture](./monolithic-architecture/readme.md)
- [Space-Based Architecture](./space-based-architecture/readme.md)
- [Serverless](./serverless/readme.md)
- [Agentic Architecture (AI Agent Orchestration)](./agentic-architecture/readme.md)
- [Space-Based Architecture](./space-based-architecture/readme.md)
- [Vibe Coding Patterns](./vibe-coding-patterns/readme.md)

## 🏆 Top 15 Best Architectural Approaches

Expand Down
40 changes: 40 additions & 0 deletions architectures/vibe-coding-patterns/data-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
technology: Vibe Coding Patterns
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [data-flow, vibe-coding, orchestration]
ai_role: Autonomous Knowledge Evangelist
last_updated: 2026-05-18
---

# 🌊 Data Flow in Vibe Coding

Understanding how context flows from prompt to validated code is critical.

## The Context Flow Lifecycle

### ❌ Bad Practice
```javascript
// A single massive prompt with no feedback loop
const result = await agent.generate("Build a React app and deploy it");
fs.writeFileSync("app.js", result);
```

### ⚠️ Problem
Passing unstructured intent without intermediate validation leads to immediate drift. The agent will hallucinate dependencies, hallucinate internal state, and produce non-deterministic output.

### ✅ Best Practice
```javascript
// Step 1: Context definition
const context = await loadStrictContext("./architectures/vibe-coding-patterns");
// Step 2: Generation of AST payload
const payload = await agent.generateStructured({ intent: "create component", rules: context });
// Step 3: Formal validation before writing
if (validateAST(payload.code)) {
await fs.promises.writeFile("component.ts", payload.code);
}
```

### 🚀 Solution
Implementing a strict, multi-step data flow pipeline (Intent -> Context Injection -> Structured Output -> AST Validation -> Disk) guarantees that code generated by vibes always maps strictly to typed constraints.
55 changes: 55 additions & 0 deletions architectures/vibe-coding-patterns/folder-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
technology: Vibe Coding Patterns
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [folder-structure, vibe-coding]
ai_role: Autonomous Knowledge Evangelist
last_updated: 2026-05-18
---

# 📁 Folder Structure for Vibe Projects

Isolating AI generation artifacts from production code.

## Structuring the Workspace

### ❌ Bad Practice
```text
/project
app.js
scratch.js
agent-test-1.txt
temp-generation.md
```

### ⚠️ Problem
Mixing temporary scratchpads with production files contaminates the source tree, confuses IDE-based AI indexing, and accidentally ships exploration code to production.

### ✅ Best Practice
```text
/project
/src
app.ts
/.agents
scratchpad.md
validation-scripts/
```

### 🚀 Solution
Strictly isolate AI-generated temporary artifacts in dot-folders (e.g., `/.agents/`). Use these exclusively for vibe-check testing and data gathering. Before committing, an automated script MUST verify no scratch files leaked into `/src/` or exist tracked in version control.

```mermaid
classDiagram
class Project
note for Project "Strictly structured project root"
class Src
note for Src "Production Source Code"
class Agents
note for Agents "Strictly ignored by git or cleaned before commit"

Project *-- Src
Project *-- Agents

class Project:::component
```
35 changes: 35 additions & 0 deletions architectures/vibe-coding-patterns/implementation-guide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
technology: Vibe Coding Patterns
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [implementation, vibe-coding]
ai_role: Autonomous Knowledge Evangelist
last_updated: 2026-05-18
---

# 🛠️ Implementation Guide

How to execute a vibe coding session deterministically.

## Execution Rules

### ❌ Bad Practice
Starting an agentic task by saying "Fix the login bug" without providing file paths or constraints.

### ⚠️ Problem
The agent will guess the file locations, rewrite unrelated components, and use outdated APIs because it lacks specific pointers.

### ✅ Best Practice
```markdown
1. Read `/backend/auth/login.ts`.
2. Implement strict input validation using the rules defined in `architectures/clean-architecture/readme.md`.
3. Generate unit tests in `/backend/auth/login.test.ts`.
4. Run `npm test` before concluding.
```

### 🚀 Solution
Provide explicit file boundaries, architectural constraints, and test verifications in every prompt. This forces the agent into a narrow, deterministic path where success is empirically measured by passing tests.

> [!IMPORTANT]
> Always enforce the validation step. Code is not complete until the test runner outputs success.
52 changes: 52 additions & 0 deletions architectures/vibe-coding-patterns/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
technology: Vibe Coding Patterns
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [vibe-coding, ai-agents, automation, code-generation, deterministic-execution]
ai_role: Autonomous Knowledge Evangelist
last_updated: 2026-05-18
---

# 🌀 Vibe Coding Patterns

[🏠 На главную](../../README.md) | [⬅️ Back to Architectures](../readme.md)

# Context & Scope
- **Primary Goal:** Establish definitive rules for Vibe Coding to ensure deterministic AI code generation and reliable orchestration.
- **Target Tooling:** Cursor, Copilot, AI Developer Agents.
- **Tech Stack Version:** Agnostic

<div align="center">
<img src="https://img.icons8.com/?size=100&id=113061&format=png&color=000000" width="100" alt="Vibe Coding Logo">

**Deterministic coding through vibe alignment and strict constraints.**
</div>

---
## 🗺️ Map of Patterns (Vibe Modules)

This architecture defines how humans and agents interface via strictly structured context to ensure high-fidelity codebase evolution without hallucination.

- [🌊 Data Flow](./data-flow.md): Tracing prompt instructions to final AST execution.
- [📁 Folder Structure](./folder-structure.md): Organizing scratchpads, scripts, and production code.
- [⚖️ Trade-offs](./trade-offs.md): Balancing context window limits vs. generation fidelity.
- [🛠️ Implementation Guide](./implementation-guide.md): The deterministic step-by-step execution protocol.

```mermaid
graph LR
User[Developer Prompt] --> Context[Context Injection]
Context --> Agent[AI Coder]
Agent --> Tests[AST / Type Check]
Tests --> |Pass| Output[Production Code]
Tests --> |Fail| Agent

classDef default fill:#e1f5fe,stroke:#03a9f4,stroke-width:2px,color:#000;
classDef component fill:#e8f5e9,stroke:#4caf50,stroke-width:2px,color:#000;

class User component;
class Context default;
class Agent component;
class Tests default;
class Output component;
```
33 changes: 33 additions & 0 deletions architectures/vibe-coding-patterns/trade-offs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
technology: Vibe Coding Patterns
domain: Architecture
level: Senior/Architect
version: Agnostic
tags: [trade-offs, vibe-coding]
ai_role: Autonomous Knowledge Evangelist
last_updated: 2026-05-18
---

# ⚖️ Trade-offs

Evaluating the limits of Vibe Coding.

## Context vs Autonomy

### ❌ Bad Practice
Loading the entire 100,000-line repository into the agent's context to give it "full autonomy" for a 10-line bug fix.

### ⚠️ Problem
Exceeding the effective context window degrades the LLM's reasoning. It leads to high latency, expensive token consumption, and "lost in the middle" hallucinations.

### ✅ Best Practice
Retrieve only the strictly required AST nodes, related interfaces, and the immediate test file. Keep context under 10k tokens per operation.

### 🚀 Solution
Limit context. The trade-off is that developers must spend more effort on orchestrating the prompt (the "vibe"), but the systemic reward is 100% deterministic, high-fidelity code generation.

| Metric | High Context / High Autonomy | Low Context / High Orchestration |
|--------|-----------------------------|----------------------------------|
| Speed | Slow (High latency) | Fast (O(1) execution time) |
| Fidelity | Low (Hallucination risk) | High (Strict constraints) |
| Cost | High (Token heavy) | Low (Efficient) |
Loading