游戏化与 XP 系统:Openclaw Skills 的生产力等级提升

作者:互联网

2026-03-26

其他

什么是 游戏化与 XP 系统?

此 Openclaw Skills 集成功能为您的工作流带来了强大的游戏化层。通过将 ClawdBot 连接到 Supabase 后端,它可以通过经验值 (XP)、等级和获得的徽章来跟踪您的职业和个人进度。该技能作为一种动力引擎,通过连续达标乘数和目标里程碑鼓励一致性,使其成为希望将日常产出游戏化的开发人员和高级用户的必备工具。

它以问责制和进步为核心构建,将平凡的任务转化为有价值的里程碑。无论您是在跟踪编码习惯还是项目完成情况,此技能都能提供维持个人或团队目标高度参与所需的架构。

下载入口:https://github.com/openclaw/skills/tree/main/skills/chipagosfinest/gamification-xp

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install gamification-xp

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 gamification-xp。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

游戏化与 XP 系统 应用场景

  • 通过自然语言查询监控每日生产力水平和经验值收益。
  • 通过倍增奖励的视觉连续达标奖励来跟踪习惯的一致性。
  • 在地区或团队排行榜上竞争,以保持高性能和问责制。
  • 通过分级 XP 奖励庆祝重大项目或目标里程碑。
  • 查看徽章成就,以可视化长期技能获取和职业成长。
游戏化与 XP 系统 工作原理
  1. 用户通过支持的生产力界面完成任务、习惯或目标里程碑。
  2. ClawdBot 网关将活动转发到 API 服务器,该服务器根据任务优先级或里程碑重要性计算适当的 XP 奖励。
  3. XP 引擎根据存储在数据库中的历史习惯数据应用连续达标乘数(最高 2.0 倍)。
  4. 用户总量在 Supabase 数据库的专用 user_gamification 和 xp_transactions 表中更新。
  5. 系统使用公式 XP = 50 * (level^2) 检查新的 XP 总量是否触发升级事件。
  6. 用户通过 Openclaw Skills 查询其状态,以接收实时统计数据、徽章更新和进度报告。

游戏化与 XP 系统 配置指南

要在 Openclaw Skills 生态系统中部署此技能,您必须配置 ClawdBot API 服务器并将其链接到 Supabase 实例。

  1. 准备一个 Supabase 项目并获取您的 API 凭据。
  2. 在您的托管环境中设置以下环境变量:
export SUPABASE_URL="https://your-project.supabase.co"
export SUPABASE_SERVICE_KEY="your-service-role-key"
  1. 初始化数据库架构,包括 user_gamification、xp_transactions 和 user_badges 表。
  2. 部署 API 服务器(通常通过 Railway)并确保代理可以访问端点。

游戏化与 XP 系统 数据架构与分类体系

系统在三个主要的 PostgreSQL 表中组织数据,以确保在 Openclaw Skills 框架内进行准确跟踪:

表名 描述 关键字段
user_gamification 存储核心用户进度和当前统计数据 userId, totalXp, currentLevel, currentStreak
xp_transactions 所有奖励或扣除积分的审计日志 id, userId, amount, source, note, createdAt
user_badges 所有已获得成就的记录 id, userId, badgeType, metadata, awardedAt
name: gamification
version: 1.1.0
description: XP system for productivity gamification via ClawdBot - track levels, badges, streaks, and achievements
author: ClawdBot
category: productivity
tags:
  - gamification
  - xp
  - levels
  - badges
  - streaks
  - habits
  - productivity
  - motivation
  - achievements
  - goals
env:
  - name: SUPABASE_URL
    description: Supabase project URL for gamification data storage
    required: true
  - name: SUPABASE_SERVICE_KEY
    description: Supabase service role key for database access
    required: true
keywords:
  - earn xp
  - level up
  - streak bonus
  - habit tracking
  - goal milestones
  - leaderboard
  - accountability
triggers:
  - my xp
  - what level am I
  - my badges
  - leaderboard
  - xp stats
  - gamification stats

Gamification & XP System

Turn productivity into a game with XP, levels, badges, streaks, and achievements. Every completed task, habit, and goal milestone earns XP toward leveling up.

ClawdBot Integration

This skill is designed for ClawdBot - it provides the prompt interface for ClawdBot's gamification API server which stores data in Supabase.

Architecture:

User → ClawdBot Gateway → ClawdBot API Server → Supabase (Postgres)
                         (Railway)              (user_gamification, xp_transactions tables)

The backend implementation lives in api-server/src/routes/gamification.ts and api-server/src/lib/xp-engine.ts.

Features

  • XP System: Earn XP for habits, tasks, and goal milestones
  • Leveling: Level up with formula XP = 50 * (level^2)
  • Streak Bonuses: Up to 2.0x multiplier for consistent habits
  • Badges: Earn badges for achievements and milestones
  • Leaderboard: Compare progress (multi-user support)
  • Accountability: Track commitment and earn-back system

Environment Variables

Variable Required Description
SUPABASE_URL Yes Supabase project URL
SUPABASE_SERVICE_KEY Yes Supabase service role key

API Endpoints

All endpoints are relative to the ClawdBot API server ({CLAWDBOT_API_URL}/api/gamification/).

Get User Stats

GET /api/gamification/stats/:userId

Response:

{
  "totalXp": 2450,
  "currentLevel": 7,
  "weeklyXp": 350,
  "monthlyXp": 1200,
  "progress": {
    "xpInLevel": 150,
    "xpNeeded": 450,
    "percent": 33
  },
  "accountability": {
    "balance": 50,
    "totalSlashed": 10,
    "totalEarnedBack": 60
  }
}

Get Recent Transactions

GET /api/gamification/transactions/:userId?limit=20

Get User Badges

GET /api/gamification/badges/:userId

Award XP (Internal)

POST /api/gamification/award
{
  "userId": "302137836",
  "amount": 50,
  "source": "habit",
  "sourceId": "morning-routine",
  "note": "Completed morning routine"
}

Complete Habit (with streak bonus)

POST /api/gamification/habit-complete
{
  "userId": "302137836",
  "habitId": "workout",
  "currentStreak": 7
}

Complete Task

POST /api/gamification/task-complete
{
  "userId": "302137836",
  "taskId": "task-123",
  "priority": 8
}

Goal Milestone

POST /api/gamification/goal-milestone
{
  "userId": "302137836",
  "goalId": "goal-456",
  "milestonePercent": 50
}

Award Badge

POST /api/gamification/badge
{
  "userId": "302137836",
  "badgeType": "early_bird",
  "metadata": { "streak": 30 }
}

Get Leaderboard

GET /api/gamification/leaderboard

Get XP Config

GET /api/gamification/config

Database Tables

This skill requires the following Supabase tables:

  • user_gamification - User XP totals, levels, streaks
  • xp_transactions - XP award history
  • user_badges - Earned badges

XP Rewards

Action Base XP Notes
Habit completion 10-50 + streak bonus up to 2x
Task completion 5-50 Based on priority (1-10)
Goal 25% milestone 100 First quarter
Goal 50% milestone 200 Halfway
Goal 75% milestone 300 Three quarters
Goal 100% completion 500 Full completion

Example Usage

Check Progress

"What's my XP level?"
"How close am I to leveling up?"
"Show my gamification stats"

View Achievements

"What badges do I have?"
"Show my recent XP transactions"
"What's my current streak?"

Leaderboard

"Show the leaderboard"
"Who has the most XP?"
  • goals - Set and track goals
  • habits - Habit tracking system
  • remind - Reminder system
  • daily-briefing - Daily progress summary