# Build with AI

The docs as plain text, so your coding assistant writes the integration for you.

The whole documentation is available as plain text. That way a coding assistant like Claude Code or Cursor can read it and write the integration for you.

## 1. Create the packlet

You create the packlet yourself in the app, as described in the [quick start](https://packlets.app/en/docs/schnellstart.md). Store the key as the environment variable `PACKLETS_KEY`. Don't paste it into the chat with the AI.

When connecting, the app also shows a ready-made prompt under **Claude Code**, matching the channel kind you chose.

## 2. Give the AI the docs

| Address | Content |
|---|---|
| [/llms-full.txt](https://packlets.app/llms-full.txt) | The whole documentation in one file. When in doubt, use this one. |
| [/llms.txt](https://packlets.app/llms.txt) | Short table of contents with links to all pages as Markdown. |
| `/en/docs/<page>.md` | Each individual page as Markdown, for example [/en/docs/senden.md](https://packlets.app/en/docs/senden.md). |

Every docs page also has a **Copy page for AI** button at the top.

## 3. Give the task

Copy this prompt and replace the part in square brackets:

```text
First read the Packlets documentation at https://packlets.app/llms-full.txt.

Then build a Packlets integration into this project:
- A function that sends a message via POST https://api.packlets.app/v1/push.
- The key comes from the environment variable PACKLETS_KEY and is never in the code.
- Errors (400, 401, 409, 429) are reported visibly and not swallowed.
- [Describe here when a message should be sent and which buttons it has.
  For an app: which page it should show, for example open invoices
  to approve.]

If buttons without a url, elements or a chat are involved: also build a
webhook endpoint that checks the signature in the header X-Packlets-Signature
and reacts to type (button, ui, message).

For an app: build your own web page with packlets.css and packlets.js, set it
once with PUT https://api.packlets.app/v1/ui and {"page": "https://…"}, and on your
server check the session token from packlets.fetch() on every request.
```

## 4. Check

- Have the AI send a test message and look in the app.
- If nothing arrives, the activity log in the packlet's settings shows the latest calls. More under [Troubleshooting](https://packlets.app/en/docs/fehlersuche.md).
- Make sure the key didn't end up in the code or the repository.
