# Create flows with Claude Code

> Let Claude Code or another coding agent read your product's code and tests and propose demo flows as drafts, through the TalkDemo CLI or MCP server.

Source: https://talkdemo.com/help/product-and-flows/create-flows-with-claude-code · Updated 2026-11-20

## Key takeaways

- A coding agent such as Claude Code can read your routes, pages and end-to-end tests and write demo flows with stable selectors and narration.
- It works through the TalkDemo CLI (npx @talkdemo/cli) or the TalkDemo MCP server, with a workspace API key you create in Settings, API keys.
- Flows arrive as drafts. A person on your team reviews each one and marks it active; the key can never activate, archive or delete a flow, or change an active one. It can update a draft it pulled.
- Sign-in steps, passwords and secret-looking values are removed on TalkDemo's side, exactly as for an imported recording.

Your developers already have the best map of your product: its code. A coding agent such as Claude Code can read your routes, navigation and end-to-end tests, pick the journeys buyers ask about, and propose them as TalkDemo flows with stable selectors and spoken narration. Each one lands on the **Flows** tab as a draft for you to review.

**Who can do this:** Admin (creates the API key), Admin or Member (runs the agent and reviews drafts). · **Plans:** live product mode (Growth and up).

## Before you start

- The agent's demo tenant is saved on **Product**. See [Connect your demo tenant](/help/product-and-flows/connect-your-demo-tenant).
- A workspace admin creates an API key in **Settings → API keys** with **Propose draft flows**, ideally limited to this agent. See [API keys](/help/team-and-settings/api-keys).

## Create flows

1. Open **Agents**, choose the agent and open **Flows**.
2. Click **Add flow**, open the **Create flows with Claude Code** tab and click **Copy the prompt**.
3. In a terminal inside your product's repository, set the key: `export TALKDEMO_API_KEY=tdk_live_…`
4. Start Claude Code there and paste the prompt.

The prompt has the agent run `npx -y @talkdemo/cli init`, which adds a `.talkdemo` folder with the rules for coding agents (`TALKDEMO_FLOWS.md`), the flow format and your agent's id. The agent then reads your demo tenant's allowed pages and guardrails, writes each flow to `.talkdemo/flows/`, checks it with `talkdemo validate`, and proposes it with `talkdemo push`. It finishes with a summary: the drafts it created with their review links, the steps that need a look, and any `data-testid` attributes it suggests adding, as a change for your developers to review.

Prefer tools over a terminal? Connect the TalkDemo MCP server instead, and the agent gets `get_flow_context`, `validate_flow` and `propose_flow` as tools:

```
claude mcp add talkdemo -e TALKDEMO_API_KEY=tdk_live_... -- npx -y @talkdemo/cli mcp
```

## Review the drafts

New drafts appear in the Flows list with the source **Claude Code**. Open each one, check the steps and the narration, and click **Mark active** when it is right. Steps flagged **Needs a review** must be fixed and marked reviewed first.

## What the coding agent can and can't do

| It can | It can't |
|---|---|
| Read the agent's demo tenant address, allowed pages, guardrails and existing flows | See the demo login, login steps or any credential |
| Validate flows and add them as drafts | Activate, archive or delete a flow, or change an active one |
| Read a flow to improve it: a draft is updated in place, an active flow gets a new draft beside it | Use the key for any other agent when the key is limited to one |

Every flow goes through the same checks as an imported recording: sign-in steps and secret-looking values are removed, and pages outside your allowed hosts and paths are flagged. See [Import a flow recording](/help/product-and-flows/import-a-flow-recording).

## Frequently asked questions

### Does TalkDemo see our source code?
No. The coding agent runs on your developer's machine. TalkDemo only receives the flows it proposes.

### Will the agent change our code?
Not on its own. The rules tell it to suggest `data-testid` attributes as a separate change for your developers to review, and never to edit application code silently.

### Can we run it again?
Yes. Pushing the same files again doesn't create duplicates. To improve a flow, the agent pulls it with `talkdemo pull`, edits it and pushes it again:

- A **draft** is updated in place. It keeps its place in the Flows list, with the new name, question and steps. If someone on your team edited that draft in TalkDemo after the pull, the push is refused so their changes aren't lost; pull it again first.
- An **active** flow is never changed. The edit arrives as a new draft beside it; archive the old flow once the new one is active.

To make a new draft from a draft instead, pull it with `talkdemo pull <flowId> --new`.
