modern-flexbox

modern-flexbox is a cursor rule for Cursor from maccman/ai-expo-starter-template. It costs 0 tokens per session (577 once invoked), scanned A, original, MIT.

A React Native layout rule that recommends the Flexbox gap property for consistent space between interface elements.

In plain words
What is it for?
Use it when building React Native screens and components with consistent spacing between sections or other flex-based elements.
Why use it?
It keeps spacing controlled by the parent container and continues to work when elements appear or disappear. This makes layouts easier to maintain than adding separate margins to each item.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/.

Good fit Use it when building React Native screens and components with consistent spacing between sections or other flex-based elements.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/maccman/ai-expo-starter-template/modern-flexbox
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/maccman/ai-expo-starter-template

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 modern-flexbox

README.md
[![agentmods](https://agentmods.dev/badge/rules/maccman/ai-expo-starter-template/modern-flexbox.svg)](https://agentmods.dev/rules/maccman/ai-expo-starter-template/modern-flexbox)
Your own site
<a href="https://agentmods.dev/rules/maccman/ai-expo-starter-template/modern-flexbox"><img src="https://agentmods.dev/badge/rules/maccman/ai-expo-starter-template/modern-flexbox.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 577 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.00577
Opus 5 $0.00000 $0.00289
Sonnet 5 $0.00000 $0.00115
Haiku 4.5 $0.00000 $0.00058

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

Security

Grade A, and why

modern-flexbox 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/modern-flexbox.mdc · 99 lines

How it starts

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

Modern React Native Flexbox & Spacing

Always Use Modern Flexbox Features

Gap Property (Preferred)

  • Use gap for consistent spacing between flex children instead of manual margins
  • Automatically handles spacing regardless of conditional rendering
  • Single source of truth for spacing values
// ✅ GOOD: Use gap for automatic spacing
const styles = StyleSheet.create({
  container: {
    gap: 16, // Consistent 16px between all children
    paddingBottom: 20,
  },
})

// ❌ AVOID: Manual margins on individual items
const styles = StyleSheet.create({
  item: {
    marginTop: 16, // Hard to maintain, doesn't adapt
  },
})

Flexbox Layout Patterns

Container Spacing
// ✅ GOOD: Parent controls spacing
;<View style={styles.contentSections}>
  {showDescription && <DescriptionSection />}
  {showAmenities && <AmenitiesSection />}
  {showScoring && <ScoringSection />}
</View>

const styles = StyleSheet.create({
  contentSections: {
    gap: 24, // Automatic spacing between sections
  },
})
Component Interface Design
// ✅ GOOD: Components don't manage their own top spacing
const SectionComponent = () => (
  <View style={styles.section}>
    {/* Content without top margin/padding */}
  </View>
)

// ❌ AVOID: Components with built-in top spacing
const SectionComponent = () => (
  <View style={[styles.section, { marginTop: 20 }]}>
    {/* Tightly coupled spacing */}
  </View>
)

Modern React Native Features to Prefer

Layout

  • Use gap instead of manual margins between flex children
  • Use rowGap and columnGap for fine-grained control
  • Prefer justifyContent and alignItems over absolute positioning

Responsive Design

  • Use Dimensions.get('window') sparingly; prefer flexbox ratios
  • Use percentage widths with flexbox for responsive layouts
  • Leverage flex: 1 for equal distribution

Best Practices

  1. Single Responsibility: Parent containers handle spacing, children handle content
  2. Adaptability: Layouts should work with conditional rendering
  3. Maintainability: Spacing controlled in one place, easy to adjust globally
  4. Clean Interfaces: Components shouldn't assume their positioning context

Read the full file on GitHub · 99 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 · 99 lines · 577 tokens per session scan A aa49153fc54a

Subscribe to this mod's changes

modern-flexbox is a cursor rule published in the GitHub repository maccman/ai-expo-starter-template (4 stars, last pushed 11mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 577 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.