Agent skill

Leaderboard System

by OpenLitterMap in OpenLitterMap/openlittermap-web

LeaderboardController, Redis sorted sets for all-time XP rankings, per-user metrics rows for time-filtered rankings, rewardXpToAdmin, and leaderboard privacy.

GPL-3.0Auto-check passedDatabases

Install Leaderboard System

skills CLI
$ npx skills add OpenLitterMap/openlittermap-web --skill leaderboard-system -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install OpenLitterMap/openlittermap-web leaderboard-system --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/OpenLitterMap/openlittermap-web.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.ai/skills/leaderboard-system .claude/skills/leaderboard-system && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
leaderboard-system
GitHub stars
134
Token cost
~2k tokens
SKILL.md length
750 words
Files
1
Skills in repo
16
Repo updated
First seen
Licence
GPL-3.0

At a glance

LeaderboardController, Redis sorted sets for all-time XP rankings, per-user metrics rows for time-filtered rankings, rewardXpToAdmin, and leaderboard privacy.

  • Works in 11 steps: All-time leaderboards come from Redis… → Time-filtered leaderboards come from… → Per-user rows are written by… → …
  • Databases work in your project
  • SKILL.md covers Key Files, Invariants, Patterns and Common Mistakes, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Leaderboard System is an agent skill from OpenLitterMap/openlittermap-web. LeaderboardController, Redis sorted sets for all-time XP rankings, per-user metrics rows for time-filtered rankings, rewardXpToAdmin, and leaderboard privacy.

Its SKILL.md is about 2k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases. It works with Redis, PHP and MySQL. The repository describes itself as: https://opengeospatialdata.springeropen.com/articles/10.1186/s40965-018-0050-y. The licence is GPL-3.0.

When your agent uses it

  • Databases work in your project

Example prompts

  • “/leaderboard-system”

Workflow steps

11 steps, taken from the first numbered list in SKILL.md.

  1. All-time leaderboards come from Redis ZSETs. Key pattern: {scope}:lb:xp. Never query MySQL for all-time rankings.
  2. Time-filtered leaderboards come from MySQL. Query metrics table WHERE user_id > 0 ORDER BY xp DESC, user_id ASC. Secondary sort by user_id…
  3. Per-user rows are written by MetricsService. buildTimeSeriesRows() produces two rows per timescale × location: aggregate (user_id=0) and…
  4. ZSET scores are maintained by RedisMetricsCollector. ZINCRBY for create/update, negative ZINCRBY for delete. Runs inside the Redis…
  5. Zero-XP pruning on delete. After decrementing a ZSET score, ZREMRANGEBYSCORE {scope}:lb:xp -inf 0 removes members with score ≤ 0. Without…
  6. Daily queries MUST include bucket_date. For today/yesterday (timescale=1), the query includes WHERE bucket_date = ?. Without it, all daily…
  7. Privacy is enforced in formatUserData(). Respects show_name, show_username, and team pivot…
  8. Route uses auth:sanctum — not auth:api. Use actingAs($user) in tests (no guard argument).
  9. rewardXpToAdmin() must update both MySQL (users.xp) and Redis ({g}:lb:xp ZSET + {u:ID}:stats hash).
  10. Rank is 1-indexed in API response. ZREVRANK returns 0-indexed; getCurrentUserRank() adds 1.
  11. RewardLittercoin uses cluster-compatible Redis keys. All Littercoin Redis operations use RedisKeys pattern with hash tags for cluster…

What it can do on your machine

Read from SKILL.md and the folder at commit ac688aa. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are php).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Leaderboard System loads about 2k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 750 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from OpenLitterMap/openlittermap-web at commit ac688aa, republished under its GPL-3.0 licence (© OpenLitterMap). 750 words, ~2,048 tokens.

Download SKILL.mdSave it as .claude/skills/leaderboard-system/SKILL.md (or your agent's skills folder).
name
leaderboard-system
description
LeaderboardController, Redis sorted sets for all-time XP rankings, per-user metrics rows for time-filtered rankings, rewardXpToAdmin, and leaderboard privacy.

Leaderboard System

Rankings by XP across time and location scopes. Two backends: Redis ZSETs for all-time, MySQL per-user metrics rows for time-filtered.

Key Files

  • app/Http/Controllers/Leaderboard/LeaderboardController.php — API controller (GET /api/leaderboard)
  • app/Services/Redis/RedisKeys.php — xpRanking($scope) returns {scope}:lb:xp
  • app/Services/Redis/RedisMetricsCollector.php — ZINCRBY in pipeline for create/update/delete
  • app/Services/Metrics/MetricsService.php — Builds per-user rows (user_id > 0) alongside aggregates
  • app/Helpers/helpers.php — rewardXpToAdmin() increments ZSET + user stats hash
  • tests/Feature/Leaderboard/LeaderboardTest.php — 21 tests covering all paths (global, country, state, city scopes, privacy, pagination, Redis ZSET pruning)

Invariants

  1. All-time leaderboards come from Redis ZSETs. Key pattern: {scope}:lb:xp. Never query MySQL for all-time rankings.
  2. Time-filtered leaderboards come from MySQL. Query metrics table WHERE user_id > 0 ORDER BY xp DESC, user_id ASC. Secondary sort by user_id ensures deterministic pagination when XP is tied.
  3. Per-user rows are written by MetricsService. buildTimeSeriesRows() produces two rows per timescale × location: aggregate (user_id=0) and per-user (user_id>0).
  4. ZSET scores are maintained by RedisMetricsCollector. ZINCRBY for create/update, negative ZINCRBY for delete. Runs inside the Redis pipeline after MySQL commit.
  5. Zero-XP pruning on delete. After decrementing a ZSET score, ZREMRANGEBYSCORE {scope}:lb:xp -inf 0 removes members with score ≤ 0. Without this, deleted users remain as ghost entries.
  6. Daily queries MUST include bucket_date. For today/yesterday (timescale=1), the query includes WHERE bucket_date = ?. Without it, all daily rows for the month are returned. Index idx_leaderboard includes bucket_date for this.
  7. Privacy is enforced in formatUserData(). Respects show_name, show_username, and team pivot show_name_leaderboards/show_username_leaderboards. The pivot values correctly override the global user flags — a user who shows their name globally but opted out on a specific team will be hidden on that team's leaderboard entries.
  8. Route uses auth:sanctum — not auth:api. Use actingAs($user) in tests (no guard argument).
  9. rewardXpToAdmin() must update both MySQL (users.xp) and Redis ({g}:lb:xp ZSET + {u:ID}:stats hash).
  10. Rank is 1-indexed in API response. ZREVRANK returns 0-indexed; getCurrentUserRank() adds 1.
  11. RewardLittercoin uses cluster-compatible Redis keys. All Littercoin Redis operations use RedisKeys pattern with hash tags for cluster compatibility. The job wraps Redis commands in a try-catch to prevent failures from blocking the queue.

Patterns

Redis all-time query
php
$key = RedisKeys::xpRanking($scope);
$results = Redis::zRevRange($key, $start, $end, ['WITHSCORES' => true]);
$total = (int) Redis::zCard($key);
$rank = Redis::zRevRank($key, (string) $userId);
Time-filtered query
php
$query = DB::table('metrics')
    ->where('timescale', $timescale)
    ->where('location_type', $enumType->value)
    ->where('location_id', $locationId)
    ->where('user_id', '>', 0)
    ->where('year', $year)
    ->where('month', $month);

// REQUIRED for daily queries (timescale=1) — omitting returns all daily rows for the month
if (isset($params['bucket_date'])) {
    $query->where('bucket_date', $params['bucket_date']);
}

$query->where('xp', '>', 0)
    ->orderByDesc('xp')
    ->orderBy('user_id')  // deterministic tie-breaking
    ->offset($start)
    ->limit(100)
    ->select('user_id', 'xp')
    ->get();
Time filter mapping
FilterTimescaleYearMonthbucket_date
today1currentcurrenttoday
yesterday1yesterdayyesterdayyesterday
this-month3currentcurrent—
last-month3prevprev—
this-year4current0—
last-year4prev0—
Scope resolution
php
RedisKeys::xpRanking(RedisKeys::global())        // {g}:lb:xp
RedisKeys::xpRanking(RedisKeys::country($id))    // {c:$id}:lb:xp
RedisKeys::xpRanking(RedisKeys::state($id))      // {s:$id}:lb:xp
RedisKeys::xpRanking(RedisKeys::city($id))       // {ci:$id}:lb:xp
Show full SKILL.md (377 more words)Show less

Common Mistakes

  • Using auth:api guard in tests. Leaderboard route uses auth:sanctum. Use actingAs($user) with no guard.
  • Forgetting the chk_user_location constraint was dropped. Migration 2026_02_24_150115 drops this constraint. Per-user rows now exist at all location scopes.
  • Querying MySQL for all-time rankings. All-time uses Redis. Only time-filtered queries hit MySQL.
  • Not including xp > 0 in time-filtered queries. Users with 0 XP should not appear on leaderboards.
  • Directly modifying ZSET scores outside RedisMetricsCollector. Only rewardXpToAdmin() is allowed to bypass the pipeline (admin-only XP).
  • Using raw Redis key strings in RewardLittercoin. Always use RedisKeys::* helpers with hash tags for Redis Cluster compatibility. Bare key strings like "user:{$id}:littercoin" break in cluster mode.
  • Expecting the team leaderboard to ignore pivot privacy flags. show_name_leaderboards/show_username_leaderboards on the team_user pivot row override the global show_name/show_username flags for that team's leaderboard. Both must be checked in formatUserData().
  • Omitting bucket_date for daily queries. Without WHERE bucket_date = ?, daily (timescale=1) queries return ALL daily rows for the month, not just one day.
  • Not pruning zero-XP members from ZSETs. After delete, ZREMRANGEBYSCORE must run to remove ≤ 0 scores. Without it, ghost entries persist in Redis.
  • Missing orderBy('user_id') for tie-breaking. Without secondary sort, tied-XP users get non-deterministic pagination order.
  • Expecting Redis::zScore() to return null for missing members. PHP Redis returns false, not null. Use assertFalse() in tests.

Frontend

Pinia Store
FilePurpose
resources/js/stores/leaderboard/index.jsState: leaderboard, currentPage, hasNextPage, total, currentUserRank, loading, error, currentFilters, countries, states, cities
resources/js/stores/leaderboard/requests.jsFETCH_LEADERBOARD() (unified), FETCH_COUNTRIES(), FETCH_STATES(countryId), FETCH_CITIES(stateId), backward-compat wrappers

FETCH_LEADERBOARD({ timeFilter, locationType, locationId, page }) is the single entry point. Sets loading/error, stores total/currentUserRank from response.

Vue Components
FilePurpose
Leaderboard.vuePage wrapper — dark gradient bg, auth gate, stats bar (rank/total), filters, list, pagination
LeaderboardFilters.vueTime pills (desktop) / select (mobile) + cascading location selectors (type → country → state → city). Emits change event.
LeaderboardList.vueDark glass user cards — medal, flag, name, xp. Props: leaders array only.
Design

Matches Locations page dark glass theme (bg-gradient-to-br from-slate-900 via-blue-900 to-emerald-900). Cards use bg-white/5 border border-white/10 rounded-xl. Active time pill: bg-emerald-500/20 text-emerald-400.

Data Flow
  1. Leaderboard.vue calls FETCH_LEADERBOARD() on mount
  2. LeaderboardFilters.vue emits change with { timeFilter, locationType, locationId }
  3. Leaderboard.vue calls FETCH_LEADERBOARD() with emitted params
  4. Pagination calls FETCH_LEADERBOARD() with ...currentFilters + page
  5. Country list loaded via FETCH_COUNTRIES() from /api/v1/locations
  6. State list loaded via FETCH_STATES(countryId) from /api/v1/locations/country/{id}
  7. City list loaded via FETCH_CITIES(stateId) from /api/v1/locations/state/{id}

© OpenLitterMap, GPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .ai/skills/leaderboard-system of OpenLitterMap/openlittermap-web.

Open the folder on GitHubat commit ac688aa

Compare with similar skills

Leaderboard System next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Leaderboard System compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Leaderboard System this skillOpenLitterMap/openlittermap-web134—~2kAutomated safety check: PassGPL-3.0
Email Blastantiwork/gumroad9.8k—~1.4kAutomated safety check: PassMIT
Tgf Server Devthkhxm/tgf128—~1.3kAutomated safety check: NotesMIT
Cache Debugzhyese/grid-qa144—~646Automated safety check: PassCustom licence
Alsacreations Guidelinesalsacreations/kiwipedia338—~900Automated safety check: PassNone
Resume Backend Project OptimizerLAIJiangFeng/resume-builder247—~868Automated safety check: PassNone

Similar skills

  • Email Blast

    antiwork/gumroad

    Send one-off email blasts to Gumroad creators directly via production console, no PR or deploy needed.

    9.8k GitHub stars~1.4k tokensUpdated today
    DatabasesAuto-check passed
  • Tgf Server Dev

    thkhxm/tgf

    基于 tgf v2(github.com/thkhxm/tgf/v2)用确定性的 tgfctl 工作流创建、验证和维护 Go 游戏服务器项目。

    128 GitHub stars~1.3k tokensUpdated 2 mo ago
    DatabasesAuto-check: notes
  • Cache Debug

    zhyese/grid-qa

    排查问答缓存问题(不命中/脏缓存/黑名单误拦/置信度过滤/多轮不缓存)时使用。覆盖三级缓存(Redis/MySQL/Semantic)+黑名单+置信度规则。

    144 GitHub stars~646 tokensUpdated 4 days ago
    DatabasesAuto-check passed
  • Alsacreations Guidelines

    alsacreations/kiwipedia

    Guidelines techniques et conventions internes d'Alsacréations (Kiwipedia) — HTML, CSS, JavaScript, TypeScript, Vue.js, WordPress, PHP/MySQL, accessibilité, performance, SEO, RGPD, écoconception…

    338 GitHub stars~900 tokensUpdated 19 days ago
    DatabasesAuto-check passed
  • Resume Backend Project Optimizer

    LAIJiangFeng/resume-builder

    将中文后端项目经历改写为高质量、可面试追问、强数据化的简历要点。适用于用户提供“项目经历/主要工作/职责描述”后,要求按统一模板输出“负责xxx功能 + 关键技术细节组合 + 解决问题 + 数据化结果”的场景;适用于 Java 后端求职、简历优化、面试前项目复盘,且需要对齐面试高频考点(Java 集合与并发、MySQL、Redis、Spring、消息队列、系统设计等)时使用。

    247 GitHub stars~868 tokensUpdated 1 mo ago
    DatabasesAuto-check passed
  • Cloudrun Development

    TencentCloudBase/CloudBase-AI-Toolkit

    CloudBase Run backend development rules (Function mode/Container mode).

    1.1k GitHub starsUsed in 1 repo~7.2k tokens
    DatabasesAuto-check passed

More from OpenLitterMap/openlittermap-web

All 16 skills in this repo
  • Tailwindcss Development

    OpenLitterMap/openlittermap-web

    Styles applications using Tailwind CSS v3 utilities. An agent skill from OpenLitterMap/openlittermap-web.

    134 GitHub stars~713 tokensUpdated 24 days ago
    Auto-check passed
  • Olm Architecture

    OpenLitterMap/openlittermap-web

    OpenLitterMap v5 architecture reference. An agent skill from OpenLitterMap/openlittermap-web.

    134 GitHub stars~5.2k tokensUpdated 24 days ago
    Auto-check passed
  • Achievements System

    OpenLitterMap/openlittermap-web

    AchievementEngine, AchievementRepository, milestone checkers, AchievementsSeeder, userachievements pivot, AchievementsController API, and achievement evaluation flow.

    134 GitHub stars~1.4k tokensUpdated 24 days ago
    Auto-check passed
  • Admin System

    OpenLitterMap/openlittermap-web

    AdminController, photo approval, tag editing, deletion, MetricsService integration, admin middleware, verification queue, and admin XP.

    134 GitHub stars~3.9k tokensUpdated 24 days ago
    Auto-check passed
  • API Endpoints

    OpenLitterMap/openlittermap-web

    REST API endpoints, route structure, auth guards, request/response contracts, error patterns, and the full API surface for web SPA and mobile clients.

    134 GitHub stars~4k tokensUpdated 24 days ago
    Auto-check passed
  • Clustering System

    OpenLitterMap/openlittermap-web

    ClusteringService, tile keys, dirty tiles/teams, clustering commands, ClusterController GeoJSON API, PhotoObserver dirty marking, and map cluster rendering.

    134 GitHub stars~2k tokensUpdated 24 days ago
    Auto-check passed

Works with

Categories

Questions about Leaderboard System

What does Leaderboard System do?

LeaderboardController, Redis sorted sets for all-time XP rankings, per-user metrics rows for time-filtered rankings, rewardXpToAdmin, and leaderboard privacy. Leaderboard System is an agent skill from OpenLitterMap/openlittermap-web. LeaderboardController, Redis sorted sets for all-time XP rankings, per-user metrics rows for time-filtered rankings, rewardXpToAdmin, and leaderboard privacy.

When should I use Leaderboard System?

Leaderboard System fits situations like: databases work in your project.

How do I install Leaderboard System in Claude Code?

Run `npx skills add OpenLitterMap/openlittermap-web --skill leaderboard-system -a claude-code`. Or copy the skill folder (.ai/skills/leaderboard-system in OpenLitterMap/openlittermap-web) into .claude/skills/leaderboard-system in your project. Claude Code loads it when a task matches its description.

How do I install Leaderboard System in Codex?

Run `npx skills add OpenLitterMap/openlittermap-web --skill leaderboard-system -a codex`. Or copy the skill folder (.ai/skills/leaderboard-system in OpenLitterMap/openlittermap-web) into .agents/skills/leaderboard-system in your project. Codex loads it when a task matches its description.

Can I use Leaderboard System in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add OpenLitterMap/openlittermap-web --skill leaderboard-system -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/leaderboard-system, .gemini/skills/leaderboard-system, .github/skills/leaderboard-system and .opencode/skills/leaderboard-system in your project.

What does Leaderboard System need to run?

SKILL.md names no scripts, command-line tools or credentials: Leaderboard System is instructions for the agent only.

Does Leaderboard System access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Leaderboard System safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Leaderboard System use?

Leaderboard System is published under the GPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Leaderboard System use?

About 2k tokens (SKILL.md is roughly 8.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Leaderboard System?

Skills that share tags, products or a category with Leaderboard System: Email Blast (antiwork/gumroad, 9.8k stars), Tgf Server Dev (thkhxm/tgf, 128 stars), Cache Debug (zhyese/grid-qa, 144 stars) and Alsacreations Guidelines (alsacreations/kiwipedia, 338 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Leaderboard System?

OpenLitterMap (a GitHub organization) maintains it in OpenLitterMap/openlittermap-web, which has 134 GitHub stars. The repository holds 16 skills in this directory. The repository was last updated on September 14, 2026.

Source: OpenLitterMap/openlittermap-web on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.