wechat-weekly-leaderboard
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "wechat-weekly-leaderboard" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-36b1b8e411deea94c6846d33319d55d9c8d2cbde4ab14cfc204361e92250041c. Verify the upstream source and version against https://skillhub.cn/skills/user_c830ad09/wechat-weekly-leaderboard before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
WeChat Weekly Leaderboard: For adding or fixing a weekly high-score friend leaderboard in native Canvas JavaScript WeChat mini games. Applicable when using open data domain friend leaderboards, wx.setUserCloudStorage reporting, wx.getFriendCloudStorage rendering, weekly reset/filtering, sharedCanvas drawing, local fallback scores, ranking panels, or debugging cases where the friend ranking flashes then falls back to only the local/self score.
Introduction source: third_party · user_c830ad09 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Add or fix a weekly high-score friend leaderboard in a WeChat mini game. Use when working on native Canvas JavaScript mini games that need open data domain leaderboards, wx.setUserCloudStorage reporting, wx.getFriendCloudStorage rendering, weekly reset/filtering, sharedCanvas drawing, local fallback scores, ranking panels, or bugs where the friend ranking flashes then falls back to only local/self score.
- Testing
- Not tested
Browse files
Frontmatter
name: wechat-weekly-leaderboard
description: Add or fix a weekly high-score friend leaderboard in a WeChat mini game. Use when working on native Canvas JavaScript mini games that need open data domain leaderboards, wx.setUserCloudStorage reporting, wx.getFriendCloudStorage rendering, weekly reset/filtering, sharedCanvas drawing, local fallback scores, ranking panels, or bugs where the friend ranking flashes then falls back to only local/self score.WeChat Weekly Leaderboard
Overview
Implement WeChat mini game weekly friend leaderboards through the open data domain. Keep the main domain responsible for game state, score submission, panel layout, and sharedCanvas compositing; keep the open data domain responsible only for relationship-chain data reads and leaderboard drawing.
Read references/wechat-open-data-weekly.md before editing leaderboard code. It contains the implementation contract, message schema, async rendering guardrails, and validation checklist.
Workflow
- Read the project rules first, especially
AGENTS.mdand any existing directory conventions. - Locate existing entry points:
game.js,game.json, score/state logic, renderer/panel logic, storage helpers, and anyopen-data/directory. - If the project lacks leaderboard structure, add or document these roles before coding:
- Main domain bridge, usually
js/leaderboard.js. - Open data domain entry, usually
open-data/index.jsandopen-data/game.js. game.jsonopenDataContextconfiguration.- README or project notes for backend configuration of the leaderboard key.
- Main domain bridge, usually
- Implement main-domain score submission:
- Keep a local weekly best record keyed by week id.
- Submit only the best weekly score through
wx.setUserCloudStorage. - Store the value as JSON with
wxgame.score,wxgame.update_time,weekId, and optional metadata such asbestLevel.
- Implement main-domain panel drawing:
- Send
showWeeklyLeaderboardmessages with content size, pixel ratio, key, week id, local/self score, and current run metadata. - Resize and draw
sharedCanvasinside the existing panel rectangle. - Provide a short loading fallback when open data is unavailable.
- Send
- Implement open-data rendering:
- Read friends with
wx.getFriendCloudStorage({ keyList: [key] }). - Read self with
wx.getUserCloudStoragewhen available. - Normalize both WeChat ranking JSON and plain numeric values.
- Filter out scores from other weeks.
- Merge local self fallback only when cloud self data is missing or stale.
- Sort descending, dedupe self, and render rows to
sharedCanvas.
- Read friends with
- Protect async rendering:
- Use monotonically increasing request ids to ignore stale callbacks.
- Cache the latest valid friend-inclusive rows for the current
key + weekId. - Do not let a later retry or failed request overwrite a displayed friend list with a self-only fallback.
- Validate with syntax checks and a mocked open-data scenario where possible.
Implementation Rules
- Do not put main game logic in
open-data/. - Do not use a backend, cloud database, or third-party game engine unless the project explicitly already uses one.
- Do not report every score change if a local weekly best has already been uploaded.
- Do not display stale cross-week scores.
- Do not use hard-coded panel coordinates if the renderer already exposes a content rectangle.
- Do not rely on
ctx.roundRect; use a manual path helper for WeChat Canvas compatibility unless the project already wraps it safely.
Validation
Run the project's declared validation commands. For simple native JavaScript projects, also run:
node --check game.js
Get-ChildItem js -Filter *.js | ForEach-Object { node --check $_.FullName }
node --check open-data\index.js
node --check open-data\game.js
When fixing flicker or fallback bugs, add or run a lightweight mocked test that simulates:
- First
showWeeklyLeaderboardrequest returns friend rows. - Later duplicate
showWeeklyLeaderboardrequest fails or returns only self. - Final rendered rows still include the previously displayed friends.
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对微信小游戏开发者提供周榜功能实现方案,属于明确场景的通用工具
- 覆盖微信小游戏开发生态中的常见需求,具有实用价值
Highlights
- description 详细列出了适用场景,覆盖合理且边界清晰
- 包含多种变体关键词,如 open data domain、wx.setUserCloudStorage、sharedCanvas 等
Highlights
- 文档结构完整,包含 Overview、Workflow、Implementation Rules、Validation 等章节
- Workflow 提供 8 个清晰步骤,有端到端实现流程,frontmatter 完整
Areas to improve
-
引用文件缺失 Reported severity: Minor
SKILL.md 引用了 references/wechat-open-data-weekly.md 文件,但该文件未在传入内容中提供
Recommendation: 请确保所有被引用的文件都包含在 Skill 包中,或移除对缺失文件的引用
Highlights
- 工具来源明确(微信官方 API),参数使用正确
- 覆盖了主要异常处理(异步渲染保护、请求 ID 防过期、缓存最新有效数据、防闪烁逻辑)
- 不可逆操作(score submission)有本地最佳记录保护机制
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.