Skip to content

R&D team metrics insights: a playbook

Rabetbase CLI turns all of a team's SQL, BFF, and datasets into queryable, structured data assets. It isn't just a developer productivity tool — it's infrastructure for AI-ifying business processes. When every development action is captured on the platform, AI can answer questions that used to require human judgment: Who has the highest code reuse rate? Who keeps reinventing the wheel? Where is the architectural debt hiding? How do you quantify each person's contribution?

In essence, this is about using AI for continuous insight into team health, architectural consistency, and collaboration blind spots — instead of subjective assessments or after-the-fact retrospectives. This playbook is an execution guide for AI Agents: when a user makes one of the requests below, the AI follows the corresponding path.


Case 1: Analyzing SQL reuse

Example user prompts:

"Analyze the team's SQL reuse" "Which SQL is referenced by multiple BFFs" "Are there any orphaned SQL entries"

AI execution path:

Bash
# Step 1: 拿 SQL 清单
rabetbase sql list --format json > /tmp/sql_list.json

# Step 2: 拿 BFF 清单,遍历每个 BFF 的代码,搜索 SQL 引用
rabetbase bff list --format json | jq -r '.[].id' | while read id; do
  CODE=$(rabetbase bff detail "$id" --format json | jq -r '.code // ""')
  echo "=== BFF: $id ==="
  for sql in $(cat /tmp/sql_list.json | jq -r '.[].sqlCode'); do
    echo "$CODE" | grep -q "$sql" && echo "  -> $sql"
  done
done

Output format:

Plain
SQL 复用率:
┌──────────────────┬───────┬──────────────────┐
│ SQL              │ 引用数 │ 等级             │
├──────────────────┼───────┼──────────────────┤
│ get_user_profile │   8   │ ⭐⭐⭐ 核心资产   │
│ get_order_list   │   5   │ ⭐⭐ 高复用      │
│ debug_v3         │   1   │ ⚠️ 孤岛         │
└──────────────────┴───────┴──────────────────┘

Case 2: Detecting duplicate BFF code (DRY violations)

Example user prompts:

"Is there duplicate BFF code" "Which BFFs look nearly identical" "What DRY violations exist"

AI execution path:

Bash
# 收集所有 BFF 代码到文件
rabetbase bff list --format json | jq -r '.[].id' | while read id; do
  NAME=$(rabetbase bff detail "$id" --format json | jq -r '.name')
  CODE=$(rabetbase bff detail "$id" --format json | jq -r '.code // ""')
  echo "=== $NAME ===" >> /tmp/bff_all.txt
  echo "$CODE" >> /tmp/bff_all.txt
  echo "" >> /tmp/bff_all.txt
done

Then run a similarity comparison in Python inside Claude Code:

Python
import subprocess, json, difflib

bff_list = json.loads(subprocess.run(
    ['rabetbase', 'bff', 'list', '--format', 'json'], capture_output=True, text=True
).stdout)

bffs = {}
for b in bff_list:
    detail = json.loads(subprocess.run(
        ['rabetbase', 'bff', 'detail', b['id'], '--format', 'json'],
        capture_output=True, text=True
    ).stdout)
    bffs[b['name']] = detail.get('code', '')

for name_a, code_a in bffs.items():
    for name_b, code_b in bffs.items():
        if name_a >= name_b: continue
        ratio = difflib.SequenceMatcher(None, code_a, code_b).ratio()
        if ratio > 0.7:
            print(f"⚠️ DRY违规: {name_a} <-> {name_b} (相似度 {ratio:.0%})")

Output format:

Plain
⚠️ DRY 违规:
- user/listHandler.ts <-> user/listV2.ts (82%)
- order/priceCalc.ts <-> order/priceCalcLegacy.ts (91%)

Case 3: Seeing the full team data model

Example user prompts:

"What datasets does the team have" "How are the datasets related" "Are there orphaned datasets"

AI execution path:

Bash
# 数据集清单
rabetbase dataset list --format json | jq '.'

# 数据集关联图(PK/FK/JOIN)
rabetbase dataset links --format json | jq '.'

To find orphaned datasets (no relations at all):

Bash
rabetbase dataset links --format json | jq '
  [.datasets[] |
   select(. as $ds |
     [.links[] |
       select(.fromDataset == $ds.name or .toDataset == $ds.name)] |
       length == 0
   ) |
   .name
  ]
'

Case 4: Contribution stats (aggregated per person)

Example user prompts:

"Who wrote the most SQL on the team" "How many BFFs were added this week" "How much did each person contribute"

AI execution path:

Bash
# SQL 按创建者聚合
rabetbase sql list --format json | jq '
  group_by(.createdBy // "未知") |
  map({author: .[0].createdBy, count: length, sqlCodes: [.[]|.sqlCode]})
'

# BFF 按创建者聚合
rabetbase bff list --format json | jq '
  group_by(.createdBy // "未知") |
  map({author: .[0].createdBy, count: length, bffIds: [.[]|.id]})
'

Output format:

Plain
贡献热力图:
┌──────────┬───────┬───────┐
│ 开发者   │ SQL数 │ BFF数 │
├──────────┼───────┼───────┤
│ zhangsan │  12   │   8   │
│ lisi     │   9   │   5   │
│ 未标注   │  20   │   7   │
└──────────┴───────┴───────┘

Case 5: Searching for existing solutions

Example user prompts:

"Is there an existing order SQL" "Any user-related BFFs" "Search all datasets containing xxx"

AI execution path:

Bash
# 搜索 SQL
rabetbase sql list --format json | jq '
  [.[] | select(.sqlCode | test("订单|order"; "i"))]
'

# 搜索 BFF
rabetbase bff list --format json | jq '
  [.[] | select(.name | test("用户|user"; "i"))]
'

# 搜索数据集
rabetbase dataset list --format json | jq '
  [.[] | select(.name | test("营销|campaign"; "i"))]
'

Case 6: A quick asset inventory for onboarding

Example user prompts:

"Get me up to speed on the team's development" "What assets does the team have" "Give me a global overview"

AI execution path:

Bash
# 一口气拉全量数据
rabetbase sql list --format json > /tmp/sql.json
rabetbase bff list --format json > /tmp/bff.json
rabetbase dataset list --format json > /tmp/dataset.json
rabetbase dataset links --format json > /tmp/links.json

# 统计
echo "=== 团队资产概览 ==="
echo "SQL 总数:    $(jq 'length' /tmp/sql.json)"
echo "BFF 总数:    $(jq 'length' /tmp/bff.json)"
echo "数据集总数:  $(jq 'length' /tmp/dataset.json)"
echo "数据集关联:  $(jq '[.links] | flatten | length' /tmp/links.json)"

Case 7: Which datasets a BFF depends on

Example user prompts:

"Which datasets does this BFF use" "What data does the getUserProfile BFF depend on"

AI execution path:

Bash
# 先找 BFF ID
rabetbase bff list --format json | jq '.[] | {name, id}'

# 看单个 BFF 详情(包含代码内容)
rabetbase bff detail <bff-id> --format json | jq '{name, code}'

Search the code for the dataset_ prefix or dataset name references to pin down the dependencies.


Universal preflight: confirm environment and login

Before running any of the cases above, always confirm:

Bash
# 检查登录
rabetbase auth login 2>&1 | head -3

# 确认当前应用
rabetbase app list
rabetbase app use --appcode <目标应>

This document is a reference for AI Agents performing R&D insights | Based on existing rabetbase-cli commands

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