Saas code review

From Basinfy/Basinfy-SaaS-Studio · View interactive version

Saas code review is an AI agent skill from the GitHub repository Basinfy/Basinfy-SaaS-Studio. Architectural code review — coding standards, SOLID, testability, performance concerns.

How to use this skill

Skill file

!bash "${CLAUDE_SKILL_DIR}/../../hooks/yaml-helper.sh" resolve_config --keys locale,automation

Code Review

Locale & User Profile: Match locale (pt-BR → natural Brazilian Portuguese questions/options, overriding English examples; en → English) and user_profile (founder → plain business language with (Recomendado) first, zero tech jargon; developer → technical). Keep code/tests in English.

Every AskUserQuestion call follows .claude/docs/automation-modes.md

(collaborative asks always · guided major-only · autonomous logs and proceeds;

automation_always_ask categories always prompt).

Insufficient input — check this before producing any report

**If the inputs this skill needs do not exist, the answer is "could not run" —

not a filled-in report.** Check first, and stop if the check fails.

  1. List the inputs this skill reads (data files, prior reports, profiler output,

test results, registries, source code).

  1. For each, record FOUND or ABSENT — not "assumed present".
  2. If any input required for a section is ABSENT, that section is

NOT ASSESSED — NO DATA. Do not estimate it, do not infer it from an

adjacent artifact, and do not leave a mandated cell to be filled by whoever

reads the template next.

  1. If every required input is ABSENT, stop and report

NOT ASSESSED — NO DATA as the whole verdict, naming what was missing and

which skill produces it.

A verdict of NOT ASSESSED is a success. It is the correct, useful answer to

"what does the data say?" when there is no data. The failure mode this prevents is

specific: a report whose verdict enum has no "could not run" state produces

false clean passes — an asset audit returning COMPLIANT on a project with no

assets and no standards, or a performance profile reporting ">99% headroom against

a 16.67ms budget" with zero profiler data and no budget ever set.

Absence of evidence is never evidence of absence. A scan that finds no

matches because there are no files to scan has not verified anything. Say which of

the two happened — a reader cannot tell from a green result.


Phase 1: Load Target Files

Read the target file(s) in full. Read CLAUDE.md for project coding standards.


Phase 2: Identify Engine Specialists

Read the specialists block from project.yaml; if it is absent, fall back to the ## Engine Specialists section of .claude/docs/technical-preferences.md. Note:

**A value of null means UNSET — treat that key as absent and skip its

specialist. Never spawn it as an agent name.** The v1.0 migration writes null

for any specialist the legacy file did not name, and it writes the whole block

whenever one member is set — so a project that configured only its code

specialist carries database: null and ui: null. The config reader returns the

four-character string "null" for these, which is not empty and therefore reads

as configured. null, empty, and missing are the same state here.

If no engine is configured (no stack.frontend in project.yaml, and technical-preferences.md reads [TO BE CONFIGURED] or is missing), skip stack specialist steps. Record `Engine validation: NOT ASSESSED — no engine configured (stack.frontend unset in project.yaml)` in this run's output. A skipped check that says nothing is indistinguishable from a check that passed; the reader cannot tell engine guidance was never sought.


Phase 3: ADR Compliance Check

Argument: /saas-code-review [file(s)] may optionally include a story file path as the last argument (e.g., /saas-code-review src/app/api/billing/route.ts production/epics/billing/story-001.md). If a story path is provided, read it to extract the governing ADR reference.

Search for ADR references in, in priority order:

  1. The story file (if provided as argument)
  2. Header comments at the top of the implementation files
  3. Commit messages referencing these files (git log --oneline -- [file])

Look for patterns like ADR-NNNN or docs/architecture/adr- (either case).

If no ADR references found, note: "No ADR references found — ADR compliance check skipped. For full ADR compliance review, provide the story path: /saas-code-review [files] [story-path]."

For each referenced ADR, load only the sections this check needs — never an unbounded full read. A substantial ADR exceeds the 25k-token Read cap, and a capped read's only recovery is paging the remainder — the most expensive way to read a file. Use the same pattern as /saas-dev-story and /saas-create-stories:

  1. Discovery & Section Extraction: Check if .basinfy/ exists in the workspace.

A referenced ADR whose file is missing, or that cannot be read, makes ADR

Compliance NOT ASSESSED — [ADR] could not be read: name it. No reference at

all is NO ADRS FOUND, a different result.

From those two sections, classify any deviation:


Phase 4: Standards Compliance

Identify the system category (engine, core business workflow, AI, networking, UI, tools) and evaluate:


Phase 5: Architecture and SOLID

Architecture:

SOLID:


Phase 6: SaaS Architecture & Web Runtime Concerns


Phase 7: Specialist Reviews (Parallel)

Spawn all applicable specialists simultaneously via Agent — do not wait for one before starting the next.

**Verify every specialist finding before reporting it. Do not pass findings

through unchecked.** For each finding, record in the report:

- File and line it refers to.

- Evidence — the quoted code, or the concrete input/state that triggers it.

- Confidence — VERIFIED (you checked it yourself) or `UNVERIFIED —

specialist claim` (you could not).

A finding you could not verify is reported as unverified or dropped, never

promoted to a defect on the strength of confident phrasing.

Why this is mandatory. Agents are reliable when deriving and unreliable when

diagnosing existing code: a wrong claim about a short function can be fluent

enough to pass a skim, and a claimed bug can fall apart once you enumerate the

inputs. Without this step the parent review is a laundering channel: a guess

enters as a specialist finding and leaves as a reviewed defect.

Engine Specialists

If an engine is configured, determine which specialist applies to each file and spawn in parallel:

Also spawn the Primary Specialist for any file touching web framework architecture (routing structure, middleware hierarchy, lifecycle hooks).

QA Testability Review

For Logic and Integration stories, also spawn qa-manual-tester via Agent in parallel with the stack specialists. Pass:

Ask the qa-manual-tester to evaluate:

For Visual/Feel and UI stories: qa-manual-tester reviews whether the manual verification steps in ## QA Test Cases are achievable with the implementation as written — e.g., "is the state the manual checker needs to reach actually reachable?"

Collect all specialist findings before producing output.


Phase 8: Output Review

## Code Review: [File/System Name]

### Engine Specialist Findings: [N/A — no engine configured / CLEAN / ISSUES FOUND]
[Findings from stack specialist(s), or "No engine configured." if skipped]

### Testability: [N/A — no story path given / N/A — Visual/Feel or Config story / TESTABLE / GAPS / BLOCKING]
[qa-manual-tester findings: test hooks, coverage gaps, untestable paths, new edge cases]
[If BLOCKING: implementation must expose [X] before tests in ## QA Test Cases can run]

### ADR Compliance: [NOT ASSESSED / NO ADRS FOUND / COMPLIANT / DRIFT / VIOLATION]
[List each ADR checked, result, and any deviations with severity]

### Standards Compliance: [X/6 passing]
[List failures with line references; a missing doc comment names the method or class]

### Architecture: [NOT ASSESSED / CLEAN / MINOR ISSUES / VIOLATIONS FOUND]
[List specific architectural concerns]

### SOLID: [NOT ASSESSED / COMPLIANT / ISSUES FOUND]
[List specific violations]

### SaaS Architecture & Web Runtime Concerns
[List product development specific issues]

### Positive Observations
[What is done well -- always include this section]

### Required Changes
[Must-fix items before approval — ARCHITECTURAL VIOLATIONs always appear here]

### Suggestions
[Nice-to-have improvements]

### Verdict: [NOT ASSESSED / APPROVED / APPROVED WITH SUGGESTIONS / CHANGES REQUIRED]

Choose the verdict, first match wins:

specialist review did not run — no engine configured, or a specialist that

could not be spawned — or any report section reads NOT ASSESSED (ADR

Compliance with a referenced ADR that could not be read, Architecture, SOLID);

name which. NOT ASSESSED ranks below CHANGES REQUIRED, because a known

defect is more actionable than a skipped check, and above both approvals: a

review that skipped the engine check has not approved the code. (`NO ADRS

FOUND` is not NOT ASSESSED: with no ADR to check, it does not stop an

approval.)

This skill is read-only — no files are written.


Phase 9: Next Steps

Use AskUserQuestion:

If an ARCHITECTURAL VIOLATION is found:

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.