One-click install
npx skills add https://github.com/wukaikailive/weixin-game-skill --skill weixin-game
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: weixin-game
Source: https://github.com/wukaikailive/weixin-game-skill/tree/main
Command: npx skills add https://github.com/wukaikailive/weixin-game-skill --skill weixin-game

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the common pain points of WeChat mini game development, where developers mistakenly use browser-specific APIs (like window, document, and DOM APIs) that are unsupported in the WeChat mini game runtime, leading to runtime errors, non-compliant code, and poor platform performance.

Core Features & Use Cases

  • API Adaptation Guidance: Provides side-by-side comparisons of browser APIs and their WeChat mini game equivalents (e.g., document.createElement('canvas') → wx.createCanvas()) to eliminate compatibility errors.
  • Platform Best Practices: Covers critical platform requirements including safe area layout to avoid overlapping the top-right menu button, 4MB main package size limits, and performance optimization techniques like object pooling and offscreen canvas caching.
  • Use Case: If you are building a 2D canvas game for WeChat and encounter a "window is not defined" error, this Skill will guide you to replace invalid browser APIs with correct WeChat-specific implementations and follow platform rules to pass review.

Quick Start

Ask Claude Code to help you create a touch event manager for your WeChat mini game that uses the correct wx.onTouchStart API instead of browser touch event listeners.

Frequently Asked Questions about weixin-game

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
Why does my WeChat mini game throw a "window is not defined" runtime error?

WeChat mini game runtime errors like "window is not defined" occur because browser-specific DOM APIs are unsupported. You must replace browser APIs like document.createElement('canvas') with WeChat equivalents such as wx.createCanvas() to ensure platform compliance.

How do I handle touch interaction in WeChat mini games correctly?

To handle touch interaction in WeChat mini games, use the wx.onTouchStart API instead of standard browser touch event listeners. This ensures your canvas game receives accurate touch input mapping without causing runtime exceptions.

What is the main package size limit for a WeChat mini game?

The main package size limit for a WeChat mini game is 4MB. Enforcing this platform constraint is critical to pass WeChat review and avoid loading failures, requiring careful asset management and code splitting.

How do I adapt 2D canvas rendering and screen layout for multiple devices in WeChat?

To adapt 2D canvas rendering across multiple devices, apply WeChat safe area UI rules to avoid overlapping the top-right menu button. Use offscreen canvas caching and proper screen adaptation techniques for consistent multi-device layout.

What are the best practices for WeChat mini game performance optimization?

WeChat mini game performance optimization best practices include implementing object pooling to manage memory efficiently and utilizing offscreen canvas caching. These techniques reduce garbage collection overhead and improve rendering frame rates.

Can I use standard browser APIs for local storage and network requests in WeChat mini games?

Standard browser APIs for local storage and network requests do not work in WeChat mini games. You must use WeChat-specific API equivalents for local storage and network requests to maintain platform compliance and avoid runtime failures.