stories.js format¶
communications/user-stories/stories.js holds everything the page says about the project, as one assignment:
// Written by Claude from the project brief, the explorer's model.js and the code. Plain data, no code.
window.STORIES = { … };
Plain data only: strings, numbers, booleans, arrays and objects. No functions, no imports, no computed values. Start the file with a short comment that says how it was written. build-stories.mjs reads it together with the explorer's model.js and writes index.html next to it.
Top level¶
| Field | Type | Default | Meaning |
|---|---|---|---|
project |
string | the model's project.name |
Name shown at the top of the page. It also gives the page its storage key, unless key is set. |
key |
string | from project |
Optional. The id the browser keeps the page's notes under. Set it once readers leave notes if the project name may change (see "Keeping notes attached"). |
summary |
string | none | One or two sentences: who uses the product and for what. |
model |
string | ../architecture-explorer/model.js |
The explorer's model, relative to stories.js. --model on the command line overrides it. |
explorer |
string | none | Link from the built page to the explorer, relative to the page: the journey links to its scenario and steps there. A download (one story or every story) keeps only a full https:// link and drops a relative one, which would break once the file is sent on. |
source |
object | the model's source |
{ repoUrl, branch, host, fileTemplate, lineTemplate } as in the explorer's model: turns source paths into links. |
personas |
array | the model's person nodes |
Extra words about each actor (below). |
stories |
array | required | The stories, in the order the page shows them. |
Personas¶
Optional. Without them the page uses the model's person nodes (their name and desc). Give a persona to add goals, or to name an actor the model does not have.
| Field | Type | Meaning |
|---|---|---|
id |
string | A person node id of the model, or a new id. |
name |
string | Display name. |
desc |
string | One sentence: what this person does with the system. |
goals |
string[] | What they want from it, in their words. Take them from the brief or the docs, not from imagination. |
Stories¶
| Field | Type | Required | Meaning |
|---|---|---|---|
id |
string | yes | Unique, lowercase-kebab (annotate-next). Notes point at it: do not rename it once readers have left notes. |
title |
string | yes | Short verb phrase: "Annotate the next image". |
actor |
string | yes | A person node id of the model, or a persona id. |
want |
string | yes | Completes "I want …": "to be handed the next image that needs boxes and draw them on it". |
soThat |
string | expected | Completes "so that …": the reason. The build warns without it. |
scenario |
string | no | A scenario id of the model. Its steps are the story's journey. When the story covers the whole scenario, the scenario's goal, trigger, preconditions and outcome are shown with it. The story's actor need not be the scenario's actor: a scenario with two people can give each a story. |
goal, trigger, preconditions, outcome |
string (preconditions may be a list) |
no | The story's own use-case facts. They replace the scenario's, and are the only ones shown when the story covers part of a scenario. |
steps |
[a, b] |
no | The part of the scenario this story covers: step numbers counted from 1, both ends included. Default: the whole scenario. Needs scenario. |
acceptance |
string[] | expected | Acceptance criteria, each checkable in the code (see "Rules"). The build warns without them. |
screens |
array | no | What the person sees (below), each on its step. Default: the images on the scenario's steps inside the range. |
source |
array | expected, except for planned |
Where the story lives in the code (below). The build warns without it. |
status |
string | no | implemented, partial or planned. |
notes |
string | no | Limits and open questions found in the code. |
tags |
string[] | no | Short words to group stories (review, export). |
Several stories may use the same scenario with different ranges: a scenario that covers reject, rework and approve can give one story to the reviewer who rejects ([1, 12]), one to the annotator who fixes ([13, 24]) and one to the reviewer who approves ([25, 30]).
Screens¶
| Field | Type | Meaning |
|---|---|---|
id |
string | Optional. The screen's id, which readers' notes point at (letters, digits, -, _). Default: s1, s2, … by position. Give ids before readers leave notes if screens may be reordered. |
title |
string | Optional. A short name over the screen. Default: the label of its step. |
src |
string | The image: a path relative to stories.js (img/review.png, ../architecture-explorer/img/annotate-page.svg), an http(s) URL, or a data: URL. |
caption |
string | One or two sentences under the image. For anything that is not a real screenshot, say so here too ("illustrative wireframe drawn from AnnotatePage.tsx, not a screenshot"). |
alt |
string | What the screen shows that matters, for screen readers: headings, the state of the buttons, the messages. Not "screenshot of the page". |
step |
number | The step of the scenario, counted in the whole scenario (not from the start of the range), where the person sees this screen. The page shows the screen inside that step of the journey. Without it, or outside the story's range, the screen shows under "Also seen" after the journey (the build warns). In a story without a scenario, every screen shows under "What … sees", ordered by step when given. |
kind |
string | screenshot (default), wireframe, mockup, diagram, illustration or photo. |
illustrative |
boolean | true for anything that is not a real screenshot of the running app: wireframes, mock-ups, diagrams, illustrations. The build warns when a kind other than screenshot or photo lacks it. |
w, h |
number | Optional. The picture's size in pixels. The build reads it from PNG, JPEG, GIF, WebP and SVG files; give it for an http(s) or data: picture, or the page assumes 1000 x 625 (the build warns). |
view |
string | Optional. The name of the view src shows: desktop (default), tablet, phone, or a name of your own (letters, digits, -, _; up to 24 characters). Set it when the screen has views. |
views |
array | Optional. The same screen at other sizes, each { view, src, w, h, caption, alt } (below). |
Without screens, the story takes the pictures on its scenario's steps in range, with paths relative to model.js; an illustrative picture becomes a wireframe.
The page numbers a story's screens in the order of its journey: those on a step by step number, then the others as listed.
Views: one screen at several sizes¶
A page that changes with the screen size can be shown at each size. The screen's own src is its default view, named by view; views lists the others:
{ id: 'annotate', src: 'img/annotate.png', step: 15, kind: 'screenshot', view: 'desktop',
caption: 'The annotate page, 1440 px wide.', alt: '…',
views: [
{ view: 'tablet', src: 'img/annotate-tablet.png', caption: 'At 820 px the list moves below the image.', alt: '…' },
{ view: 'phone', src: 'img/annotate-phone.png', caption: 'At 390 px: one column.', alt: '…' }
] }
| Field | Type | Meaning |
|---|---|---|
view |
string | Required. The view's name, different from the screen's own view and from the other entries. desktop, tablet and phone get their own icon and are listed in that order; other names follow, as written. |
src |
string | Required. The picture, as for a screen. |
w, h |
number | Optional. Its size in pixels, as for a screen. |
caption, alt |
string | Optional. What this view shows; the screen's own are used when missing. Say here what differs from the default view. |
kind and illustrative are the screen's, for every view: a screen whose views mix screenshots and wireframes should be two screens. The page shows one view of each screen at a time, with a Desktop / Tablet / Phone switch, and picks the reader's size first when the screen has it. Notes keep the view they were made on (see feedback.md). Once readers have left notes, keep the view names.
Size the pictures like the device: about 1440 px wide for a desktop, 820 for a tablet, 390 for a phone (a phone or tablet view is drawn in a device frame). An illustrative wireframe of another view draws only the layout the code produces (its CSS, breakpoints, components), and says so in its caption.
Images given by path are put inside the built page, so it opens alone. Keep them small (PNG or SVG, under about 500 KB).
Source¶
| Field | Type | Meaning |
|---|---|---|
path |
string | A file relative to the project root (web/src/pages/AnnotatePage.tsx). |
line |
number | The line where the thing named by label starts. |
label |
string | What is there, short: "submit_task(): at least one box". |
With --root, the build checks that each path exists under the root and each line is inside its file. It does not check that the line is the right one: open the file and look.
Rules¶
- No invented behaviour. Each acceptance criterion can be checked in the code: a role check on a route, an error answer and its status code, a transition of the state machine, a disabled button or a message the UI shows. Point at those places in
source. Leave a criterion out rather than guess. - Words for readers. Criteria describe what the person sees and what the system does, in plain words with the visible texts in quotes and the status codes in brackets:
Reject stays disabled until a comment is typed, and the API refuses a reject with a blank comment (422).Use Given / when / then for the main criterion of a story. - Nothing passes for a screenshot unless it is one.
illustrative: trueand a caption that says so on every wireframe, mock-up or diagram. - Real ids.
actoris apersonnode of the model or a persona;scenariois a scenario of the model;stepslies within it; everyscreen.steplies withinsteps. - Real paths. Every
source.pathexists under the project root and everylinepoints at what itslabelnames. - Status from evidence.
implementedwhen the code does it;partialwhen part of it is missing (say which innotes);plannedonly for stories the user asks for, withnotessaying where the plan comes from (an issue, a spec). A planned story's criteria describe the intent and have nosourceyet. - No private data. No secrets, tokens, personal data or real user content in screens, captions or notes.
What the build adds¶
The page receives the stories resolved. You never write these fields, but notes and checks refer to them:
key:STORIES.key, else a stable id made from the project name; the browser stores notes under it.personas: those ofstories.js, then the model'spersonnodes that are actors, withnameanddescfilled from the model.- per story: the scenario's name and
range; its goal, trigger, preconditions and outcome when the story covers all of it (or the story's own); thejourney, one entry per step in the range:{ n, from, fromName, fromType, to, toName, toType, label, reply, person }, wherenis the step number andpersonis true when a person takes the step. - per screen:
id(its own, elses1,s2, … in the order ofscreens),wandh(the image size), the image itself as adata:URL, and, when it has other views,viewandviewswith each picture inlined and sized the same way. - per source entry:
href, a link to the line in the repository whensource.repoUrlis known. - for the RDF graph (
references/stories-graph.md):rdf({ base, model }, the IRIs of the explorer's graph), per personamodel(true when the id is a person of the model), per storyownFacts(the use-case facts the story gives itself), per screen and viewfile(its picture's path relative tostories.js, or its URL).
Keeping notes attached¶
A reader's note points at the page key, a story id and a screen id. Once readers have left notes:
- do not change a story id, and set
keybefore renaming the project; - screens without an
idare numbered by position: give them ids before reordering or removing any, or add new screens at the end; - keep view names: a note on a view the screen no longer has shows on its default view (the build warns);
- replacing an image under the same id (a new screenshot of the same screen) is fine. The drawings are stored relative to the image, so the new image should frame the screen the same way.
A complete example¶
From the example project (examples/image-annotation-tool/communications/user-stories/stories.js), shortened to two stories. The second one shows the defaults: no persona (the model's admin node is used), no steps (the whole scenario), no screens (the images on the scenario's steps; this scenario has none, so the story shows its journey only).
// Written by Claude from the project brief, the explorer's model.js and the code. Plain data, no code.
// The example project was never run, so every screen is an illustrative wireframe drawn from the JSX.
window.STORIES = {
project: 'Image Annotation Tool',
summary: 'Annotators draw labelled boxes on images, reviewers approve or reject each task, and the admin exports the approved boxes as COCO JSON.',
model: '../architecture-explorer/model.js',
explorer: '../architecture-explorer/index.html',
personas: [
{ id: 'reviewer', name: 'Reviewer', desc: 'Works through the review queue and approves or rejects each task.',
goals: ['Check submitted tasks oldest first', 'Send wrong work back with a reason'] }
],
stories: [
{ id: 'review-reject', title: 'Reject a task with a comment', actor: 'reviewer',
want: 'to look at the oldest submitted task and send it back with a comment that says what is wrong',
soThat: 'the annotator knows what to fix',
scenario: 'review', steps: [1, 12],
acceptance: [
'Given submitted tasks exist, when the reviewer opens /review, then the queue lists them oldest first and the first one is selected.',
'Reject stays disabled until a comment is typed, and the API refuses a reject with a blank comment (422).',
'Rejecting moves the task from submitted to rejected and stores a review with the comment.',
'Only the reviewer role may load the queue or decide (403 otherwise).'
],
screens: [
{ src: '../architecture-explorer/img/review-queue.svg', step: 7, kind: 'wireframe', illustrative: true,
caption: 'Reject stays disabled until a comment is typed. Illustrative wireframe drawn from ReviewQueuePage.tsx, not a screenshot: the example project was never run.',
alt: 'The review queue: three submitted tasks with thumbnails, the first selected with two boxes, an empty comment box, Approve, and a greyed-out Reject.' }
],
source: [
{ path: 'api/app/routes/reviews.py', line: 24, label: 'review_queue(): submitted, oldest first' },
{ path: 'web/src/pages/ReviewQueuePage.tsx', line: 50, label: 'Reject disabled without a comment' },
{ path: 'api/app/routes/reviews.py', line: 42, label: '422 when rejecting without a comment' },
{ path: 'api/app/state_machine.py', line: 42, label: 'submitted + reject → rejected' }
],
status: 'implemented',
notes: 'Nothing locks a task while a reviewer looks at it; the second decision on a task answers 409, which the page does not show.',
tags: ['review'] },
{ id: 'export-coco', title: 'Export approved annotations', actor: 'admin',
want: 'to export the boxes of every approved task as one COCO JSON file and download it',
soThat: 'all approved work leaves the tool as one standard file',
scenario: 'export',
acceptance: [
'Given the admin is on /admin, when they click "Export approved annotations (COCO)", then an export is queued (202) and the page shows "Export #<id>: queued".',
'The file holds the boxes of the tasks that are approved when the job runs, and no others.'
],
source: [
{ path: 'api/app/routes/export.py', line: 25, label: 'request_export(): 202, queued' },
{ path: 'worker/jobs/export_coco.py', line: 18, label: "WHERE t.status = 'approved'" }
],
status: 'implemented',
tags: ['export'] }
]
};
Source
This page is skills/user-stories/references/stories-format.md, the guide the skill reads while it works. Edit it there; the documentation includes it as is. Overview: User stories and feedback.