Spec an existing app, then change it.

Start from an app that already works. Write the version you actually want.

12 minutes to read

You already know the app. You want your own version: same job, your stack, your limits, and only the features you use.

A spec is a document that says what to build, with checks, so an agent does not have to guess. This one does not start from a blank page. The original app has already shown which behaviors matter. You write those down, then you change them into the version that does not exist yet.

Spec-driven development means writing the decisions before an agent builds. Reverse Engineer Anything is how we take those decisions out of someone else's app. This page is the edit that comes after. It shows what we changed, and why, on two specs we published.

Write it down, change it, then publish

A new spec often starts from a wish. This one starts from a product that already exists. You end up describing something that does not exist yet, using decisions the existing app already made in public.

  1. Write down what it does. Record what a person sees, the steps they take, and a check a test can run. That check is the Accept when line. Leave out how the original app is built. If a clever trick is the point, rewrite it as a rule in your own words. The Reverse Engineer Anything guide is that cut. We use REA, the open-source project, for the investigation. Behavior spec is our name for the document we keep. REA does not use that name.
  2. Change it. Turn the spec into the version you want. Swap the stack. Drop features. Add limits. Say so in the requirement and in its Accept when line. A requirement is one numbered rule. A rebuild is then checked against your version, not against the original product.
  3. Publish, if you want it shared. check_spec reads the manifest and lists every problem. The manifest is manifest.json. It says what the spec builds, which choices a person can change, and which commands it may run. publish_spec then takes the manifest and the files. Publishing needs sign-in. Spekkr emails you a code. There is no password. Publishing makes the files public. You do not have to publish. The files are already a spec in your own repo.

lineage is a field in the manifest. lineage.forkedFrom is the id of another Spekkr spec this one started from. lineage.adapters lists specs by other people that extend yours. It is not a place to name the original product, such as Excalidraw or PostHog. Both examples below leave lineage empty. They say where the design came from in research.md. The person building the spec does not need that file.

A whiteboard that stays in the browser

dwrtz/whiteboard version 0.1.1 is published by dwrtz. A choice is a setting the manifest lets you change when you pull the spec. This spec has two: the product name, which defaults to Whiteboard, and an accent colour.

Its summary is: "A hand-drawn whiteboard kept in your browser, with encrypted share links and live collaboration on Cloudflare Workers." The manifest names TypeScript, Cloudflare Workers, R2, Durable Objects, the Workers Rate Limiting binding, Wrangler, React, Vite, roughjs, perfect-freehand, Vitest, and Playwright.

The implementation repository is dwrtz/whiteboard. It is MIT licensed, and its README points at the spec. A running copy is at whiteboard.beef-able.com.

The research notes say the spec is modelled on Excalidraw, the open-source virtual whiteboard. They say Excalidraw's code is MIT licensed. They read commit 82190fb28f58070b34b4017e70c0e2e83701a8e3 on 15 November 2026, for the file format, element ordering, the shape of collaboration links, and rendering. They also record an REA capture of the excalidraw.com site in a browser on 16 November 2026. That capture checked the toolbar, the help dialog, the menu, the theme shortcut, and the welcome screen that says the drawing stays on your machine. The repository they cite is excalidraw/excalidraw.

What we kept

  • The file format. Files use the open .excalidraw and .excalidrawlib JSON formats, so a file can move either way. The notes say the spec uses no Excalidraw code, text, icons, fonts, or branding. The libraries they name are roughjs (MIT), perfect-freehand (MIT), fractional-indexing (CC0), and the font Kalam (SIL Open Font License).
  • The drawing stays in the browser. The implementation README says localStorage holds the drawing and IndexedDB holds images. There are no accounts, and the server does not store drawings.
  • Share links do not expire. Ending a session only disconnects the person who ends it. The encryption key is the part of the link after #. The browser does not send that part to the server. The bytes are compressed, then encrypted. The notes cap those compressed, encrypted bytes at 10 MB.

What we changed, and why

  • Where the shared bytes live. The notes say Excalidraw's hosted app keeps rooms and shared files in Firebase. Here, one Durable Object per room relays the live session and stores the encrypted snapshot. R2 holds the shared files. The server still cannot read them. We wanted the app on Cloudflare Workers. That is the change this spec exists to make.
  • No accounts, and no paid tier. The notes say a first version had accounts, drawings stored on the server, and read-only links. That version was cut back to the model of the app we watched. The hosted app's paid tier is not in the spec.
  • Empty rooms. A room with nobody in it is deleted after 24 hours, along with its images. The implementation README states that limit. The share links themselves still do not expire.
  • Features left out. The notes list frames, embeds, the laser pointer, elbow arrows (an imported elbow arrow draws as a plain polyline), sticky notes, crop, text-to-diagram, AI features, the command palette, find on canvas, links between elements, languages other than English, the minimap, and the public library site.
  • Fonts. Three families, instead of Excalidraw's set. Hand-drawn text uses Kalam. A font number from an Excalidraw file draws with the nearest of the three, and the original number stays in the file.
  • Phones. Version 0.1.1, dated 16 November 2026, keeps the toolbar on screen while you edit text. The notes say the text editor sits in its own layer, the way the app we watched does. The viewport meta tag stops iOS from zooming into the field.

The checks are the spec's own requirements, R1 to R27. They are not a claim that the result matches Excalidraw screen for screen. The notes say one build passed npm run typecheck, 44 Vitest tests, and 22 Playwright tests against wrangler dev, plus wrangler deploy --dry-run. Nothing was deployed from that check. Under safety, the manifest lists npm install, npx wrangler dev, and npx playwright install chromium. An agent asks before it runs a command the spec lists.

Product analytics the PostHog libraries already speak

dwrtz/product-analytics version 0.6.0 is published by dwrtz. The choices are the product name, which defaults to Analytics, and an accent colour.

Its summary is: "Self-hosted posthog-js analytics on Cloudflare: insights, flags, replay, surveys, SQL, error tracking, LLM analytics, usage caps." The manifest's stack is TypeScript on Cloudflare Workers, with Durable Objects that use SQLite, plus D1, Queues, R2, and an optional Basin cold tier (Pipelines, Catalog, and SQL). It also names Wrangler, lz-string, posthog-js, rrweb-player, esbuild, Vitest, Playwright, and posthog-node.

The implementation repository is dwrtz/product-analytics. Its description is "Self-hosted product analytics on Cloudflare Workers that takes posthog-js unchanged." The repository is MIT licensed. The README says it is the reference implementation of the spec, and that a read-only demo with made-up data is at analytics.beef-able.com.

The point of the edit is the stack, and which PostHog code it is allowed to use, not a new way to name events. The notes say the spec describes an independent service. It speaks the public wire protocol of PostHog's libraries, so the published posthog-js package (Apache-2.0 and MIT) and posthog-node work against it unchanged. They say it contains no PostHog code and no PostHog branding.

The notes name PostHog/posthog-foss as MIT, read at commit 0f73d659 on 18 November 2026, and PostHog/posthog-js at 15aef2ce, published as Apache-2.0 AND MIT. They say nothing under ee/ was opened. That directory is code PostHog does not publish under the MIT tree. The README repeats that. It says posthog-js is served unmodified from /static/, with its licence file, and that the replay player is rrweb-player (MIT).

What the notes say was kept

The bar is the libraries, not a copy of the PostHog screens. The notes record REA captures of posthog-js 1.450.1 and posthog-node 6 while they ran. They then ran the same scenarios against this server. A later run had 16 library requests, and every one returned a success status.

The README lists the routes those libraries call. They include /e, /i/v0/e, /flags, session replay at /s/, surveys at /api/surveys, and the AI endpoints added in 0.6.0. The notes say the flag hash is PostHog's, so the same person gets the same result. Text typed into a recording stays masked the way the library masks it.

What we changed, and why

  • Where events live. The 0.1 notes start with one Durable Object per project. They name 10 GB per project as the point where Basin was the planned next store. The 0.2 notes split events into one Durable Object per project per UTC month. Person records stay in a separate Durable Object, called the head. The README says a project is not limited to 10 GB, and counts stay exact. The notes say a query runs in two phases, and they do not list the two steps. That layout replaces PostHog's own pipeline with Cloudflare storage.
  • An optional cold store. Version 0.4.0, in the changelog dated 19 November 2026, streams events through a Basin Pipelines binding into an Apache Iceberg table in R2. The SQL editor can read that table. The notes say this stays off unless the binding, the Basin variables, and BASIN_TOKEN are set.
  • Error bodies. The notes say PostHog answers a capture error as plain text. This build sends JSON, with the same status and a code, because the libraries they checked read the status.
  • Location. Fields named $geoip_* come from Cloudflare's request data, not a MaxMind lookup. The notes say the names follow Cloudflare's.
  • SQL. PostHog's SQL dialect is called HogQL. The notes call this SQL a smaller set, with SQLite's rules, not HogQL. Insight filters have no regex, because SQLite has no regex function by default. Flags do support regex.
  • Replay bytes. The notes say each request is written as one chunk in R2. The layout is not a copy of PostHog's blob layout. The player is rrweb-player. The 0.2 choices keep recordings for 30 days by default.
  • Surveys hide the PostHog name by default. The 0.2 notes say so. The capture saw a PostHog footer in the popover when appearance.whiteLabel was absent. That is why the spec turns white-label on.
  • Experiments. The 0.2 choices count a person from the first time they see a variant, use a fixed seed, use a 95 percent chance that a leader is best, and wait for 50 exposures per variant before naming a winner. The notes say PostHog's ee/ experiment code was not read.
  • One team per copy. The 0.1 choices limit sign-up to the first account, or to the addresses in ALLOWED_EMAILS.
  • Usage caps and error tracking are in 0.5.0 and 0.6.0. The changelog for 0.6.0, dated 20 November 2026, adds LLM analytics for the PostHog AI events, a public demo mode, releases, and source maps. The notes say the cost figure is an estimate from list prices, not from a bill, and that PostHog's error-tracking backend was not read. How errors are grouped, and the caps, are our design. The README says the demo is read-only and needs no sign-in.

The notes also list what was left unmatched on purpose. That includes funnel events that share one timestamp, filling in events that arrived before a person record existed, and the full response shape of /flags?v=4. Web analytics, the data warehouse, and the toolbar were not studied. Those are gaps. The spec does not claim to match PostHog.

The manifest's safety commands are npm install, npx wrangler d1 migrations apply DB --local, npx wrangler dev, npm test, npm run e2e, and npx playwright install chromium. An agent asks before it runs one the spec lists.

Licences and names

Check the original project's licence and its trademarks before you publish a spec based on it. This page is not legal advice. The two specs above say what their authors read. They say it in the research notes, which you can open from each spec's page.

For the whiteboard, those notes say Excalidraw's code is MIT, and that the spec uses none of its code, text, icons, fonts, or branding. The default product name in the spec is Whiteboard. The implementation repository is MIT.

For product analytics, the notes say only the MIT posthog-foss tree and the Apache-2.0 AND MIT posthog-js package were read, and that nothing under ee/ was opened. They say the product name, the interface, and the copy are neutral. "PostHog" appears only where the protocol is attributed. The build ships the unmodified posthog-js files and their licence. The notes say those licences allow that. The implementation repository is MIT.

A name in a spec is not a claim on the original product's name. If you publish a spec based on someone else's app, use your own product name, keep the attribution your sources require, and do not present the spec as the original project.

Build it with your agent

Paste a prompt into Claude Code, Cursor, or Codex after Spekkr is connected. The agent pulls the spec and follows BUILD.md. BUILD.md is the file that says how to build. pull_spec is the tool it calls. That tool refuses a choice the spec does not offer. A choice you leave out keeps the spec's default. Searching, reading, and pulling need no sign-in.

Publishing a spec of your own is a separate step. It needs sign-in and makes the files public. Questions: support@spekkr.com.

Whiteboard

This prompt names the app Whiteboard. The accent colour stays at the spec's default.

Use Spekkr to pull the dwrtz/whiteboard spec, name the app Whiteboard, and build it by following BUILD.md.

Not connected yet? Set up your agent

Setup connects the agent to https://spekkr.com/mcp.

Exact tool call
pull_spec {"id": "dwrtz/whiteboard", "choices": {"app_name": "Whiteboard"}}

Product analytics

This prompt takes the spec's defaults. There is no choice to set.

Use Spekkr to pull the dwrtz/product-analytics spec and build it by following BUILD.md.

Not connected yet? Set up your agent

Exact tool call
pull_spec {"id": "dwrtz/product-analytics"}

How to publish

FAQ

Is this the same as copying the app?

No. The spec says what the app does, and which version you want, in your own words. It is not a copy of the original source.

Do these two specs name Excalidraw or PostHog in lineage?

No. lineage.forkedFrom is the id of another Spekkr spec, not the name of the original product. Both published manifests leave lineage empty. Each spec's research notes say which app the design came from.

Do I have to publish the changed spec?

No. Publishing needs sign-in and makes the files public. The files are already a spec in your own repo.