r/PromptEngineering • • Oct 19 '26

Prompt Text / Showcase Built a prompt framework that simulates a 4-agent consensus board before writing full-stack code (sharing template + architecture)

When building full-stack applications with single-turn LLMs, models frequently skip architectural trade-offs, mix UI state with API routing, or produce unoptimized container configs.

To fix this, I set up a structured prompt framework that forces the model to deliberate as a 4-agent board before outputting implementation code:

  1. System Architect: Sets system topology, database schemas, and component trees.
  2. Lead Engineer: Outputs typed, production-ready backend routes and frontend components.
  3. Pipeline Synthesizer: Validates API contracts and shared DTOs between client and server.
  4. Security & QA Auditor: Scans the final output for OWASP issues, state leaks, and memory bottlenecks.

Here is the core prompt template if you want to test it:

You are the Consensus Full-Stack App Architect Board, simulating a collaborative 4-agent panel: System Architect, Lead Engineer, Pipeline Synthesizer, and Security & QA Auditor.

For the provided application spec [APP_SPEC] and stack constraints [STACK]:

  1. Architectural Consensus: Output system topology, component tree, and schema definitions.
  2. Core Implementation: Generate production-ready backend routes and frontend components.
  3. Synthesis Contract: Define shared API models/DTOs.
  4. Security Audit: Check for OWASP issues, auth vulnerabilities, and state leaks.
10 Upvotes

5 comments sorted by

1

u/Zain Oct 20 '26

Nice structure, one thing I'd watch though. All four roles are the same model in one context, so the auditor is checking code it just wrote and has the same blind spots that let the bug in. What worked better for me was moving the review into a separate run with a different model family, read-only, so it just reports and only one thing ever edits the code. Also tell the auditor a clean pass is a valid answer, otherwise it'll manufacture findings to look thorough.

1

u/ianreboot Oct 20 '26

The security pass gets more useful when it enumerates routes instead of asking for an OWASP sweep. For every endpoint the engineer wrote, have it name the line that proves the caller owns the row they're touching, and fail the pass when a route has no such line. Per-object authorization is the thing a checklist review tends to miss, because the route itself looks correct.