Design & Specify Exercises

Fill in the blanks to test your knowledge.

1

A user story follows the format: "As a ___, I want to ___, so that ___"

// User story template
const userStory = {
role: "As a ", // who is the user?
goal: "I want to ", // what do they want to do?
benefit: "so that ", // why do they want it?
};
2

Acceptance criteria in a user story are written using ___ scenarios (Given/When/Then format)

// Gherkin scenario

: a logged-in user is on the checkout page

When: they click "Place Order"

Then: an order confirmation email is sent

And: the cart is cleared

3

In SDD, a ___ document describes the full technical design of a feature before development begins

// Spec-Driven Development: document types

// 1. User Story — the requirement

// 2. Use Case — the actor-system interaction

// 3. Document — the technical implementation design

// 4. Task List — the atomic work units for the AI agent

4

A wireframe shows the ___ layout of a screen without colors, fonts, or final imagery

// Fidelity spectrum
const fidelityLevels = {
sketch: "rough boxes, no detail",
wireframe: " layout, grayscale, placeholder text",
mockup: "visual design, real fonts, brand colors",
prototype: "interactive, clickable, simulates real app",
};
5

An ___ is a large body of work that contains multiple related user stories

// Agile hierarchy
const agileHierarchy = {
theme: "Strategic goal (e.g., Improve Checkout Experience)",
: "Large feature (e.g., Guest Checkout)",
userStory: "Single capability (e.g., Pay without account)",
task: "Developer task (e.g., Add email input field)",
};
6

In a use case, the ___ is the person or external system that interacts with the system

// Use case components
const useCase = {
title: "Process Payment",
: "Customer", // who or what initiates the use case
preconditions: ["Cart is not empty", "User is logged in"],
mainFlow: ["1. Customer clicks checkout", "2. System displays payment form"],
exceptions: ["Payment declined — retry or cancel"],
};
7

Vibe coding describes using AI to generate code from ___ language descriptions rather than writing detailed specifications first

// Vibe coding workflow
const vibeCoding = {
approach: " language prompt",
example: "build me a todo app with dark mode",
strengths: ["Fast prototyping", "Low barrier to entry"],
weaknesses: ["Less predictable", "Hard to maintain at scale"],
};
8

EARS stands for Easy Approach to Requirements ___, a structured format for writing unambiguous software requirements

// EARS requirement templates

// Ubiquitous: "The system shall "

// Event-driven: "WHEN [trigger] THE system shall "

// Unwanted: "IF [condition] THEN the system shall "

// Example

const requirement = "WHEN a user submits the login form WITH valid credentials, THE system shall redirect to the dashboard within 500ms";

9

A steering file (like CLAUDE.md or .kiro/steering/) persists project ___ across AI coding sessions so the AI stays aligned with your codebase rules

// Steering file contents example

// .kiro/steering/tech.md

## Tech Stack

- Vite + React + TypeScript

- Tailwind CSS (utility classes only)

- Supabase for database and auth

## Rules

- Never use purple color

- Always use 8px spacing system

- Components max 200 lines

10

In SDD, the development workflow generates atomic task lists that AI agents execute one ___ at a time

// SDD task breakdown
const sddTasks = [
{ id: 1, type: "", description: "Create UserProfile component skeleton" },
{ id: 2, type: "", description: "Add profile form fields with validation" },
{ id: 3, type: "", description: "Wire up Supabase profile update mutation" },
{ id: 4, type: "test", description: "Write unit tests for profile validation" },
];
11

The ___ data model records what the data means (attributes, identifiers and cardinality) without choosing data types or indexes.

// Three layers of data model
const layers = {
conceptual: "what exists: things and named relationships",
: "what it means: attributes, identifiers, cardinality, 3NF",
physical: "how it is stored: tables, types, keys, indexes, policies",
};
12

In crow's foot notation, a line end drawn as a circle plus a crow's foot means zero or ___.

// Mermaid erDiagram cardinality

// || exactly one

// o{ zero or

// |{ one or more

MEMBER ||--o{ LOAN : borrows

13

A many-to-many relationship between members and tools is resolved by promoting the hidden thing in the middle to an ___ entity.

// Wrong: MEMBER }o--o{ TOOL (where does "wanted for" live?)
// Right: an entity with attributes of its own
MEMBER ||--o{ RESERVATION : places
TOOL ||--o{ RESERVATION : "is wanted in"
14

Values such as a loan's status or whether it is overdue are ___ attributes: computed when read, never stored.

-- LOAN

-- loan number (identifier)

-- borrowed on

-- due on

-- status from the latest loan event

-- overdue from due on and today

15

To keep history, separate what a record is from what happened to it: keep a stable identity and record each change as a separate ___.

-- identity: what the loan IS

create table loans (id uuid primary key, loan_number text unique, due_on date);

-- one row per : what HAPPENED to the loan

create table loan_events (

loan_id uuid references loans (id),

kind text, -- out | renewed | returned

occurred_at timestamptz

);

16

In the physical model, a business identifier such as an asset tag is kept as a ___ column beside a surrogate uuid primary key.

create table public.tools (

id uuid primary key default gen_random_uuid(),

asset_tag text not null , -- duplicates are refused by the database

name text not null

);

17

Row level security must be ___ on the table itself; policies defined on a table without it change nothing.

alter table public.loan_events row level security;

create policy loan_events_insert_staff on public.loan_events

for insert to authenticated

with check (public.is_staff());

-- no update or delete policy: history is append-only

18

To change the shape of a live table safely, run three separate steps: expand, switch, then ___.

// Changing a live shape

const steps = [

"expand: add loan_events beside loans.status, backfill it",

"switch: move every reader and writer to loan_events",

": drop loans.status in a LATER change, once nothing reads it",

];