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.
npx agentmods add rules/roninforge/roninforge-kotlin-compose/compose-anti-patternsgit clone --depth 1 https://github.com/RoninForge/roninforge-kotlin-composeWrote 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.
[](https://agentmods.dev/rules/roninforge/roninforge-kotlin-compose/compose-anti-patterns)<a href="https://agentmods.dev/rules/roninforge/roninforge-kotlin-compose/compose-anti-patterns"><img src="https://agentmods.dev/badge/rules/roninforge/roninforge-kotlin-compose/compose-anti-patterns.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.02163 | $0.02163 |
| Opus 5 | $0.01081 | $0.01081 |
| Sonnet 5 | $0.00433 | $0.00433 |
| Haiku 4.5 | $0.00216 | $0.00216 |
Grade A, and why
compose-anti-patterns 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.
How it starts
The opening of the file, as written. The whole thing — 314 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Compose / Kotlin Android Anti-Patterns
Reject these in generated code. Each entry has a BAD example and the CORRECT replacement.
1. View-system leak: findViewById in a Compose project
// BAD
val btn = findViewById<Button>(R.id.submit)
btn.setOnClickListener { ... }
// CORRECT
Button(onClick = { ... }) { Text("Submit") }
Mixing XML layouts and Compose in the same screen forces both engines to run. New screens should be pure Compose.
2. setContentView(R.layout.x) instead of setContent { ... }
// BAD
class MainActivity : AppCompatActivity() {
override fun onCreate(b: Bundle?) {
super.onCreate(b)
setContentView(R.layout.activity_main)
}
}
// CORRECT
class MainActivity : ComponentActivity() {
override fun onCreate(b: Bundle?) {
super.onCreate(b)
setContent { AppTheme { AppNavHost() } }
}
}
3. GlobalScope.launch { }
// BAD - leaks, no lifecycle
GlobalScope.launch { repo.sync() }
// CORRECT - viewModelScope / lifecycleScope / rememberCoroutineScope
viewModelScope.launch { repo.sync() }
GlobalScope survives configuration changes, screen destruction, and process death. Anything started in it leaks until the process dies.
4. LiveData when StateFlow is the default
// BAD
val name: LiveData<String> = MutableLiveData("")
val displayName by vm.name.observeAsState("")
// CORRECT
private val _name = MutableStateFlow("")
val name: StateFlow<String> = _name.asStateFlow()
// in composable
val displayName by vm.name.collectAsStateWithLifecycle()
LiveData works but is legacy. New code uses StateFlow for state, SharedFlow for events.
5. Public MutableStateFlow / MutableState
// BAD
val count = MutableStateFlow(0) // anyone can mutate
// CORRECT
private val _count = MutableStateFlow(0)
val count: StateFlow<Int> = _count.asStateFlow()
Same rule as Java: expose the read-only contract, keep the mutator private.
6. Force-unwrap !!
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.
- 3d ago First seen · 314 lines · 2,163 tokens per session scan A 6716a59c3ac2
compose-anti-patterns is a cursor rule published in the GitHub repository RoninForge/roninforge-kotlin-compose (1 stars, last pushed 2mo ago), licensed MIT. It adds 2,163 tokens to every session, about $0.0108 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-08-31.
Other cursor rules, from other repositories
tailwind-v4-anti-patterns
Tailwind CSS v4 anti-pattern detection. Prevents the most common AI-generated mistakes: version mixing, deprecated config patterns, and removed utilities.
tailwind-v4-config
Tailwind CSS v4 configuration rules for CSS and build tool files. Covers @theme, @source, @import, PostCSS, and Vite plugin setup.
tailwind-v4-core
Core Tailwind CSS v4 rules. Enforces correct v4 syntax and prevents common v3 fallbacks. Attach to all conversations involving Tailwind CSS.
tailwind-v4-migration
Tailwind CSS v3-to-v4 migration rules. Activated when the agent determines migration work is needed. Covers step-by-step upgrade process, common pitfalls, and automated migration tooling.
tailwind-v4-utilities
Tailwind CSS v4 utility class rules for template and markup files. Covers renamed classes, new utilities, container queries, gradients, and accessibility patterns.
android-project
Core behavior rules for AI agents working on this Android project.