Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Miniapp Product Dev?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ccoalm-miniapp-product-dev)
---
name: miniapp-product-dev
description: "小程序 / Taro / 微信小程序 / 支付宝小程序 / 抖音小程序 / 小程序上线审核 / 微信开发者工具编译·构建·真机调试 → implement, debug, test, and ship mini-program client features: pages, state, API integration, auth, sharing, platform capabilities, review, and device verification. Triggers also include \"重构这个小程序页面/组件(局部)\", \"refactor a mini-program page/component\"."
---
# Miniapp Product Dev
Mini-program client engineering and product-facing delivery across WeChat, Alipay, Douyin/TikTok, Baidu and similar hosts; excludes product strategy, backend architecture and visual design. After code/test edits, self-check and invoke `code-review` automatically before completion.
## Framework Scope
Primary framework target: **Taro** (React-based multi-platform mini-program framework). Apply this skill's recipes assuming Taro unless the task states otherwise.
Adjacent frameworks recognized but not the default target:
- **uni-app / Remax / kbone / mpvue**: recipes here usually apply with framework-equivalent substitutions; verify before assuming behavior.
- **Native WeChat / Alipay / Douyin / Baidu mini-program**: host-platform contracts (config, capabilities, review, release) carry over; framework-specific code mechanics (JSX/hooks vs WXML/WXSS, lifecycle hooks, runtime APIs) require native-platform substitution.
- **Embedded H5 inside a mini-program webview**: this skill owns the mini-program shell, bridge contract, host capabilities, and review/release evidence; the H5 React/Vue page belongs to `web-react-dev` (or the relevant web skill).
If the team adopts a non-Taro framework as a new primary, the skill scope must be re-declared rather than letting Taro recipes silently apply to mismatched runtimes.
For evaluating whether Taro is the right choice for a given project (vs native, uni-app, Remax/kbone, or splitting per-platform), read `references/framework-choice.md`. Taro is the current default but not a permanent decision — re-evaluate when the project's target-platform set, design-system divergence, or maintenance signals change materially.
## Runtime Compatibility
This skill is shared by OpenCode, Codex, and Claude Code. Keep instructions tool-agnostic: prefer repository-local scripts, platform developer tools, CLI commands, simulator evidence, screenshots, and explicit manual checks over host-specific features. When a tool is unavailable, record the missing evidence and use the closest deterministic check instead of pretending the platform was verified.
## Routing
- Use `product-rd-workflow` first when the work spans product intent, design, service contracts, implementation, test, review, release, and follow-up.
- Use `product-ui-ux-design` before or alongside coding for visible page structure, interaction model, density, empty/error/loading states, trust copy, accessibility, and launch acceptance.
- Use `web-react-dev` for the React layer when Taro shares code with a React web project (see Sibling Boundary below).
- Use backend architecture/dev skills for API contracts, auth services, payment callbacks, subscriptions, persistence, async jobs, and admin/ops surfaces.
- For backend HTTP integrations, preserve current client wire behavior unless an explicit consumer-migration decision exists. Classify JSON vs protobuf-backed HTTP using `../platform-service-connectivity/references/protobuf-http-contract-signals.md`.
- Follow the HTTP wire-format classification, recorded response-envelope consumption, and `pending-contract-owner` stop rules in `references/contracts-and-state.md`.
- Do not fork IDL or hand-maintain duplicated DTOs in the mini-program repo.
- Use `testing-strategy` to choose unit, component, integration, miniprogram automation, E2E, manual device, and release verification layers.
- Use `test-artifact-management` when the ask is about generating structured test cases from a Feishu requirements doc or codebase and tracking them in Feishu Bitable before implementation begins.
- Use `defect-diagnosis` first for crashes, failed builds, platform review rejection, flaky device behavior, auth/payment/share failures, or production symptoms.
- Use `feature-risk-router` when the slice touches money, login/identity, user data, permissions, generated/AI content, write finality, platform review policy, or release risk.
- Use `skill-extraction-workflow` to feed learnings from real mini-program work back into this skill and manage its maturity baseline (`vendor-spec + framework-canonical` until upgraded per `references/source-evidence-map.md`); for cross-skill lifecycle stage handoffs and conformance checks read `references/qa-release.md`, and for multi-stack brand alignment scope read `references/cross-stack-alignment.md`.
## Sibling Boundary With web-react-dev
Taro is React syntax compiled to mini-program runtime; a Taro project typically shares a substantial portion of code with a React web project in the same monorepo. Without an explicit boundary, ownership of state hooks, API clients, and shared components drifts.
| Layer | Owner | Notes |
| --- | --- | --- |
| React component structure, hooks, JSX, TSX types | `web-react-dev` | Component decomposition, state lifting, effect discipline are the same rules. |
| Pure shared layer (DTOs, types, validators, pure mapping) | `web-react-dev` (monorepo pkg-shared) | No platform branches; no I/O. |
| Shared runtime adapters consumed by mini-program targets (request client, auth state machine, storage namespace, finality/idempotency wrapper, observability transport) | **Co-owned with a named final-decision owner** (one engineer per adapter, recorded in repo). `web-react-dev` sets browser semantics; this skill's contract — full session-epoch tuple fencing, request cancellation across route switch, storage namespacing + manifest + historical-prefix purge, sensitive-field handling, late-callback fencing, server-business-key idempotency, pending-reconciliation with bounded timeout on cold start / page-show / re-login, support-id propagation, kill-switch dimensions, trace propagation — is a **blocking acceptance gate** before mini-program targets import the adapter. Web may not merge an adapter change that is browser-safe but mini-program-unsafe; the gate's miniapp-contract tests must pass first — the merge record must carry the fixed token `gate: miniapp-product-dev SKILL.md Sibling Boundary → shared runtime adapters row` plus a passing miniapp-contract run recorded on the change under merge. |
| Shared design tokens / theme | `product-ui-ux-design` + per-stack injection | Tokens flow from the design source; injection mechanics per `multi-project-token-consistency.md`. |
| Component library choice (Taroify, NutUI-Taro, tdesign-miniprogram) | **Co-owned** with `product-ui-ux-design`: design owns UX / token / accessibility / brand-fit criteria; this skill owns runtime fit (package size, host-platform compatibility, framework version compatibility, build pipeline integration). Both signoffs required. See `references/framework-choice.md` → "What this skill does NOT decide" and `../product-ui-ux-design/references/multi-stack-strategy.md` for the design source of truth check. |
| Taro lifecycle (`useReady`, `useLoad`, `useDidShow`, `useDidHide`) | This skill | Page lifecycle differs from React DOM lifecycle. |
| `Taro.*` runtime APIs (`Taro.request`, `Taro.login`, `Taro.navigateTo`, `Taro.getStorage`, etc.) | This skill | Use the repo's existing adapter when one exists; introduce an adapter for shared or high-risk surfaces (request, auth, payment, storage, host capability). Do not call host APIs ad hoc from arbitrary components. |
| Platform branching (`process.env.TARO_ENV`, conditional compilation, platform-specific files) | This skill | Branching at the adapter/wrapper layer, not sprinkled in render code. |
| Subpackage config, preloading, package size budget | This skill | Mini-program-only concept. |
| Host capabilities (login, pay, share, subscribe message, scan, location, file, scope) | This skill | Capability detection, denial/cancel/timeout/recovery states. |
| Mini-program app/page config files (`app.config.ts`, `page.config.ts`, platform-specific `project.config.json`) | This skill | Versioning, route registration, tab/subpackage layout, permissions declaration. |
| Build target, `taro build --type weapp/alipay/tt/swan`, CI matrix | This skill | One target compiling does not prove other targets pass. |
| Host-platform review submission, gray release, real-device evidence | This skill | Not a web concern. |
| H5 build target inside a Taro multi-target project | `web-react-dev` for the H5 output's React/browser concerns; this skill stays out unless the H5 is embedded back inside a mini-program webview. |
Cross-checking rule: when editing code shared with a React web project, also check the relevant React rule in `web-react-dev` (state ownership, effects, accessibility, observability). When the code is mini-program-only (config, host API, platform branch), this skill is authoritative.
## Core Workflow
Before editing Taro/native mini-program code, page config, host capability adapters, platform project files, styles, assets, or tests, complete enough analysis and planning for the change to be reviewable. Scale the plan to risk: a simple low-risk single-page change can use a short inline plan; multi-target, API-visible, host-capability, platform-review/release, bug-fix, branch/MR, unclear-risk, or high-risk work needs explicit task split, host/target verification matrix, acceptance checks, verification commands, rollback or stop conditions, and named handoffs to testing, web/app, backend, release, or diagnosis skills before edits. Runtime-visible work consumes the canonical Design brief and Test Phase 0 before implementation.
Repo-local agent contracts (`AGENTS.md` at the repo root and in source directories) are part of the delivery contract: when a change moves a stable boundary, generated surface, workflow, or directory-local rule, update the nearest contract in the same MR and keep coverage in sync per `product-rd-workflow`'s spec / repo-contract sync gate.
1. Resolve the miniapp platform and delivery shape.
- Host platform target(s): WeChat, Alipay, Douyin/TikTok, Baidu, or several at once. Multi-target = a separate verification matrix; one target compiling is not proof another target passes.
- Framework: confirm Taro as the project's framework (default for this skill). If the repo is native, uni-app, Remax, kbone, or mpvue, apply this skill's recipes with framework-equivalent substitutions and call out the substitution in the change description.
- For Taro: confirm Taro major version, React version, build target list (`taro build --type weapp/alipay/tt/swan/h5/rn`), and which targets are actually shipped vs. listed-but-unverified.
- Target: new page, tab, component, package/subpackage, plugin, webview bridge, or platform capability.
- Release channel: developer tools preview, experience build, gray release, full release, or platform review submission.
2. Analyze the existing client surface before editing.
- Locate page ownership, route registration, tab/subpackage config, app/global state, API client, storage wrapper, auth/session owner, analytics wrapper, and tests. Load test-authoring, TC coverage lookup (`createTcSuite` / sidecar) before adding/changing tests, and 5-surface deprecation liveness rules in `references/qa-release.md` before deleting deprecated coverage or mini-program code.
- Inspect per-framework and per-target config files (`app.config.*`, `project.*.json`, `app.json`, `mini.project.json`, `manifest.json`/`pages.json`) per `references/platform-capabilities.md`.
- Identify platform-branching code paths: `process.env.TARO_ENV` checks in Taro, conditional compilation blocks, or platform-specific files (`*.weapp.tsx`, `*.alipay.tsx`). Confirm branching lives at the adapter/wrapper layer, not in render code.
- Identify whether the change must be shared, forked, or guarded by capability detection.
- For every visible UI change, load `../product-ui-ux-design/references/delivery-contract.md` and consume either its full Design brief + Phase 0 or its valid low-risk copy-only record + lightweight Phase 0 before coding. The lightweight path checks semantics, accessible name, localization, rendered extent, and target-host render without inventing unrelated matrices; risk-bearing copy uses the full path. For full slices, map structure, state/adaptation matrices, behavior and criteria to pages/host adapters; record route/back/share entry, hosts, capabilities, recovery geometry, and preserved behavior. A mini-program `web-view` has a host member here and a separate web-content owner member; browser/H5-only preview satisfies neither the shipped-host bridge nor the complete owner set.
- Before the first implementation edit, add the canonical `client_entry` defined there: local rule identifier or short quote and implementation decision, target surface/runtime, planned run/capture command, and behavior that must remain unchanged.
3. Define the miniapp contract before coding.
- Define untrusted scene/share/QR validation, single-flight auth epoch fencing, centralized finite-value mapping, and server-enforced high-risk finality per `references/contracts-and-state.md`.
- Storage scope: local storage keys, TTL, sensitive data handling, migration, logout/account-delete cleanup, and stale-cache recovery.
- Capability contracts: login, user profile, phone number, location, camera, album, file, scan, payment, subscribe message, share, webview, Bluetooth/NFC, clipboard, and open settings.
- Analytics: page exposure, entry scene, click/submit, funnel, error, performance, and release version dimensions.
4. Implement with platform constraints visible.
- Keep page render code thin; isolate data loading, command handling, mapping, validation, and platform adapters.
- Keep platform APIs behind local wrappers when the repo already has them. Do not call host APIs (`Taro.request`, `Taro.login`, `Taro.requestPayment`, `wx.*`, `my.*`, etc.) ad hoc from arbitrary components.
- For Taro: confine `process.env.TARO_ENV` and conditional-compilation branches to adapter/wrapper modules. Render components should consume capability-flags or platform-specific files (`*.weapp.tsx`, `*.alipay.tsx`), not branch on `TARO_ENV` inline.
- Model permission denial, permanent denial, settings handoff (`Taro.openSetting` / native equivalent), capability unavailable, offline/weak network, background/foreground restore, and host-version incompatibility.
- Keep copy and UI states review-safe for platform policy: privacy prompts, user authorization, payments, ads, medical/financial/legal-sensitive wording, generated content, and UGC moderation where relevant.
- Keep risky client flows no-op when their server-side feature flag is off, defer third-party SDK loading/initialization until the flag is explicitly enabled, and review submitted host-config changes for no-resubmission disablement before approval (kill-switch runbook in `references/qa-release.md`).
- Treat webview bridges and plugin APIs as security boundaries, not just contracts (`Capability Checklist` in `references/platform-capabilities.md`).
- Apply H5-only DOM isolation, subpackage/preload and static route-API (`switchTab` vs `navigateTo`) rules, and `setData` payload/frequency discipline in `references/platform-capabilities.md`, and durable store vs `Taro.eventCenter` plus per-page async epoch controllers in `references/contracts-and-state.md`.
5. Verify in the right environment.
- Run repo formatter, typecheck/build, focused tests, and platform compile commands. For Taro, run `taro build --type <target>` for every target the change touches; one target's success is not the others' success.
- Test-code authoring: pick the matching § from the decision table in `testing-strategy/references/test-code-authoring-patterns.md`; smell lint: `testing-strategy/references/fitness-functions.md` §4.1.4.
- Apply **TC traceability** (`createTcSuite` / local TC sidecar), **5-surface deprecation checks**, systemic target diffing, UI/UX redesign `N/A` rules, observation-channel conflict and human-assisted host-test rules, appid/dev-tool runtime surface checks, cold-entry `device-state gap` gates, and sandbox/release kill-switch/policy-URL checks in `references/qa-release.md`.
- For visible changes, inspect the rendered page in the relevant developer tool (WeChat DevTools, Alipay IDE, Douyin DevTools, Baidu DevTools), simulator, preview build, or real device and capture evidence where feasible.
- Return the complete canonical client-record member defined in `../product-ui-ux-design/references/delivery-contract.md` for testing Phase 1 and the design verdict. The member includes its applied rule/decision, affected files/components, preserved behavior, exact command, immutable candidate binding, producer member/version actually exercised, artifacts, tested host/tool/device targets, states/dimensions/capabilities, criterion-mapped observations, coverage boundary, and gaps. A host render proves only the captured host/member states; it cannot close an unbound producer member. `testing-strategy` records aggregate sufficiency before the design owner records the candidate-bound verdict.
- For mini-program runtime changes, developer-tool or real-device smoke is a completion gate, not optional evidence. This includes changes to `Taro.*` or host APIs, `wx.*`/`my.*` calls, chunked/streaming transport, foreground/background recovery, route/share/scene behavior, storage/session restore, permissions/capabilities, and host-rendered loading/error/final states. If the tool or device is missing, first attempt discovery and normal setup; if still unavailable, stop at `pre-runtime-test-ready` or `blocked` and name the owner, attempted commands, residual risk, and next unblock action. `pre-runtime-test-ready` is a handoff-only label; it is not merge-ready, release-ready, or complete.
- Verify route entry, share/deep-link scene params, auth state, storage restore, network error, permission denial, and primary recovery path for affected flows.
## Non-Negotiable Rules
- Do not treat a browser or H5-only preview as proof that a miniapp platform passes. For Taro, `taro build --type h5` passing is not evidence that `weapp`/`alipay`/`tt`/`swan` targets pass.
- Do not call multi-platform miniapp work complete because one host platform compiled.
- Do not add direct platform API calls when the repo has wrappers or adapters.
- Do not import `react-dom` or use real browser-only APIs (DOM mutation, browser observers, RAF/layout APIs, browser globals) in Taro code that compiles to a mini-program target; isolate that code behind the H5 build target.
- Do not sprinkle `process.env.TARO_ENV` branches inside render code as a project convention; confine platform branching to adapter/wrapper modules or platform-specific files. (Taro permits inline branching; the guardrail is a maintainability rule, not a framework limitation.)
- Do not use `Taro.eventCenter` as the canonical owner of durable cross-page state; reserve it for navigation handoff and simple lifecycle events, and clean up listeners on `useDidHide` / `useUnload`.
- Do not ship a page without verifying route registration, entry scene/share params, tab vs. `navigateTo` vs. `switchTab` vs. `redirectTo` vs. `reLaunch` semantics, and page-stack depth budget. Routing defects are a leading cause of host-platform review rejection.
- Do not leave async work running across page hide/unload or route switch: every long-running operation lives under a per-page controller with cancel + lifecycle epoch + late-callback ignore. Callbacks arriving after the epoch advances are dropped.
- Do not let any money / quota / publishing / account-finality mutation rely on a client-side UI lock alone — server-enforced idempotency by business key is the primary defense. Persist pending state before invoking the action; reconcile against backend on cold start / page show / re-login before enabling a retry. Treat local `cancel` as non-final until backend confirms.
- Do not let logout / account-switch leave in-flight work alive: increment the auth epoch, abort pending requests / uploads / pollers, clear query caches and storage namespaces, and drop any callback whose epoch is stale.
- Do not store sensitive durable fields (phone, profile, tenant flag, identity proof, payment metadata) in raw mini-program storage by default. If durable storage is required by product, namespace by user + tenant + platform + app-version, bound by TTL, prefer encrypted or server-backed storage, and add a purge test that runs on logout/account-delete.
- Do not trust scene / share / QR / webview-bridge payloads: schema-parse, server-authorize against current identity, require backend-issued and TTL-bounded share tokens with replay protection, and gate webview bridge by HTTPS origin + path allowlist + per-message capability allowlist + nonce.
- Centralize finite-value parsing, display labels, defaults, unknown-value handling, and non-boundary test literal migration per `references/contracts-and-state.md`.
- Do not ship auth, payment, phone, location, camera, share, subscription, or generated-content flows without explicit denial/error/retry states.
- Do not ship a host platform without compile + developer-tool/real-device evidence for that platform — "recorded as unverified" is only acceptable for non-shipped targets.
- Do not claim a mini-program runtime fix is complete when developer-tool or real-device smoke did not run. Build output, unit tests, source-regex checks, and independent code review can make the branch `pre-runtime-test-ready`; they cannot make host-runtime behavior complete.
- Do not ship review-sensitive surfaces (payment, privacy disclosure, AI/generated content, minors, financial/medical/legal copy, account deletion, SDK data collection) without naming the current platform-policy doc URL + date you read.
- Do not claim platform review or real-device readiness without current evidence.
- Do not put private app ids, secrets, tokens, reviewer accounts, or internal product names into this skill or shared references.
## Reference Loading
- For source provenance, current extraction boundary, and keep/merge/discard decisions, read `references/source-evidence-map.md` when auditing or re-extracting this skill.
- For platform-specific capability and config checks, read `references/platform-capabilities.md`.
- For product/page acceptance and UI state checklist, read `references/product-page-checklist.md`.
- For API, auth, storage, analytics, and high-risk finality contracts, read `references/contracts-and-state.md`.
- For QA, developer-tool, real-device, review submission, release, and rollback checks, read `references/qa-release.md`.
- For framework choice (Taro vs native vs uni-app vs Remax/kbone vs per-platform split) and decision factors, read `references/framework-choice.md`.
- For cross-stack alignment scope (what must align across web + app + mini-program beyond theme/logo — auth copy, error vocabulary, payment confirmation, privacy disclosure, share payload schema, deep-link routes), read `references/cross-stack-alignment.md`.
- For incorporating online best practices (canonical Taro / WeChat / Alipay / Douyin examples, top-tier mini-programs as UX idiom library, vetting weak vs strong online sources) without overclaiming what observation can prove, read `references/online-practice-uptake.md`.
- For cross-stack brand alignment (web desktop + H5 + native app + mini-program sharing one brand), read `../product-ui-ux-design/references/multi-stack-strategy.md` and `../product-ui-ux-design/references/multi-project-token-consistency.md`.