compose_ui_guideline

compose_ui_guideline is a cursor rule for Cursor from moclam1905/CocktailRecipes. It costs 0 tokens per session (663 once invoked), scanned A, original, MIT.

A set of rules for building Android interfaces with Jetpack Compose, Android's framework for describing screens in Kotlin code.

In plain words
What is it for?
It helps structure screens and reusable components, handle UI state, control recomposition, and follow Kotlin conventions.
Why use it?
It keeps components, state, naming, and function parameters consistent so the interface is easier to maintain.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit It helps structure screens and reusable components, handle UI state, control recomposition, and follow Kotlin conventions.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/moclam1905/cocktailrecipes/compose_ui_guideline
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/moclam1905/CocktailRecipes

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 compose_ui_guideline

README.md
[![agentmods](https://agentmods.dev/badge/rules/moclam1905/cocktailrecipes/compose_ui_guideline.svg)](https://agentmods.dev/rules/moclam1905/cocktailrecipes/compose_ui_guideline)
Your own site
<a href="https://agentmods.dev/rules/moclam1905/cocktailrecipes/compose_ui_guideline"><img src="https://agentmods.dev/badge/rules/moclam1905/cocktailrecipes/compose_ui_guideline.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 663 The whole file, excluding the scripts and references it only reads on demand.
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.00000 $0.00663
Opus 5 $0.00000 $0.00331
Sonnet 5 $0.00000 $0.00133
Haiku 4.5 $0.00000 $0.00066

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

Security

Grade A, and why

compose_ui_guideline 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/ui-rules/compose_ui_guideline.mdc · 70 lines

How it starts

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

Compose UI Guideline– Android Kotlin Jetpack Compose

1. Naming Conventions

  • Stateless vs Stateful
    • Stateless: @Composable fun ItemCard(item: Item, onClick: () -> Unit) – displays the passed-in data without holding state.
    • Stateful: append WithState() or define inside a Defaults class (based on API guideline).
  • Screens: end with Screen (e.g., HomeScreen, DetailScreen).
  • Section/Container: use suffix Section or Container for layout-only groupings.
  • Callback parameters should always be placed last (per Kotlin coding style).

2. Function Signature

@Composable
fun FancyButton(
    text: String,
    modifier: Modifier = Modifier,
    enabled: Boolean = true,
    onClick: () -> Unit,
)
  • modifier should come first after data-state params to enable readable chaining.
  • Avoid nullable parameters that mean “off” – provide meaningful default values instead.

3. Stable State & Recomposition

  • Composables must be idempotent – same input produces same UI.
  • Inputs should be immutable or marked with @Stable. If passing MutableState, wrap with remember { mutableStateOf(...) }.
  • Use rememberSaveable for states that need to survive configuration changes.

4. Modifier Order

  1. Layout (fillMaxWidth, size)
  2. Appearance (background, border)
  3. Interaction (clickable, pointerInput)
  4. Animation (graphicsLayer, animate...)

Follows Google’s recommended modifier ordering to prevent hit-box bugs.

5. Accessibility

  • Always assign contentDescription to images.
  • Use semantics {} to override roles when needed.
  • Use mergeDescendants = true to combine children if too verbose for screen readers.

6. Preview & Theming

  • Every public composable must have at least one @Preview in the same file with default theme.
  • Use MaterialTheme.colorScheme and MaterialTheme.typography for design tokens.
  • Avoid hard-coded dp/sp values – prefer dimensionResource for design specs.

Read the full file on GitHub · 70 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. 8d ago First seen · 70 lines · 663 tokens per session scan A b0e218bfc564

Subscribe to this mod's changes

compose_ui_guideline is a cursor rule published in the GitHub repository moclam1905/CocktailRecipes (1 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 663 tokens. 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-08-31.

Related

Other cursor rules, from other repositories

compose-performance

Compose performance: stability annotations (@Stable, @Immutable), strong-skipping in Kotlin 2.x, key-based recomposition, derivedStateOf, remember{} keys, deferred reads, Compose previews + Paparazzi for screenshot tests.

RoninForge/roninforge-kotlin-compose · 0 tokens

expo

Expo/React Native: native modules, navigation, platform-specific code.

nedcodes-ok/cursorrules-collection · 494 tokens

react-native

A set of rules for building mobile apps with TypeScript, React Native, Expo, and mobile interface components. React Native lets developers create native mobile apps with React, while Expo provides supporting tools.

flyeric0212/cursor-rules · 1,389 tokens

android-project

Core behavior rules for AI agents working on this Android project.

JoDaBaRo/agentic-mobile-rules · 8,084 tokens

android-project-bootstrap

Walks a developer through bootstrapping a BRAND-NEW Android project for agentic CLI delivery — creating the Firebase project, registering the Android app, setting up App Distribution, creating the Google Play Console listing, wiring API access, and installing the Gradle plugins. Use when the user says they're starting…

JoDaBaRo/agentic-mobile-rules · 106 tokens

ios-project-bootstrap

Walks a developer through bootstrapping a BRAND-NEW iOS project for agentic CLI delivery — Apple Developer Program enrollment, App Store Connect listing, provisioning profiles, Fastlane setup from scratch, Firebase App Distribution, TestFlight + App Store first upload. Use when the user says they're starting a new iOS…

JoDaBaRo/agentic-mobile-rules · 108 tokens