Compare Three Feature Architectures Against Module Boundaries

Get a scored trade-off matrix comparing three feature architectures by file touchpoints, coupling risks, and rollback cost before running Cursor Composer.

Agent prompt for Claude and Gemini

You get: Summary Table, option Breakdowns and recommended Plan

Prompt

Prompt
Act as a principal software architect reviewing a codebase before a multi-file implementation in Cursor Composer.

I will paste my feature goal, relevant directory tree, and any existing module boundary rules right after this prompt. If the module boundaries or test coverage are unclear, ask up to three numbered questions first and wait for my answers.

Otherwise, compare three distinct architecture options for building this feature against my existing boundaries. Follow these rules:
- Option A must minimize file touchpoints, Option B must prioritize strict module isolation, and Option C must optimize for future extensibility.
- Score each option from 1 to 5 on file touchpoints, coupling risk, testability, and rollback cost, where 5 is best.
- Name exact file paths or directories from my tree for every touchpoint and boundary crossing.
- Flag any circular dependency, shared mutable state, or schema lock-in risk before writing code.
- Recommend one option and list the exact pre-flight checks to run before opening Cursor Composer.

Output format:
1. Summary Table: Markdown table with columns Option, File Touchpoints, Coupling Risk, Testability, Rollback Cost, and Total Score.
2. Option Breakdowns: Three short sections covering exact files touched, boundary impact, and rollback steps.
3. Recommended Plan: Chosen option, rationale in three bullets, and a numbered Cursor Composer execution order.

End with one line stating your key assumptions and any missing codebase context that could change the recommendation.

Example output

Total trade-off score by architecture optionHigher is better, scored out of 20
  • A: Inline Retry Loop: 15/20
  • B: Dedicated Retry Worker: 17/20
  • C: Event Bus Outbox: 12/20

Example for: adding webhook retry queues to a Node.js and TypeScript billing service with strict domain folders (src/billing, src/webhooks, src/shared).

1. Summary Table
OptionFile TouchpointsCoupling RiskTestabilityRollback CostTotal Score
A: Inline Retry Loop523515/20
B: Dedicated Retry Worker355417/20
C: Event Bus Outbox154212/20
2. Option Breakdowns

Option A: Inline Retry Loop

  • Files touched: src/webhooks/dispatcher.ts, src/webhooks/retryPolicy.ts, src/webhooks/dispatcher.test.ts.
  • Boundary impact: Keeps changes inside src/webhooks, but couples HTTP delivery latency to retry backoff timers.
  • Rollback steps: Revert the single PR; no database or queue state changes required.

Option B: Dedicated Retry Worker

  • Files touched: src/webhooks/dispatcher.ts, src/webhooks/retryQueue.ts, src/webhooks/worker.ts, src/shared/queueClient.ts, src/webhooks/worker.test.ts.
  • Boundary impact: Preserves strict isolation between src/billing and src/webhooks; only adds a thin queue adapter in src/shared.
  • Rollback steps: Disable the worker feature flag, drain pending jobs, and revert the PR.

Option C: Event Bus Outbox

  • Files touched: src/billing/invoiceService.ts, src/webhooks/outboxConsumer.ts, src/shared/db/migrations/014_outbox.sql, plus 4 repository files.
  • Boundary impact: Requires src/billing to write outbox rows, introducing schema lock-in across two domains.
  • Rollback steps: Requires a downward database migration and dual-write cleanup.
3. Recommended Plan

Chosen Option: Option B (Dedicated Retry Worker).

  • Isolates retry failures from live billing requests without touching src/billing.
  • Keeps rollback safe via a feature flag and zero database migrations.
  • Limits Cursor Composer edits to five predictable files with clear unit test boundaries.

Cursor Composer Execution Order:

  1. Add the queue interface in src/shared/queueClient.ts.
  2. Implement src/webhooks/retryQueue.ts and src/webhooks/worker.ts.
  3. Wire failed deliveries in src/webhooks/dispatcher.ts behind the retry flag.
  4. Run unit tests in src/webhooks/worker.test.ts and verify zero imports from src/billing.

Assumptions and missing context: Assumes Redis is already available in staging for the queue client; if not, confirm whether a Postgres-backed queue is required before starting.

Written by AI from this prompt. Your results will vary.

Tips and common edits

Why this works

  • Forces three distinct architectural trade-offs instead of letting the model default to one quick patch.
  • Maps exact file paths and rollback steps before Cursor Composer edits multiple files at once.
  • Flags circular dependencies and schema lock-in early so you catch boundary violations before coding.

Use this in Cursor, Claude, or Gemini before starting a multi-file Cursor Composer session. Paste your feature goal, directory tree, and any module boundary rules right after the prompt.

Common edits

  • Add a performance or latency column to the summary table if the feature sits on a hot request path.
  • Ask the model to output a matching .cursorrules snippet enforcing the chosen module boundary.

Reuse it: Use in a workflowAdapt in the builder

Prompt details

By
Prompts-GPT editors
Published
How prompts are written and checked

Did this prompt work?

More in Cursor

Refactor Monolithic God Classes into Clean Services

Get a step-by-step plan to break a large monolithic class into smaller, testable services while preserving the original public API behavior.

Coding

Split a large pull request into reviewable commits

Break down overwhelming pull requests into clean, sequential, logically isolated commits. Use it when code reviews stall due to sprawling diffs.

Audit Cursor Rules Files for Conflicts and Context Bloat

Get a line-by-line audit of your .cursor/rules files that flags overlapping globs, contradictory instructions, and token waste, plus a consolidation diff.

Audit API Route Handlers for Auth and Permission Leaks

Get a structured security audit of your API route handlers that evaluates tenant isolation, role-based access control, and input validation risks.

Decompose Framework Migrations into Subagent Work Batches

You get a structured task graph that maps migration steps into isolated, low-risk subagent work batches with defined file boundaries and interface contracts.

Perform Static Call Graph Trace Before Modifying Code

Generate a clear visual map of function calls and file dependencies to identify exactly where your changes will ripple before you type a single line of code.