Design review

From dean0x/devflow · View interactive version

Design review is an AI agent skill from the GitHub repository dean0x/devflow. Use when reviewing implementation plans for anti-patterns.

How to use this skill

Skill file

Design Review

Iron Law

CATCH IT IN THE PLAN, NOT IN THE PR

A plan that implies N+1 queries will produce N+1 queries. A plan that omits error

handling will produce code with no error handling. Review the plan as rigorously as

the code: every implementation decision follows it.

Anti-Pattern Detection Rules

A concrete case is an external call in this change, a stated or measured hot path, or a repeated delivery.

1. N+1 Queries

What to look for in a plan:

How to flag:

[N+1 RISK] Step {N}: "{quoted plan text}" — fetches {entity} per iteration.
Resolution: Replace loop with batch query: {proposed batch operation}.

Suggest: collect the IDs first and batch-fetch the related rows in one query, or eager-load them (JOIN) in the list query.

2. God Functions

What to look for in a plan:

How to flag:

[GOD FUNCTION RISK] Step {N}: "{quoted plan text}" — handles {n} responsibilities.
Resolution: Split into: {responsibility 1} → {responsibility 2} → {responsibility 3}.

Suggest: one purpose per function; move notification, logging and other side effects to their own functions, and compose them at the service layer.

3. Missing Parallelism

What to look for in a plan:

How to flag:

[SEQUENTIAL BOTTLENECK] Steps {N}-{M}: "{quoted steps}" — no dependency between them.
Resolution: Execute {step A} and {step B} in parallel: {proposed parallel pattern}.

Suggest: run independent steps in parallel (Promise.all, goroutines, asyncio.gather), and name the steps that must stay in order.

4. Error Handling Gaps

What to look for in a plan:

How to flag:

[ERROR HANDLING GAP] Step {N}: "{quoted plan text}" — failure path unspecified.
Resolution: Add: {on failure scenario} → {specific recovery action}.

Suggest: for each external call, the action on timeout, 4xx and 5xx; a compensation step only for a partial write that loses data; Result types or explicit error returns, never a silent failure.

5. Missing Caching

What to look for in a plan:

Only with a concrete case; else no finding.

How to flag:

[CACHING GAP] Step {N}: "{quoted plan text}" — {expensive operation} on every request.
Resolution: Cache {data} for {TTL}: {proposed cache strategy and invalidation}.

Suggest: an application cache for cross-request data, a short-TTL in-memory cache for process-local reference data, and the invalidation (on update, by TTL, or both).

6. Poor Decomposition

What to look for in a plan:

How to flag:

[DECOMPOSITION ISSUE] Step {N}: "{quoted plan text}" — combines {concern A} and {concern B}.
Resolution: {concern A} belongs in {layer/module}; {concern B} belongs in {layer/module}.

Suggest: one layer per step (presentation, business logic, data access); cross-cutting concerns (logging, auth, validation) in middleware or decorators; one bounded context per module.

Extended References

| Reference | Content |

|-----------|---------|

| references/anti-patterns.md | Before/after plan examples for each anti-pattern |

Severity Guidelines

| Level | An anti-pattern that |

|-------|----------|

| CRITICAL | will cause correctness failures (data loss, security breach) |

| HIGH | will cause significant performance or maintainability problems |

| MEDIUM | will require architectural rework post-implementation |

| LOW | reduces code quality but is easily refactored |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.