Skip to content

BFF scripts: local and remote in sync

This page explains how to have an Agent develop and sync BFF scripts on the platform. You don't need to memorize sync commands — describe the server-side logic you want to add, change, reuse, or publish, and the Agent checks local files, platform resources, and risks.

Tasks to hand to the Agent

  • Check whether local BFF scripts match the platform.
  • Add an endpoint-style script for the frontend or pages to call.
  • Extract duplicated logic into a shared function.
  • Add hook logic to dataset operations.
  • Push local changes to the platform, or pull platform scripts back to local.

Prerequisites

  • The target project is open, and you've confirmed it's the app you want to modify.
  • You know this logic's inputs, outputs, and callers.
  • When live impact is possible, ask the Agent to preview the diff and risks first.

Common prompts

Check local vs. platform consistency

text
请帮我检查当前项目的 BFF 脚本和平台是否一致。
请列出:本地已修改但未同步的脚本、平台有但本地没有的脚本、可能冲突的脚本。
先不要执行覆盖或删除,只给我差异和建议处理方式。

The AI may call: rabetbase bff status, rabetbase bff list, rabetbase bff detail.

Add an endpoint-style script

text
请帮我新增一个 BFF 接口,名称是「客户跟进摘要」。
它用于「客户详情页展示最近 5 条跟进记录、下一次跟进时间和未完成待办数量」。
输入参数包括「customerId」,返回字段包括「最近跟进记录列表、下一次跟进时间、未完成待办数量、最后跟进人」。
请先根据相关数据集确认字段和查询方式,再生成脚本,并告诉我如何验证。

The AI may call: rabetbase dataset detail, rabetbase dataset operations, rabetbase bff create, rabetbase bff push.

Extract shared logic

text
我发现「客户详情页、销售工作台、客户列表页」里都在计算客户跟进状态。
请帮我抽成一个公共 BFF 函数,并调整调用方复用它。
修改前先列出会影响哪些脚本,修改后给出验证清单。

The AI may call: rabetbase bff list, rabetbase bff detail, rabetbase bff status, rabetbase bff push.

Add a data operation hook

text
请为「客户」数据集的「更新客户状态」操作增加一个钩子。
业务规则是:当客户状态变为「已成交」时,自动写入一条成交跟进记录,并更新客户最近跟进时间。
请先确认这个操作的入参和返回结构,再生成脚本。
执行前预览影响范围,避免影响无关操作。

The AI may call: rabetbase dataset operations, rabetbase bff create, rabetbase bff push.

Sync to the platform

text
本地的「客户跟进摘要」脚本已经改完。
请先检查它和平台当前版本的差异,说明是否会覆盖远端内容。
如果风险可接受,再把它同步到平台,并告诉我同步结果和验证方式。

The AI may call: rabetbase bff status, rabetbase bff detail, rabetbase bff push.

What to add to your prompt

  • Script goal: query, write, validate, extract shared logic, or hook into an operation.
  • Inputs and outputs: parameter names, required fields, returned fields, error-handling requirements.
  • Dependencies: related datasets, SQL, frontend pages, or callers.
  • Sync strategy: check only, pull to local, push to platform, or preview-then-execute.

Completion checks

  • The Agent has listed which local files were added or modified.
  • Platform and local script states match, or the differences are explicitly kept.
  • Script inputs and outputs match the business requirement.
  • There's a runnable way to verify — sample parameters, a page call, or a runtime test run.

Next step: if the script depends on complex queries, start with "Custom SQL: from writing to execution". To generate frontend call snippets, continue with "Code generation and menus".

基于飞书知识库同步生成,内容以飞书源文档为准