> ## Documentation Index
> Fetch the complete documentation index at: https://docs.elata.bio/llms.txt
> Use this file to discover all available pages before exploring further.

# 克劳德·科德

> 使用 Claude Code 结合 Elata SDK 和 Elata API 构建 Elata 应用。

## 概述

当 Claude Code 了解 Elata 的运作方式（沙箱、SDK 包和上传规则）时，它在 Elata 应用上的表现最好。本页提供一个可直接粘贴的项目上下文文件，以及常见任务的提示词。

***

## 设置

1. 按照 [Claude Code 文档](https://docs.claude.com/en/docs/claude-code/overview)安装 Claude Code。
2. 在项目目录中打开终端并运行 `claude`。
3. 在项目根目录添加 `CLAUDE.md` 文件，内容如下。

***

## 项目上下文

将以下内容保存为项目根目录下的 `CLAUDE.md`（保持英文，便于 AI 工具理解）：

```markdown CLAUDE.md theme={null}
# Elata app

This is a browser app for Elata (https://app.elata.bio), built on
the Elata SDK. It is a static web build that runs inside a sandboxed
iframe in Elata.

## Docs
- Docs home: https://docs.elata.bio (full text for agents: https://docs.elata.bio/llms-full.txt)
- Building apps: https://docs.elata.bio/apps/build/overview
- Host bridge (Elata APIs): https://docs.elata.bio/apps/platform/host-bridge
- SDK overview: https://docs.elata.bio/sdk/overview
- Package references for agents: node_modules/@elata-biosciences/<package>/llms.txt

## Packages
- @elata-biosciences/rppg-web: camera heart rate (use createRppgSession)
- @elata-biosciences/eeg-web + eeg-web-ble: EEG over Web Bluetooth (Muse built in)
- @elata-biosciences/ppg-web: headband PPG heart rate and HRV
- @elata-biosciences/biosignal-session / biosignal-analytics: recording and analysis (not yet on npm)
- @elata-biosciences/app-payments: in-app purchases (Elata checkout)
- @elata-biosciences/app-state: per-user key-value storage (not yet on npm; use the elata:state:* messages)
- @elata-biosciences/app-metrics: event records, scores, reportAffect

## Elata rules
- The build must actually use an Elata sensor SDK (rPPG, EEG, or PPG), or upload fails.
- Ship a zip with index.html at the root; use relative asset URLs.
- Never handle wallets, payments, or sessions in the app. Use app-payments for purchases.
- Never send raw camera frames, audio, or raw biosignals off the device.
- Never access window.parent beyond postMessage.
- Put the release version in public/elata.json: { "version": "x.y.z" }.

## Commands
- npm run dev        start the dev server
- npm run build:zip  build and write app.zip for upload
```

***

## 常用提示词

### 创建新应用

```text theme={null}
Scaffold a new camera heart-rate app with
npm create @elata-biosciences/elata-demo my-app -- --template rppg
and explain the project structure.
```

### 在现有应用中添加 SDK

```text theme={null}
Add camera heart rate with @elata-biosciences/rppg-web. Use createRppgSession,
show signal quality, and stop the camera when the component unmounts.
Read node_modules/@elata-biosciences/rppg-web/llms.txt first.
```

### 添加购买

```text theme={null}
Add a "Pro theme" unlock with @elata-biosciences/app-payments. Gate the UI on
getOwnedItems(), branch on result.status (not txHash), and re-apply owned
benefits on startup.
```

### 保存进度

```text theme={null}
Persist the player's settings and best score with Elata's elata:state:get/set messages.
Fall back to localStorage when Elata replies with not_authenticated.
```

### 准备上传

```text theme={null}
Check that this build is ready for Elata: index.html at the zip
root, relative asset paths, SDK usage present, and public/elata.json with the
version from package.json. Then run npm run build:zip.
```

***

## 提示

> [!TIP]
>
> 在让助手编写集成代码之前，先让它阅读 `node_modules` 中对应包的 `llms.txt`。这些文件专为 AI 工具编写，列出了受支持的 API 和常见错误。

* 从 `create-elata-demo` 模板开始，再逐步迭代。
* 提交前在 Elata 的试玩窗口中测试。沙箱的行为与 `localhost` 不同。

***

## 下一步

> [card] [开发者概览](https://docs.elata.bio/cn/apps/build/overview.md)
>
> 发布如何进行

> [card] [SDK 概览](https://docs.elata.bio/cn/sdk/overview.md)
>
> Elata SDK 包


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.