AI Agent Hub
Back to skills
WeChat Mini Program AI Development Mode Generator icon

WeChat Mini Program AI Development Mode Generator

Development Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please follow https://skillhub.cn/install/skillhub.md to install @tencent-adm/wxa-skills-generate.

About this skill

Problem Background

Migrating existing WeChat Mini Program business logic to the AI development mode (compliant with wx.modelContext specification) often requires manual code refactoring, which is time-consuming and error-prone. This process involves extracting business interfaces from source code, ensuring only whitelisted JSAPIs are used, encapsulating logic into independent subpackages, and handling authentication migration. Manual implementation is challenging due to strict constraints, such as prohibitions on getApp() and dependencies on the main package, which can cause loading or execution failures in subpackages.

Core Workflow

This skill automates the conversion of source code into wx.modelContext-compliant skill packages, addressing these challenges through a structured pipeline:

  • Source Analysis and Business Identification: Scans Mini Program source code to identify business flows, interfaces, and JSAPI calls, generating an interface-spec blueprint.
  • Interface Extraction and Atomic Interface Design: Extracts network requests and JSAPI calls from source code, designs atomic interfaces exposed to AI (e.g., paths like skills/{skill}/apis/{name}.js), and handles authentication parameter migration.
  • Runtime Probing (probe): Uses miniprogram-automator to trigger requests in the source project and capture real response structures, ensuring accurate code generation.
  • Code Generation and Configuration Integration: Generates subpackage code based on templates (including mcp.json, SKILL.md, index.js), and updates app.json and project.config.json to ensure the independent subpackage can load correctly.
  • Generation Self-Checks: Performs artifact existence checks, field fidelity self-checks, and authentication self-checks as part of the generation phase, preparing for subsequent validation.

Applicability and Considerations

This skill is designed for WeChat Mini Program projects with readable source code, but note the following:
- Environment Dependencies: Requires a complete source code directory, WeChat Developer Tools, and scripts/probe.mjs. Providing only an appid or screenshot triggers a block.
- Hard Constraints: Generated subpackages must adhere to independence principles, such as prohibiting references to main package code (dependencies must be inlined) and handling login state and initialization independently. Strict compliance with the wx API Whitelist (interface and component sides) is required; non-whitelisted JSAPIs lead to blocks or functional substitutions.
- Deliverables: Generates a skills/{skill}/ directory and configuration updates, but components are only produced if explicitly requested. Atomic interfaces default to returning text and data, with handoff relay pages used to enter Mini Program business logic.
- Validation Isolation: Self-checks during generation do not equate to product validation. Static rule checks and real-device testing are handled by wxa-skills-validate, ensuring separation of duties.
In summary, this skill focuses on faithfully migrating source code logic rather than rewriting it, making it suitable for engineering scenarios where rapid integration into Mini Program AI development mode is needed.

Use Cases

  • When migrating existing WeChat Mini Program business to AI development mode, use this skill to automatically generate skill packages compliant with the `wx.modelContext` specification from source code, avoiding the complexity of manual interface and configuration refactoring.
  • During development of WeChat Mini Programs that require AI model invocation, leverage this skill to extract network requests and JSAPIs from source code, design atomic interfaces, and generate code to quickly create capability modules callable by AI.
  • When a Mini Program project relies on multiple JSAPIs and needs compliance assurance, use this skill for whitelist checking and dependency inlining, automating the handling of subpackage independence constraints.
  • Teams encapsulating Mini Program business logic into AI skill packages use this skill to run the probe phase for capturing real response structures, ensuring generated code matches source code behavior.

Best For

  • Development engineers responsible for refactoring WeChat Mini Programs, needing to migrate existing business logic to AI development mode while handling tedious tasks like interface extraction and configuration integration.
  • Mini Program AI application development teams seeking to automate the generation of atomic interface subpackages callable by AI models from source code, reducing manual coding errors.
  • Technical leads or architects managing Mini Program project dependencies and compliance, requiring tools to ensure migration adheres to JSAPI whitelists and subpackage independence constraints.
  • Operations personnel integrating multiple Mini Program business modules into AI contexts, pursuing consistency and maintainability in code generation.