# Set up Materialize

Set up a live Materialize demo for me, on simulated data that looks like mine.
Work through these steps in order, and stop to ask me if one fails.

1. Install Materialize's agent skills:

   ```
   npx -y skills add MaterializeInc/agent-skills --skill '*' -y
   ```

   Claude Code can use the plugin instead: run
   `/plugin marketplace add MaterializeInc/agent-skills`, then
   `/plugin install materialize@materialize`. If the skills only load after a
   restart, tell me.

2. Start the Materialize Emulator in Docker and connect to it.
   If Docker isn't running, tell me to start Docker Desktop and stop.
   If a container is already listening on port 6875, reuse it. Otherwise run:

   ```
   docker run -d --name materialize \
     -p 127.0.0.1:6874:6874 -p 127.0.0.1:6875:6875 \
     -p 127.0.0.1:6876:6876 -p 127.0.0.1:6877:6877 \
     materialize/materialized:latest
   ```

   The first pull takes a minute. Wait until `SELECT mz_version();` succeeds,
   then report the version.

   - SQL: `psql "postgres://materialize@localhost:6875/materialize"`.
     If psql isn't installed, install it: `brew install libpq`, or
     `apt-get install postgresql-client`.
   - MCP (optional, for health checks): `http://localhost:6876/api/mcp/developer`
   - Console: `http://localhost:6874`

3. Ask me what I want to build. Offer these, and say I can also describe my
   own data in a sentence:

   - Gaming: a live leaderboard and store revenue for a multiplayer game,
     updated as every match ends.
     (`gaming.players`, `gaming.matches`, `gaming.purchases` ->
     `gaming.player_leaderboard`)
   - Finance: live P&L for every client account, marked to market on every
     price tick.
     (`finance.accounts`, `finance.prices`, `finance.trades` ->
     `finance.portfolio_pnl`)
   - Manufacturing: live OEE for every machine on the factory floor, from
     sensor telemetry and finished work orders.
     (`manufacturing.machines`, `manufacturing.sensor_readings`,
     `manufacturing.work_orders` -> `manufacturing.machine_health`)

   Wait for my answer before writing any SQL.

4. Use the `mz-demo-data` skill to propose 2-3 live sources and one
   materialized view that joins them, in plain language: the entities, their
   columns, and the question the view answers. If I picked a suggestion, use
   the names above. Otherwise, name the schema after my domain. Wait for my
   OK, then build the sources. Each source should update every second and
   start with an hour of history.

5. Create the materialized view that joins all the sources into the metric I
   care about most.

6. Prove it's live: run `SUBSCRIBE` on a small slice of the view
   `WITH (PROGRESS)` for about 10 seconds (in psql, wrap it in
   `COPY (...) TO STDOUT`) and show me rows changing.

7. Create an index on the view's lookup key, then run the `SELECT` an app
   would send: a point lookup served from the in-memory index. Report how long
   it took.

8. Report what you created, the output that proves steps 6 and 7, and
   anything that failed. Then ask whether I want to connect my real data:
   PostgreSQL, MySQL, SQL Server, Kafka or a webhook.

Documentation: https://materialize.com/docs/
Full documentation index for agents: https://materialize.com/docs/llms.txt
