Skip to content
Back to skills

Build Screen

ASecurity

Builds the LiveView for a slice whose domain is already built, from its screen brief (docs/screens), its slice.json and the board mockup. The second pass of the kit — the slice is Waiting for its screen.

  • 3 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 1, 2026
developmentgonode

Works with

  • cli
  • mcp

Security analysis

A100/100

Scanned December 3, 2026

npx -y skills add ortegacmanuel/eventmodelers-elixir-fact-kit --skill build-screen --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Build Screen?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Build Screen
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ortegacmanuel-build-screen/badge)](https://www.skillsdirectory.com/skills/ortegacmanuel-build-screen)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: build-screen
description: Builds the LiveView for a slice whose domain is already built, from its screen brief (docs/screens), its slice.json and the board mockup. The second pass of the kit — the slice is Waiting for its screen.
---

# Build a slice's screen

Written for **Datumo 0.6** (`{:datumo, "~> 0.6"}`). The framework's source is in
`deps/datumo/lib/datumo/`; its docs at https://hexdocs.pm/datumo.

The domain is built and tested; the slice waits for its screen. Your job is the
LiveView, nothing else: **presentation only**. The domain, its Context and its
tests are not yours to change.

## What you read, in this order

1. **The brief: `docs/screens/<slice-in-kebab>.md`.** It is the contract —
   how the screen reads (the Context's functions, verbatim), what it sends back
   and the error atoms, where it lives, what follows the interaction, the states
   to render, and *what the domain does not give you*. If there is no brief,
   stop: the first pass didn't finish (`request-feedback`). Briefs can go
   stale after a refactor: **when the brief and the code disagree on a route,
   module or helper, the code wins** — say so in your report.
2. **The slice: `.build-kit/.slices/<Context>/<slice>/slice.json`.** The
   screen's `fields` and `description`; the command's fields (each with
   `optional`); the read model's fields.
3. **The mockup.** The brief says whether one exists and gives the screen
   node's id. If it does, `mcp__eventmodelers__get_node` with that id: the
   HTML is in `meta.pages` (one string per page — a page is a state or a step).
   It gives **structure, content and order**, never style.
4. **The project's visual language.** If the project has a `learn-styleguide`
   skill, read it: it wins over everything below. Otherwise the language is the
   project's `core_components.ex` (`<.input>`, `<.button>`, `<.header>`,
   `<.table>`, `<.form>`) and its existing LiveViews: build like they do, and
   never copy the mockup's classes, colours or inline styles.
5. **The code the brief points at:** the Context, the command module (its
   `changeset/2`), and the router line and LiveView of «Where it lives». If the
   LiveView already exists, read it whole before you touch it, and change only
   what the slice's change requires.
6. **Who links here.** `grep -rn "<the route's path>" lib/` — including paths
   built as strings. The links decide the URL params the screen receives, and
   the brief doesn't always list them.

## Where it goes

- The route is the brief's. **An existing route and LiveView first**: a new
  slice's screen almost always goes into the page that already shows its read
  model.
- A **new route** in an existing scope is yours to add, next to its siblings in
  `router.ex`.
- A **new entry in the navigation is never yours.** Stop and say so
  (`request-feedback`): the product owner decides it.

## How it's built

- **The skeleton:** the layout, page title and breadcrumbs of the sibling pages
  in the same section — copy them from a sibling, don't guess.
- **Read through Contexts only.** Every value on screen comes from a Context's
  function: the one the brief names, and — when the brief names only a
  command — the read model that tells **whose it is and what to put in the
  header**, the one its sibling pages use. Say which in your report. The
  mockup's text is sample data. A pure domain helper that only turns a value
  into a label is fine; reading the event store yourself is not.
- **Not found.** An id from the URL that doesn't exist (or isn't the user's)
  renders an empty state with a way back, never a crash.
- **A command means one form, from its changeset** (`.build-kit/CLAUDE.md`,
  «When the screen gets built»):
  - build `<Command>.changeset(params, derived)` with placeholders (`"-"`)
    for what the Context derives (ids, instants, the session's user), then
    `to_form(changeset, as: …, action: action)` — in `mount` with `nil`, on
    `phx-change` with `:validate`.
  - Fields with the project's input component, which shows each error under
    its field once it was touched or the form submitted (`used_input?/1`).
  - On submit, `{:error, %Ecto.Changeset{}}` → the same `to_form` with
    `action: :insert`; any other `{:error, atom}` → a notice with its sentence.
    **Every atom the brief lists gets its sentence** (the project may keep them
    in one module, e.g. `DomainErrors`), and a catch-all.
  - A changeset error on a field the form doesn't show (one the Context
    derives) goes to the notice, not under a field.
  - Uploads: validate the form before `consume_uploaded_entries`, and put the
    file's key in the params (`""`) so its error shows.
- **After the interaction** is the brief's: navigate where it says, with its
  flash, or stay and repaint. If the brief names no destination, go back where
  the screen was opened from, with a short flash that says what changed —
  follow the wording of its siblings — and say so in your summary.
- **States:** every state the brief lists renders: empty, partial, complete,
  error. A read model with no events is a state, not a crash.
- **Tables:** the row isn't clickable; the name is a link, and an action the
  mockup puts on the row stays its own button.
- **Dates, money and numbers** through the project's formatting helpers if it
  has them; never shift a time zone by hand.
- **Copy** in the project's language, from the board (the screen's
  `description`, mockup text that isn't sample data) and the brief. Never
  claim more than the domain does.
- **What the domain does not give you stays out.** If the screen can't work
  without it, stop (`request-feedback`); don't fake it in the screen and don't
  change the Context.
- **No prose:** no `@moduledoc`, no `@doc`; a comment only for what the board
  doesn't carry.

## How you check it

The kit writes only scenario tests: **no LiveView tests go in `test/`.** Check
the screen with a throwaway script outside the project, run with
`MIX_ENV=test mix run --no-start <script>`:

```elixir
{:ok, _} = Application.ensure_all_started([:phoenix, :phoenix_live_view, :phoenix_pubsub])
{:ok, _} = Phoenix.PubSub.Supervisor.start_link(name: MyApp.PubSub)
{:ok, _} = MyAppWeb.Endpoint.start_link()
import Phoenix.LiveViewTest, only: [rendered_to_string: 1]
mk = fn extra -> %Phoenix.LiveView.Socket{assigns: Map.merge(%{__changed__: %{}, flash: %{}, live_action: nil}, extra)} end
html = fn mod, s -> rendered_to_string(mod.render(s.assigns)) end
```

- Add whatever the router's `on_mount` puts in the assigns (a current user or
  scope): read it from a sibling LiveView.
- `mount` usually reads the store, which isn't up: build the socket's assigns
  by hand with a read model shaped like the Context's return, and call
  `render/1`, `handle_event/3` and `handle_params/3` directly.
- Render every state of the brief; for a form, the empty submit (every
  required field's message), one bad value per validation, and a valid submit.
  A valid submit reaching the store raises (no `Fact.Registry`) — that counts
  as "reaches the store".
- A Context that reads the store **before** building its changeset can't show
  submit-time field errors without a store: check them through `phx-change`,
  and report the Context — it should call `new/2` first.
- Then `mix precommit`.

The browser check — the real page, every state — is the reviewer's or the
product owner's QA, not yours.

## When you're done

Report, in a few lines: the route and LiveView, each state you rendered and
how you checked it, every place you had to decide something the brief didn't
say, and anything you stopped on.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.