SA
Portal

Prompt Builder

Generate a copy-ready prompt for your AI coding agent.

Choose the job, stack, and target tool. The output updates beside the form.

Live prompt builderUpdates instantly

Build the implementation brief

Start with the job, then choose the target and framework. The generated prompt stays grounded in documented packages, env vars, endpoints, and shipping checks.

Step 1 · What are you building?

Embed an AI chat assistant with widget config, session creation, and messaging.

Generated prompt

Copy this into your coding tool, or open the ServiceAgent installer for your builder from the same workspace.

Cursor

Optimized for repo-aware coding agents that can edit files and run commands.

Cursor markdown prompt
Generate an implementation for Cursor using ServiceAgent.

## Objective
Add a ServiceAgent chat assistant to our product and make the integration production-ready.

## Stack and package selection
- Framework/runtime: Next.js
- Primary ServiceAgent use case: Chat widget
- Install and use @serviceagent/nextjs via `npm install @serviceagent/nextjs`
- Install and use @serviceagent/cli via `npx @serviceagent/cli add`

## Required ServiceAgent endpoints and capabilities
- GET /v1/api/widget/:widgetKey/config: Fetch public widget configuration for the selected widget key.
- POST /v1/api/widget/:widgetKey/session: Create a visitor chat session before the first message.
- POST /v1/api/widget/:widgetKey/session/:sessionId/messages: Send follow-up chat messages after the session is created.

## Environment variables and auth
- NEXT_PUBLIC_SERVICEAGENT_WIDGET_KEY
- NEXT_PUBLIC_SERVICEAGENT_API_URL
- Use the official env var names exactly as written.

## Implementation order
1. Install the framework-native ServiceAgent package instead of hand-writing widget embeds.
2. Add the documented widget environment variables before rendering the component.
3. Create the chat surface, then wire session creation and message sending if custom UI is needed.
4. Keep chat setup isolated in one component so later voice or booking surfaces can reuse the same config.

## Cursor execution instructions
- Work directly in the existing repository and prefer editing the current codebase over proposing abstract snippets.
- Make package selection explicit and do not substitute unofficial ServiceAgent packages.
- Do not invent endpoints or env vars beyond the documented items listed below.
- When custom UI is needed, keep it production-lean and wire it to the documented integration path.

## Reference docs
- Quickstart: /quickstart
- @serviceagent/nextjs: /packages/nextjs
- @serviceagent/react: /packages/react
- @serviceagent/cli: /packages/cli

## Acceptance criteria
- The app renders a ServiceAgent chat entry point without layout regressions.
- The generated code uses the documented widget config and session endpoints only.
- Any custom chat UI can create a session and post follow-up messages successfully.
Packages

@serviceagent/nextjs · @serviceagent/cli

Endpoints

GET /v1/api/widget/:widgetKey/config · POST /v1/api/widget/:widgetKey/session · POST /v1/api/widget/:widgetKey/session/:sessionId/messages

Env vars

NEXT_PUBLIC_SERVICEAGENT_WIDGET_KEY · NEXT_PUBLIC_SERVICEAGENT_API_URL