A comprehensive set of Cursor rules for building on the Flow blockchain with Cadence smart contracts and FCL frontend integration.
This repository provides AI-friendly documentation for Flow blockchain development, organized into two layers:
| File | Purpose |
|---|---|
| cadence-nft-standards.mdc | NFT-specific patterns, MetadataViews integration, modular architecture for complex traits |
| flow-configuration.mdc | Complete flow.json & FCL setup guide covering configuration, deployment, and network management |
| flow-development-workflow.mdc | Development lifecycle, debugging methodology, gas optimization, testnet validation |
| user-preferences.mdc | Communication style and development philosophy preferences (alwaysApply: true) |
- rules/cadence/ - 13 comprehensive Cadence language rules covering security, syntax, patterns, and best practices
- rules/defi-actions/ - DeFi-specific action composition patterns and workflows
Place these files in your Flow project root directory. Cursor will automatically detect and apply these rules when providing AI assistance.
The rules enforce this recommended development sequence:
- Setup → Ensure
flow.jsonand FCL config are correct - Emulator → Test contracts locally first
- Frontend Integration → Test FCL interactions with emulator
- Testnet Deployment → Deploy and validate on testnet
- Production → Deploy to mainnet after comprehensive testing
- Error Prevention: Proactive guidance on common Flow/Cadence pitfalls
- Standards Compliance: Enforces NonFungibleToken interface requirements
- Full-Stack Coverage: Spans from Cadence contracts to React/FCL frontend
- Documentation-First: Prioritizes official Flow documentation and patterns
- Modular Architecture: Advanced patterns for complex, evolving NFT systems
- Security-Focused: Comprehensive security practices for production deployments
- Frontend Integration: Seamless FCL setup with automated contract address resolution
- ❌ Resource type syntax errors (
@vs&vs{}) - ❌ Transaction authorization mismatches
- ❌ FCL configuration network conflicts
- ❌ Contract deployment verification gaps
- ❌ Computation limit exceeded errors (gas optimization)
- ❌ Interface compliance violations
- ❌ Multi-network configuration inconsistencies
- ❌ Frontend contract address resolution failures
- ❌ Security vulnerabilities in access control and capabilities
- Documentation-Driven: Reference official Flow docs first
- Standards Compliance: Follow established Flow/Cadence patterns
- Iterative Testing: Fix one issue at a time, test frequently
- Full-Stack Awareness: Consider contracts → transactions → FCL → UI
Cadence Language Rules (rules/cadence/)
Comprehensive coverage of Cadence language fundamentals:
- Security: Access control, entitlements, capabilities
- Core Concepts: Resources, contracts, transactions, interfaces
- Advanced Topics: Accounts, references, pre/post conditions
- Best Practices: Security patterns, anti-patterns, design patterns
View complete Cadence rules index →
DeFi Action Patterns (rules/defi-actions/)
Specialized rules for DeFi protocol integration:
- Core framework interfaces (Source, Sink, Swapper, AutoBalancer)
- Connector patterns for vault operations and protocol integration
- Workflow templates for restaking and auto-balancing
- Safety rules and testing patterns
The rules include patterns for complex NFTs with:
- Dynamic trait evolution systems
- Breeding and genetic mechanics
- Lazy trait initialization
- Cross-module interactions
Comprehensive strategies for:
- Accumulative processing logic
- Computation limit management
- Efficient loop patterns
- Batch processing techniques
Environment-based setup for:
- Emulator, testnet, and mainnet configurations
- FCL integration with automatic address resolution
- Network-specific contract aliases
- Secure key management
- Clone this repository to your Flow project
- Use Cursor IDE for AI-assisted development
- Ask Flow/Cadence questions - AI references these rules automatically
- Follow the workflow: emulator → testnet → mainnet
# Initialize Flow project
flow init
# Reference root guides for quick help
# - cadence-nft-standards.mdc for NFT development
# - flow-configuration.mdc for setup and deployment
# - flow-development-workflow.mdc for debugging and optimization
# Explore detailed rules for comprehensive coverage
# - rules/cadence/ for language fundamentals
# - rules/defi-actions/ for DeFi integration patternscadence-rules/
├── README.md
├── cadence-nft-standards.mdc # NFT-specific patterns
├── flow-configuration.mdc # Setup & deployment guide
├── flow-development-workflow.mdc # Development lifecycle
├── user-preferences.mdc # AI behavior preferences
└── rules/
├── cadence/ # 13 comprehensive Cadence rules
│ ├── index.md # Navigation hub
│ ├── access-control-and-entitlements.md
│ ├── capabilities-and-security.md
│ ├── resources.md
│ ├── transactions.md
│ └── ... (9 more)
└── defi-actions/ # DeFi integration patterns
├── index.md # Quick links
├── core-framework.md
├── connectors.md
└── ... (10 more)
The rules automatically guide AI responses to match Flow best practices and prevent common development pitfalls.