uni-app-x-best-practices

uni-app-x-best-practices is a cursor rule for Cursor from dcloudio/uni-app-x-ai-rules. It costs 367 tokens per session, scanned A, original, Apache-2.0.

Coding rules for uni-app x, a framework for building applications that run across multiple platforms, using the UTS language.

In plain words
What is it for?
They help create uni-app x pages, place them in the correct directories, register routes, write UTS and uVue code, and handle platform-specific behavior.
Why use it?
They keep code consistent with the framework's strict typing, platform-specific rules, page structure, and scrolling requirements.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit They help create uni-app x pages, place them in the correct directories, register routes, write UTS and uVue code, and handle platform-specific behavior.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/dcloudio/uni-app-x-ai-rules/uni-app-x-best-practices
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.

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

Made for: Cursor.

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-best-practices

README.md
[![agentmods](https://agentmods.dev/badge/rules/dcloudio/uni-app-x-ai-rules/uni-app-x-best-practices/github.svg)](https://agentmods.dev/rules/dcloudio/uni-app-x-ai-rules/uni-app-x-best-practices)
Your own site
<a href="https://agentmods.dev/rules/dcloudio/uni-app-x-ai-rules/uni-app-x-best-practices"><img src="https://agentmods.dev/badge/rules/dcloudio/uni-app-x-ai-rules/uni-app-x-best-practices/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for uni-app-x-best-practices

Your own site · 80×15
<a href="https://agentmods.dev/rules/dcloudio/uni-app-x-ai-rules/uni-app-x-best-practices"><img src="https://agentmods.dev/badge/rules/dcloudio/uni-app-x-ai-rules/uni-app-x-best-practices.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 367 This file is loaded in full into every session.
When invoked 367 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00367 $0.00367
Opus 5 $0.00183 $0.00183
Sonnet 5 $0.00073 $0.00073
Haiku 4.5 $0.00037 $0.00037

Measured 8d ago against content hash fc8eca451d44, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

uni-app-x-best-practices 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 8d 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.

.cursor/rules/uni-app-x-best-practices.mdc · 25 lines

What it actually says

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约定的规范。
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. 8d ago First seen · 25 lines · 367 tokens per session scan A fc8eca451d44

Subscribe to this mod's changes

uni-app-x-best-practices is a cursor rule published in the GitHub repository dcloudio/uni-app-x-ai-rules (30 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 367 tokens to every session, about $0.0018 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.