--- title: "Install with AI: add Userflow.js to your app with your AI coding agent" slug: "install-with-ai" description: "Install Userflow.js effortlessly with your AI coding agent, ensuring accurate initialization and user identification without manual coding hassles." tags: ["Environment Token", "Userflow Installation", "AI Coding Agent"] updated: 2026-11-02T14:55:04Z published: 2026-11-02T14:55:04Z canonical: "help.userflow.com/install-with-ai" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.userflow.com/llms.txt > Use this file to discover all available pages before exploring further. # Install with AI The Userflow Installation Skill installs Userflow.js into your project through your AI coding agent. The agent reads your codebase, works out where initialization and identification belong for your framework, writes the code, and checks the result, so you don't have to translate installation docs into your own architecture. ### Download [](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/install-with-ai(1).md)install-with-ai17.19 KB[](https://cdn.us.document360.io/9697557a-eb5d-476f-9b09-062b0f7bdcbd/Images/Documentation/install-with-ai(1).md) #### Before you start You'll need: - A Userflow account with access to **Settings → Environments** or **Settings → Installation** - An AI coding agent with access to your project files — Claude Code, Cursor, GitHub Copilot, Codex, Windsurf, and others all work - A development or staging environment to test in, so you're not validating against live users - No Userflow MCP server required ## Step 1: Get your environment token Userflow issues a separate token for each environment. Take the token for the environment this build targets — a Production token in a Staging build will mix content and users across both. **Option A: Settings → Environments** 1. Open **Settings** in Userflow, then select **Environments**. 2. Copy the **Userflow.js Token** for the environment you're installing into. **Option B: Settings → Installation** 1. Open **Settings → Installation** and select your environment. 2. The install snippet appears with your token already filled in, on both the **NPM** and **HTML** tabs. 3. If someone else is doing the install, use **Copy all instructions (to send to a developer)** to hand over the snippet with the token included. Keep the token nearby — your agent will ask for it. ## Step 2: Add the skill to your agent Quickest route—paste this into your agent's chat. Nothing to install: ```plaintext Install Userflow.js in this project. Use the Userflow installation skill: https://raw.githubusercontent.com/userflow/ai-skills-library/refs/heads/main/skills/install-with-ai/SKILL.md ``` To add it permanently with the Claude Code plugin or skills.sh, see [Add Userflow coding skills to your agent](https://help.userflow.com/docs/add-userflow-coding-skills-to-your-agent). In Claude Code, run `/userflow:install-with-ai` once it's added. ## Step 3: Run the skill Open your coding agent with access to your project and ask it to install Userflow. The skill reads your codebase before it asks you anything, then confirms what it found — your framework, where users sign in and out, and which field to use as the user ID. Once you confirm, it writes the installation. Expect it to ask for your environment token, and to check whether you want any user or company attributes included from the start. ## What the skill does - **Reads your codebase first**, so you're not answering questions your code already answers — framework, bundler, auth flow, and user model. - **Places the code correctly for your framework**, including the client-side-only handling that Next.js App Router, Pages Router, Nuxt, and other server-rendered setups require. - **Identifies only signed-in users.** Identification stays on the authenticated path and never runs on public or marketing pages, which is what protects your Monthly Active User count. - **Guards against duplicate identification** with `isIdentified()`, and handles account switching correctly. - **Wires** `reset()` **on sign-out**, including the server-redirect logout pattern used by JSP, PHP, Rails, and Django apps. - **Checks your Content Security Policy** if you have one, so Userflow.js isn't silently blocked. - **Leaves a note in** `AGENTS.md` recording how Userflow is installed, so future agent sessions extend the setup instead of installing it a second time. The default installation is deliberately minimal: initialize, identify after sign-in, reset on sign-out. Advanced functions are added only if you ask for them. ## If you don't have codebase access Tell the skill you're scoping the work for a developer. Instead of writing code, it produces a `USERFLOW_INSTALL_SPEC.md` file containing the install method, token strategy, the exact code with your user ID field named, where each call belongs, and a verification checklist. The spec is self-contained, so your developer can implement it without seeing your conversation. ## Step 4: Verify the installation 1. Deploy to the environment whose token you used. 2. Sign in as a real or test user. 3. Open Userflow and confirm the user appears with the attributes you sent. The installation check in **Settings → Installation** confirms the script is detected. 4. Load a public page while signed out and run `userflow.isIdentified()` in your browser console. It should return `false`. That last check matters most. It confirms anonymous visitors aren't being identified, which is the difference between a correct install and an unexpected MAU bill. ## Troubleshooting **Nothing appears in Userflow** Open your browser console and check for load errors, including Content Security Policy violations. Then confirm in the Network tab that a request fired after sign-in, that your token matches the environment you're viewing, and that no placeholder values were left in the code. **Content shows in the wrong environment** Almost always a token mismatch. Check that each build uses the token for its own environment. **Your MAU count is higher than expected** Check whether identification can run on a public or signed-out page. Ask your agent to review every `identify()` call site and confirm each one sits behind authentication. **The skill asks for something you don't have** Pause and gather it, or tell the skill you don't have codebase access and it will produce the developer specification instead. **Still stuck** Browse the [Userflow documentation](https://help.userflow.com/), ask your coding agent to explain what it installed, or contact Userflow support. --- ### FAQ #### **Which coding agents does this work with?** Any agent that can read a `SKILL.md` file or fetch a URL, including Claude Code, Cursor, GitHub Copilot, Codex, and Windsurf. The skill is plain Markdown. #### **Is my code or token sent to Userflow?** No. The skill runs entirely inside your coding agent. Your code stays in your environment, and your environment token is used only by the Userflow.js script installed in your project. #### **Do I need the Userflow MCP server?** No. The skill is a Markdown file your agent reads, so it works standalone. The Userflow MCP server is a separate, optional integration and isn't required for installation. #### **Will this cause an MAU overage?** Not with a default install. The skill identifies authenticated users only and never identifies anonymous visitors unless you explicitly ask for that behavior. #### **Can I run it again later?** Yes. It detects an existing installation and won't duplicate it. #### **What if I'm not technical?** Use the developer handoff path. The skill produces a complete specification your developer can implement without any further context. #### **Can I see what the skill actually does?** Yes. Read the full [install-with-ai](https://github.com/userflow/ai-skills-library/blob/main/skills/install-with-ai/SKILL.md) skill on GitHub. > **The skill writes real code into your project.** Review what your agent produces before merging or deploying. Human oversight is recommended for every installation. ## Related - [Verify with AI](/verify-with-ai.md) - [Developers](/developers.md) - [AI Playbooks and Skills](/ai-skills-library.md)