10X WORKFLOW // MODULE 3 // 5 LESSONS
Marcin deliberately triggers a test failure while Przemek verifies layered quality gates
QUALITY EVIDENCE

Beyond green tests: risk, a deliberate-break check and the cheapest effective gate.

MODULE 3 // QUALITY

Risks first, not files

Quality in 10x Workflow: five lessons on protecting the most dangerous scenarios with a test whose assertion actually fails - a test plan, the oracle and mutation, hook layers, an E2E flight and debugging from evidence. A green test that does not fail when you break the code guards nothing.

Module summary · five lessons in 30 seconds

REMEMBER:

Start from risks, not from files - and write tests whose assertion actually fails on broken code.

LESSON 01Dune · The Fremen

Test plan - what kills the project first?

"The desert kills in a known order: thirst first, then the storm, the worm last. Whoever leaves the sietch without this map does not come back."

- Fremen teaching, before leaving the sietch
LIKELIHOOD →IMPACT →PROTECTED FIRSTTEST-PLAN.MDRISK = USER-FACING FAILURE
FIG. 01 // RISK MAP: IMPACT × LIKELIHOOD

The Fremen do not leave the sietch with a to-do list - they leave with a map of what kills. The desert is predictable in its hostility: every threat has a known weight and a known frequency. A test plan brings that rigor to the project: instead of covering files one by one, it maps risks on the impact × likelihood axes and describes each risk as a user-facing failure - "the cart loses items on refresh", not "cart.ts has no tests".

A test plan starts from a map of what kills the project, not from a list of files: it maps risks on the impact × likelihood axes and describes each risk as a user-facing failure - "the cart loses items on refresh", not "cart.ts has no tests".

Input: a working product and the PRD. Output: context/foundation/test-plan.md - a risk map cut into rollout phases, from the most dangerous scenarios down. Mechanism: /10x-test-plan orchestrates the delivery of tests instead of writing them itself - it drives each phase through the chain (research → plan → implement), and a re-run resumes from the next phase instead of starting over.

Question
what kills the project first?
Guarantee
the most dangerous scenarios protected first
Artifact
test-plan.md in context/foundation/
Tools
/10x-test-plan → chain: research → plan → implement
GOAL:

before the first test is written - the order of writing tests is set by the risk map, not by the directory structure.

DEEP DIVE // 10x-test-planEXPAND ↓
  1. 01Why

    An orchestrator, not an author of tests: it writes context/foundation/test-plan.md as a phased rollout strategy and drives each phase through the chain: new change → research → plan → implement. A re-run reads the state from disk and resumes from the first unfinished phase.

  2. 02Input → output

    Input: the PRD, the roadmap, the change archive, a hot-spot scan of git history (the last 30 days) and a user interview - five questions about real worries, past incidents and places changed without confidence. Output: an impact × likelihood risk map cut into rollout phases with statuses.

  3. 03Evidence, not anchors

    Every risk cites evidence: a PRD line, an interview answer, a high-churn directory. Never file:line - anchors in code are found only by the research of a specific phase, on current code. A risk is a user-facing failure scenario, not a location in the repo.

  4. 04Cost × signal

    For each risk the plan carries response hints:

    • what would prove protection (a behavior, not "cover the module"),
    • which obvious assumption needs to be challenged,
    • the cheapest test layer that gives real signal,
    • the anti-pattern to avoid - the most dangerous being an oracle copied from the implementation: such a test rubber-stamps current bugs.
  5. 05The abuse lens

    If the product has login, payments or accepts user input, the map must contain at least one abuse scenario: resource ownership checks, server-side validation, secret or data leaks, resource abuse. The happy path contains no attacker, so these risks will not surface from the interview on their own.

  6. 06Boundaries

    It does not write test code and does not configure hooks or CI - that is the rollout phases' job. It does not invent risks: each one must derive from the PRD, the roadmap, the archive, the hot-spots or the interview. A single test for a single file is /10x-tdd territory, not a rollout.

LESSON 02The Three-Body Problem · The Experiment

From plan to tests - how does a test know what is correct?

"Do not ask the theory whether it is right. Break the system and watch whether the instrument screams - measurement decides, not faith."

- experiment protocol, research team journal
SYSTEM: BROKEN ON PURPOSEINSTRUMENT = TESTREDORACLE: FROM REQUIREMENTS, NOT FROM CODEA GREEN THAT NEVER FAILS GUARDS NOTHING
FIG. 02 // MUTATION CHECK: BREAK IT AND CONFIRM THE RED

In "The Three-Body Problem" disputes are settled by experiment: a theory that cannot be measured is just an opinion. A test has the same nature - it must know what is correct from an oracle built from requirements and research, not from the code it checks. A test that reads its expected value from the implementation merely duplicates it - it will rubber-stamp every bug already living there. Hence the anti-patterns to eradicate: assertions copied from code, snapshots without understanding, mocks testing mocks.

A test must know what is correct from an oracle built from requirements and research, not from the code it checks. An assertion copied from the implementation merely duplicates it - it will rubber-stamp every bug already living there; hence the anti-patterns to eradicate: assertions copied from code, snapshots without understanding, mocks testing mocks.

Input: one risk from test-plan.md. Output: a test whose assertion actually fails on broken code. Mechanism: the mutation check - break the protected behavior on purpose and confirm the red; if the instrument does not scream after sabotage, it measures nothing. /10x-tdd enforces this order from the start: a red test before the code, green as proof, refactoring on protected ground.

Question
how does a test know what is correct?
Guarantee
an assertion that actually fails on broken code
Artifact
a test protecting the risk + a confirmed red
Tools
/10x-tdd, mutation / deliberate-break check
GOAL:

for every test written by an agent - the oracle comes from requirements, and the proof of a test's quality is its red on broken code.

DEEP DIVE // 10x-tddEXPAND ↓
  1. 01Why

    The test-first sibling of /10x-implement: it drives the phases of an approved plan through the red → green → refactor loop. The failing test is written before the production code - the oracle physically cannot be copied from the implementation, because it does not exist yet.

  2. 02Entry gate

    Two questions before each phase: does the implementation not exist yet, and can the phase be driven by a failing test. Existing code - stop and redirect to /10x-implement, because tests added after the fact are not TDD. Scaffolding, config, infra, visual polish - also a redirect: there a failing test drives nothing.

  3. 03RED

    One test per behavior, named after the outcome ("returns 429 once the limit is exceeded"), assertions about results, not internals. The test must fail for the right reason: the missing behavior, not a syntax error in the test itself. Skipping a test with it.skip so it "passes" is forbidden - the red is the whole point.

  4. 04GREEN and REFACTOR

    The smallest production code that puts out the red - no building ahead, future behaviors will get their own RED step. Then cleanup with the test green: names, duplication, types - without changing behavior. Budget: 2-5 tests per phase, the ones that catch real regressions; not a test for a getter.

  5. 05Anti-patterns

    Testing implementation details (private state, call order), over-mocking (when everything is a mock, you are testing mocks), snapshots for business logic, near-duplicates under different names. And the iron rule: commit only on green - never with a red or skipped test.

LESSON 03Star Wars · Deflector shields

Hooks and triggers - what catches the error before you see it?

"The cheap outer screen works first, then the deflectors, the armor last. Fire that reaches the hull is a failure of every layer."

- shield section officer, pre-battle briefing
CODEPRE-PUSHPRE-COMMITPER-EDIT // CHEAPESTDRIFT CAUGHT SECONDS AFTER IT APPEARSTHE FARTHER FROM CODE, THE COSTLIER THE ERROR
FIG. 03 // THE ERROR GOES OUT AT THE CHEAPEST LAYER

A cruiser does not take fire on its hull armor - that is what deflector shields are for, layer after layer, from the cheapest on the outside to the most expensive at the plating. Quality defense works the same way and is ordered by cost: per-edit (lint and typecheck seconds after a save) → pre-commit → pre-push. The farther an error flies, the more it costs to shoot down.

Quality defense is ordered by cost: per-edit (lint and typecheck seconds after a save) → pre-commit → pre-push. The later an error is detected, the more its fix costs.

Input: the project's quality rules - lint, typecheck, fast tests. Output: hooks wired to events - per-edit, pre-commit and pre-push, each with its own time budget. Mechanism: a self-checking pipeline - drift is detected seconds after it appears, in the background, with no human involved; the only things that reach the end of a phase are those no layer could have caught earlier.

Question
what catches the error before you see it?
Guarantee
drift detected seconds after it appears, not at the end of a phase
Artifact
per-edit / pre-commit / pre-push hooks in the repo
Tools
hooks (PostToolUse, pre-commit, pre-push), lint, typecheck
GOAL:

when working with an agent that generates code faster than you can read - the error should go out at the cheapest layer, before it touches git history.

LESSON 04The Expanse · The Rocinante test flight

E2E tests - does the whole thing really flywork?

"A mock-up in the dock will not tell you whether the ship flies. Take her out, light the drive and read the instruments in flight."

- ship mechanic, before the test flight
UIAPIDATASEED: DATA FOR THE FLIGHTE2E ONLY WHERE A MOCK WOULD LIEA FULL FLIGHT, NOT A DOCK
FIG. 04 // TEST FLIGHT: THROUGH ALL MODULES, NOT IN THE DOCK

The Rocinante did not prove she could fly on dock schematics - she proved it with a test flight: drive, navigation, hull and crew at once, in vacuum. An E2E test is the same maneuver: a flight through all modules at once - UI, API, data - exactly where a mock would lie. The rule of the cheapest test that gives signal applies: if a unit test is enough, E2E is a luxury; if the unit test lies, E2E is the only honest measurement. Signal is the goal, not coverage.

An E2E test is a pass through all modules at once - UI, API, data - exactly where a mock would lie. The rule of the cheapest test that gives signal applies: if a unit test is enough, E2E is a luxury; signal is the goal, not coverage.

Input: a running application and a risk from the plan that nothing cheaper can cover. Output: Playwright tests + a seed test preparing the data for the flight. Mechanism: /10x-e2e drives the risk through plan → generate → review → verify on the running application, multimodally - the agent reads the DOM and looks at screenshots at the same time, so it also sees what a selector cannot catch.

Question
does the whole thing really fly?
Guarantee
an end-to-end flight where a unit test would lie
Artifact
Playwright tests + a seed test
Tools
/10x-e2e, Playwright CLI/MCP (DOM + vision)
GOAL:

for critical paths - login, payment, data writes - E2E only where a mock would lie, not for chasing coverage.

DEEP DIVE // 10x-e2eEXPAND ↓
  1. 01Why

    It drives the plan's browser-level phases one risk at a time through the plan → generate → review → verify loop. An agent will generate a passing E2E test in seconds; the hard part is a test that protects a real risk and survives tomorrow's refactor - and that is exactly the work this loop does.

  2. 02Entry gate

    Three conditions at once: the risk genuinely requires a browser (it cuts across auth, routing, API and data, or exists only in the rendered UI), the feature is already built and runnable, and a test for this risk does not exist yet. Everything else - a redirect to /10x-tdd or /10x-implement: E2E is the most expensive and most brittle layer.

  3. 03Two levers

    E2E tests are not generated from scratch. Quality is guarded by two levers: seed.spec.ts - the exemplar test every next one is modeled on (what you show is what you get), and the E2E rules file read before generation. The prompt carries only what the levers cannot encode: the specific risk, the flow and the real vs mock boundaries.

  4. 04Mechanism

    The agent sees the accessibility tree (roles, names, states), not pixels - hence getByRole locators come naturally, not CSS selectors. Internal boundaries (auth, routing, the database) stay real, because that is where the integration risk lives; only expensive or non-deterministic external APIs get mocked, at the network layer.

  5. 05Review: 5 anti-patterns

    A generated test is not taken at its word. The review catches five anti-patterns: a hallucinated assertion, a brittle selector, shared state, waiting for time instead of state, missing cleanup. The fix is a re-prompt by the anti-pattern's name: what is wrong, why it does not protect the risk, which pattern should replace it - never a generic "fix this test".

  6. 06Verify

    A green result is not enough. The control question: will the test fail when the risk from the plan actually materializes? The proof is a deliberate break: intentionally breaking the protected behavior and confirming the red, then immediately restoring the pre-break state. Budget: one test per risk, rarely more than 1-3 per phase.

LESSON 05Hyperion · The Pilgrims

Debugging - what do all the instrumentssources say at once?

"Each of us carries a different tale, and none of them explains anything on its own. The truth lies where the tales intersect."

- the pilgrims' rule, on the way to the Time Tombs
SENTRYWRANGLER LOGSCONSOLENETWORKWHERE THE TALES INTERSECTDIAGNOSISNO SINGLE SOURCE IS ENOUGHTRY/CATCH → 200 = SWALLOWED EVIDENCE
FIG. 05 // MANY TALES, ONE DIAGNOSIS

The pilgrims on their way to the Time Tombs reach the truth only because each one tells his own story - none of them explains anything on its own, all of them at once point to the same place. Debugging with an agent works exactly the same way: a synthesis of evidence from many sources - Sentry from production, wrangler logs from the backend, console and network from Playwright - instead of mastery of a single tool.

Debugging with an agent is a synthesis of evidence from many sources at once - Sentry from production, wrangler logs from the backend, console and network from Playwright - instead of mastery of a single tool. No source explains anything on its own; all of them at once point to the same place.

Input: a symptom - a user-facing error, a red test, an alert. Output: a diagnosis backed by evidence and a fix pinned with a test so the regression does not come back. Mechanism: collect readings from all the instruments at once and look for where the tales intersect; along the way, eradicate error swallowing - a try/catch returning 200 is sweeping evidence away (OWASP A10:2025), and it makes the next diagnosis start from zero.

Question
what do all the instruments say at once?
Guarantee
a diagnosis from evidence, not from hunches
Artifact
a diagnosis + a test pinning the fix
Tools
Sentry MCP, wrangler logs, Playwright console/network
GOAL:

when the symptom and the cause live in different layers - the diagnosis is made by the intersection of sources, not by the first suspicion.

NEXTQuality closes the block · 10xBuilder

Next: block complete

10XBUILDER BLOCK // FOUNDATION → CHAIN → QUALITY

Quality closes the 10xBuilder block. Foundation builds the launch ramp, the chain flies units of work, scaling raises rigor and autonomy, and quality makes sure that what flies does not fall.

Quality closes the 10xBuilder block. Foundation prepares the project, the chain delivers units of work, scaling raises throughput and autonomy, and quality makes sure the bar does not drop as the pace goes up.

module 1
Module 1: Foundation - from an idea to the launch ramp
module 2 // csc
Core Skills Chain - five jumps of a single unit of work
scaling
Scaling - quality gates, goal, loops
MODULE 4 // LEGACY

From here the game moves into someone else's code: 10xArchitect opens the legacy module - inherited systems, no tests, the archaeology of decisions. Everything this module taught you on your own code comes back there with the stakes doubled.

up next
legacy (M4, 10xArchitect) - working in inherited systems
rule
in legacy, the test protecting the behavior is written before the refactor starts
WHAT NEXT:

The 10xBuilder block is behind you: the foundation, the chain and tests that actually catch bugs. Module 4 moves all of it into someone else's code - start with the lesson on the project map.