uni-app-x-ai-rules copilot-instructions.md

uni-app-x-ai-rules copilot-instructions.md is an instructions file for GitHub Copilot from dcloudio/uni-app-x-ai-rules. It costs 17,451 tokens per session, scanned A, original, Apache-2.0.

A set of Copilot instructions for uni-app x, a framework for building cross-platform apps with UTS and Vue-like pages.

In plain words
What is it for?
Use it when creating or editing uni-app x pages, components, APIs, and platform-specific code.
Why use it?
It gives project-specific rules for code structure, supported APIs, page files, components, and platform differences.

Instructions file for GitHub Copilot

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/dcloudio/uni-app-x-ai-rules/copilot-instructions
Clone the repo
git clone --depth 1 https://github.com/dcloudio/uni-app-x-ai-rules

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for uni-app-x-ai-rules copilot-instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/dcloudio/uni-app-x-ai-rules/copilot-instructions.svg)](https://agentmods.dev/instructions/dcloudio/uni-app-x-ai-rules/copilot-instructions)
Your own site
<a href="https://agentmods.dev/instructions/dcloudio/uni-app-x-ai-rules/copilot-instructions"><img src="https://agentmods.dev/badge/instructions/dcloudio/uni-app-x-ai-rules/copilot-instructions.svg" alt="Measured on agentmods" height="20"></a>
Per session 17,451 This file is loaded in full into every session.
When invoked 17,451 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.17451 $0.17451
Opus 5 $0.08725 $0.08725
Sonnet 5 $0.03490 $0.03490
Haiku 4.5 $0.01745 $0.01745

Measured 3d ago against content hash 6c29fa2dab5c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

uni-app-x-ai-rules copilot-instructions.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/copilot-instructions.md · 2,574 lines

How it starts

The opening of the file, as written. The whole thing — 2,574 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Memory Bank

你熟悉 uni-app x框架,擅长编写跨平台且高性能的代码。 uni-app x项目使用UTS语言编写script。 UTS是一种跨平台的强类型语言,类似TS语言但类型要求更加严格。

Code Style and Structure

- 简洁易懂,复杂的代码配上中文注释。
- 严格类型匹配,不使用隐式转换。
- 不使用变量和函数的声明提升,严格的在清晰的范围内使用变量和函数。
- 当生成某个平台专用代码时,应使用条件编译进行平台约束,避免干扰其他平台。

project

- 遵循uni-app x的项目结构,在正确的目录中放置生成的文件。

page

- 使用uvue作为页面后缀名,uvue与vue基本类似,但有少量细节差异。
- 生成的uvue页面放置在项目的pages目录下,生成的页面需要在pages.json中注册。
- 可滚动内容必须在scroll-view、list-view、waterflow等滚动容器中。如果页面需要滚动,则在页面template的一级子节点放置滚动容器,例如` <scroll-view style="flex:1">`。此时应在 App 上使用条件编译,例如: `<!-- #ifdef APP --><scroll-view class="container"><!-- #endif -->`
- 生成uvue页面时,页面内容需符合uts.mdc、uvue.mdc、ucss.mdc、api.mdc约定的规范。

API

- 可以使用uts的api,但注意版本和平台的兼容性。
- 可以使用uni-app x的api,但注意版本和平台的兼容性。
- 可以使用vue3的api,但注意版本和平台的兼容性。
- 可以使用操作系统的api,但注意版本和平台的兼容性。尽量在uts插件中调用系统原生API,而不是在uvue页面中直接调用系统原生API。
- 特定平台或特定版本以上才能使用的代码,需使用条件编译包围这些代码,或者放置在平台专用的目录文件中。
- 通过mcp工具查询项目下可用的插件。
- 跨页面通信优先使用eventbus。

uvue rules

vue support

- 仅使用vue3语法,避免使用vue2。
- 新页面尽量使用组合式API。
- 组件尽量使用easycom规范。
- 非easycom的自定义vue组件,调用组件方法时需使用组件实例的`$callMethod`方式调用。
- 不使用 pinia、vuex、i18n 等uni-app x不支持的vue插件。
- 使用vue语法时需注意uni-app x官网的平台和版本兼容性,平台特殊代码需包裹在条件编译中。

## component
- 组件可使用uni-app x内置组件,以及项目下的自定义组件。通过mcp工具查询项目下可用的easycom插件。
- 项目可使用vuejs组件规范,对应的文件扩展名为uvue。
- 符合easycom规范的组件无需import和注册,可直接在template中使用。
- 使用内置组件时需注意uni-app x官网的平台和版本兼容性,平台特殊代码需包裹在条件编译中。

conditional compilation

core syntax

```
// Platform basic judgment
#ifdef APP || MP
//Mini programs/APP common code
#ifdef APP-ANDROID
    // Android-specific logic
#endif
#ifdef APP-IOS
    // IOS-specific logic
#endif
#endif
```

Core Platform Identifier

uniVersion is used to distinguish the version of the compiler Details HBuilderX 3.9.0 
APP App
APP-ANDROID App Android Platform Details
APP-IOS App iOS Platform Details
APP-HARMONY App HarmonyOS Next platform
WEB web (same as H5) HBuilderX 3.6.3 
MP-WEIXIN WeChat Mini Program
MP-ALIPAY APPLET
MP-BAIDU BAIDU MINI PROGRAM
MP-TUTIAO TIKTOK MINI PROGRAM
MP-KUAISHOU Kuaishou Mini Program
MP-JD JD Mini Program
MP-HARMONY Harmony Atom Service HBuilderX 4.34 
MP-XHS Xiaohongshu Mini Program
MP WeChat Mini Program/Alipay Mini Program/Baidu Mini Program/Douyin Mini Program/Feishu Mini Program/QQ Mini Program/360 Mini Program/Hongmeng atom Service

Read the full file on GitHub · 2,574 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 2,574 lines · 17,451 tokens per session scan A 6c29fa2dab5c

Subscribe to this mod's changes

uni-app-x-ai-rules copilot-instructions.md is an instructions file published in the GitHub repository dcloudio/uni-app-x-ai-rules (30 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 17,451 tokens to every session, about $0.0873 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.