uni-app-x-best-practices

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

A set of coding rules for uni-app-x, a framework for building apps across platforms, using its UTS language and related tools.

In plain words
What is it for?
It guides mobile or cross-platform interface code, reusable components, file organization, and strongly typed UTS implementation.
Why use it?
It keeps code structure, typing, naming, and component patterns consistent in uni-app-x projects.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It guides mobile or cross-platform interface code, reusable components, file organization, and strongly typed UTS implementation.

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

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-ai-x/uni-app-x-best-practices.svg)](https://agentmods.dev/rules/dcloudio/uni-ai-x/uni-app-x-best-practices)
Your own site
<a href="https://agentmods.dev/rules/dcloudio/uni-ai-x/uni-app-x-best-practices"><img src="https://agentmods.dev/badge/rules/dcloudio/uni-ai-x/uni-app-x-best-practices.svg" alt="Measured on agentmods" height="20"></a>
Per session 540 This file is loaded in full into every session.
When invoked 540 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.00540 $0.00540
Opus 5 $0.00270 $0.00270
Sonnet 5 $0.00108 $0.00108
Haiku 4.5 $0.00054 $0.00054

Measured 7d ago against content hash f8472f5d3f3a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 7d 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 · 42 lines

What it actually says

Memory Bank

You are an expert in uni-app-x, uts, ucss, uni-app with a deep understanding of best practices and performance optimization techniques in these technologies.

Code Style and Structure

- Write concise, maintainable, and technically accurate UTS code with relevant examples.
- Use functional and declarative programming patterns; avoid classes.
- Favor iteration and modularization to adhere to DRY principles and avoid code duplication.
- Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
- Organize files systematically: each file should contain only related content, such as exported components, subcomponents, helpers, static content, and types.
- Must be strongly typed, and must be typed in any case

Naming Conventions

- Use lowercase with dashes for directories (e.g., components/auth-wizard).
- Favor named exports for functions.

UTS Usage

- Use UTS for all code; prefer interfaces over types for their extendability and ability to merge.
- Avoid enums; use maps instead for better type safety and flexibility.
- Use functional components with UTS interfaces.

Syntax and Formatting

- uni-app-x supports UTS native component development (native views are written by Android/iOS engineers and encapsulated into components) to achieve high-performance cross-platform rendering, while uni-app and Vue projects only support front-end component development.
- Always use the UVue Composition API script setup style.

UI and Styling

- You must first try to implement and refine functionality using components in the current project
- Strictly follow the style attributes supported by UCSS
- Adopt mobile first responsive design
- Avoid using style attributes and selectors that are not supported by UCSS
- Use flex layout first

Component And Easycom

- easycom is uni-app-x's intelligent component management solution. It realizes zero-configuration invocation of components by automatically scanning the components directory and files that comply with the component name/component name.uvue specification. Developers only need to create components according to the agreed catalog, and they can directly use the upper initials of tag names in the template, significantly improving cross-platform development efficiency.
- Automatically register components in the components directory through pages.json, which supports strict matching of component names and file names (such as test/test.uvue)
- Built-in components and easycom components are used directly through capitalized tag names. The responsive system is based on Proxy optimization and supports cross-platform compilation
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. 7d ago First seen · 42 lines · 540 tokens per session scan A f8472f5d3f3a

Subscribe to this mod's changes

uni-app-x-best-practices is a cursor rule published in the GitHub repository dcloudio/uni-ai-x (86 stars, last pushed today), licensed Apache-2.0. It adds 540 tokens to every session, about $0.0027 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.