Cline rules
.clinerules/PROJECT_RULES.mdCline rules
Quality
76/100
Scores the file, not the repository.Length
2,120 words
57 headings · 13 code blocksRepository
0
— · pushed 190 days agoLast changed
2 days ago
First indexed 2 days ago.1# WalletPro Mobile - Complete Project Rules Guide23This document serves as the definitive guide for LLMs working on the WalletPro Mobile project. It outlines all architectural patterns, coding standards, and operational rules that must be followed.45## 📋 Table of Contents671. [Project Overview](#project-overview)82. [Architecture & Structure Rules](#architecture--structure-rules)93. [Development Rules](#development-rules)104. [Blockchain Integration Rules](#blockchain-integration-rules)115. [UI/UX Rules](#uiux-rules)126. [State Management Rules](#state-management-rules)137. [Security Rules](#security-rules)148. [Build & Deployment Rules](#build--deployment-rules)159. [Testing Rules](#testing-rules)1610. [Performance Rules](#performance-rules)1718---1920## 🎯 Project Overview2122**WalletPro Mobile** is a React Native cryptocurrency wallet built with Expo and Alchemy's Account Kit. It enables users to manage smart accounts across multiple blockchain networks with a focus on security, usability, and modern mobile UX.2324### Core Technologies25- **React Native 0.76.9** + **Expo 52.0.47**26- **TypeScript** for type safety27- **Alchemy Account Kit** for smart account management28- **Zustand** for state management29- **NativeWind** (Tailwind CSS) for styling30- **HeroUI Native** component library3132---3334## 🏗️ Architecture & Structure Rules3536### File Organization37```38walletpro-mobile/39├── app/ # Expo Router pages40│ ├── (main)/ # Main app sections41│ ├── accounts/ # Account management42│ ├── send/ # Transaction sending43│ ├── history/ # Transaction history44│ └── settings/ # App settings45├── src/46│ ├── components/ # Reusable UI components47│ │ └── ui/ # HeroUI Native primitives48│ ├── config/ # Configuration files49│ ├── context/ # React contexts50│ ├── hooks/ # Custom hooks51│ ├── lib/ # Utility libraries52│ ├── store/ # Zustand stores53│ ├── types/ # TypeScript type definitions54│ └── utils/ # Utility functions55├── assets/ # Static assets56└── docs/ # Project documentation57```5859### Component Creation Rules601. **Always use TypeScript interfaces** for props612. **Follow HeroUI Native patterns** for UI components623. **Use NativeWind classes** for styling, never inline styles634. **Create components in `src/components/`** for reusability645. **Use PascalCase for component names**656. **Export components as named exports**6667```typescript68// ✅ Correct69interface ButtonProps {70 title: string;71 onPress: () => void;72 variant?: 'primary' | 'secondary';73}7475export const CustomButton: React.FC<ButtonProps> = ({76 title,77 onPress,78 variant = 'primary'79}) => {80 return (81 <Button82 className="bg-primary text-primary-foreground"83 onPress={onPress}84 >85 <Text>{title}</Text>86 </Button>87 );88};89```9091### Navigation Structure921. **Use Expo Router** for all navigation932. **File-based routing** in the `app/` directory943. **Layout files** (_layout.tsx) define shared UI954. **Modal presentations** use specific stack screen options965. **Always use safe area insets** for mobile layouts9798```typescript99// ✅ Correct modal setup100<Stack.Screen101 name="otp-modal"102 options={{103 presentation: Platform.OS === "ios" ? "formSheet" : "containedTransparentModal",104 animation: Platform.OS === "android" ? "slide_from_bottom" : "default",105 }}106/>107```108109---110111## 💻 Development Rules112113### TypeScript Standards1141. **Strict TypeScript configuration** - no `any` types allowed1152. **Use Viem types** for blockchain-related types1163. **Create interfaces** for all complex data structures1174. **Use type guards** for runtime type checking1185. **Export types** from dedicated files in `src/types/`119120```typescript121// ✅ Correct typing122import type { Address, Chain } from "viem";123124export interface WalletAccount {125 id: string;126 name: string;127 address: Address; // Use Viem Address type128 privateKey: string; // Encrypted in storage129 createdAt: number;130 lastUsed: number;131 accountType?: 'smart' | 'imported';132}133```134135### Code Style Rules1361. **Use PNPM** as package manager1372. **Follow ESLint and Prettier** configurations1383. **Use functional components** with hooks1394. **Prefer named exports** over default exports1405. **Use const** for all declarations unless reassignment is needed1416. **Implement error boundaries** for all major screens142143### Import Organization144```typescript145// ✅ Correct import order1461. React & React Native imports1472. Third-party library imports1483. Expo imports1494. Account Kit imports1505. Internal imports (src/*)1516. Relative imports152```153154### Hook Usage Patterns1551. **Custom hooks go in `src/hooks/`**1562. **Use naming convention**: `use` + descriptive name1573. **Always return consistent shape** from custom hooks1584. **Handle loading and error states** in all async hooks159160```typescript161// ✅ Correct hook pattern162export const useAccountBalance = (address: Address) => {163 const [balance, setBalance] = useState<bigint>();164 const [isLoading, setIsLoading] = useState(true);165 const [error, setError] = useState<Error>();166167 useEffect(() => {168 // Implementation169 }, [address]);170171 return { balance, isLoading, error };172};173```174175---176177## ⛓️ Blockchain Integration Rules178179### Account Kit Integration1801. **Use AlchemyAuthSessionProvider** at app root1812. **Always use ModularAccountV2** account type1823. **Session expiration**: 24 hours default1834. **Policy ID** from environment variables for all chains184185```typescript186// ✅ Correct Account Kit setup187const config = createConfig({188 chain: defaultAlchemyChain,189 sessionConfig: {190 expirationTimeMs: 1000 * 60 * 60 * 24, // 24 hours191 },192 transport: alchemy({193 apiKey: Constants.expoConfig?.extra?.EXPO_PUBLIC_ALCHEMY_API_KEY!,194 }),195});196```197198### Multi-Chain Support1991. **Use chains from `@account-kit/infra`** for supported networks2002. **Default chain**: Sepolia for development2013. **Custom networks** stored in local storage2024. **Network status monitoring** for all chains2035. **Gas sponsorship** where available204205```typescript206// ✅ Correct chain configuration207export const alchemyChains = [208 sepolia, // Default209 mainnet,210 arbitrum,211 base,212 optimism,213 // ... other supported chains214];215```216217### Transaction Management2181. **Always estimate gas** before sending transactions2192. **Use gas sponsorship** when available2203. **Implement proper error handling** for failed transactions2214. **Store transaction history** locally with chain info2225. **Refresh balances** after successful transactions223224### Balance Tracking2251. **Use reactive balance version** for updates2262. **Fetch both native and token balances**2273. **Implement USD price conversion** where possible2284. **Cache balances** with TTL for performance229230---231232## 🎨 UI/UX Rules233234### Theme System2351. **Use HSL color tokens** defined in Tailwind config2362. **Support system, light, and dark themes**2373. **Theme detection** via `useColorScheme` hook2384. **All components** must support theme switching239240```typescript241// ✅ Correct theme usage242const { colorScheme, isDarkColorScheme } = useColorScheme();243const theme = isDarkColorScheme ? DARK_THEME : LIGHT_THEME;244```245246### Component Library Rules2471. **Use HeroUI Native primitives** from `@rn-primitives/*`2482. **Follow established patterns** from existing components2493. **Never style HeroUI components** with conflicting styles2504. **Use semantic variants** (primary, secondary, destructive)251252```typescript253// ✅ Correct component usage254import { Button } from '@src/components/ui/button';255import { Card, CardContent, CardHeader } from '@src/components/ui/card';256257<Button variant="primary" size="lg">258 <Text>Send Transaction</Text>259</Button>260```261262### Layout & Responsive Design2631. **Always use SafeAreaView** for mobile layouts2642. **Use flexbox layouts** with NativeWind classes2653. **Implement proper spacing** using Tailwind spacing scale2664. **Handle platform differences** with Platform.OS checks2675. **Use hairline borders** for subtle dividers268269### Navigation Patterns2701. **Bottom navigation** for main sections2712. **Stack navigation** for detail screens2723. **Modal presentations** for overlays2734. **Consistent header patterns** across screens2745. **Deep linking support** via Expo Router275276---277278## 🗃️ State Management Rules279280### Zustand Store Architecture2811. **Single UI store** for all application state2822. **Use subscribeWithSelector middleware** for optimization2833. **Organize state by domain** (network, accounts, theme, etc.)2844. **Create action functions** for all state updates2855. **Use selectors** for optimized re-renders286287```typescript288// ✅ Correct store pattern289interface UIStore {290 // State291 selectedNetwork: Chain;292 activeAccount: WalletAccount | null;293294 // Actions295 setSelectedNetwork: (chain: Chain) => void;296 setActiveAccount: (account: WalletAccount | null) => void;297}298299// Selectors for optimization300export const useSelectedNetwork = () => useUIStore((state) => state.selectedNetwork);301```302303### State Synchronization3041. **Use storage-sync middleware** for persistence3052. **Sync critical state** (accounts, settings, theme)3063. **Handle sync conflicts** gracefully3074. **Implement versioning** for store migrations308309### Background Communication3101. **Use background bridge** for cross-process communication3112. **Message types** follow strict naming convention3123. **Handle all message types** in background bridge3134. **Acknowledge all messages** from background processes314315---316317## 🔒 Security Rules318319### Private Key Management3201. **Never store private keys** in plain text3212. **Use encrypted storage** (react-native-mmkv)3223. **Implement wallet locking** mechanism3234. **Secure key derivation** for account creation3245. **Memory cleanup** after key operations325326### Authentication & Session3271. **Session expiration** after 24 hours3282. **Secure session storage** in device storage3293. **Biometric authentication** where available3304. **Session invalidation** on app backgrounding331332### Input Validation3331. **Validate all addresses** using Viem utilities3342. **Sanitize all user inputs** before processing3353. **Implement transaction signing** confirmations3364. **Validate chain IDs** before network switches337338### Secure Storage3391. **Use react-native-mmkv** for encrypted storage3402. **Separate sensitive data** from general storage3413. **Implement storage cleanup** on logout3424. **Backup encryption keys** securely343344---345346## 🚀 Build & Deployment Rules347348### Environment Configuration3491. **Use app.json extra section** for environment variables3502. **Never commit sensitive values** to version control3513. **Required variables**: `EXPO_PUBLIC_ALCHEMY_API_KEY`, `EXPO_PUBLIC_ALCHEMY_POLICY_ID`3524. **Platform-specific builds** via EAS Build353354```json355// ✅ Correct environment setup356{357 "expo": {358 "extra": {359 "EXPO_PUBLIC_ALCHEMY_API_KEY": "your-key-here",360 "EXPO_PUBLIC_ALCHEMY_POLICY_ID": "your-policy-id-here"361 }362 }363}364```365366### Build Requirements3671. **Expo SDK 52.0.47** - exact version required3682. **React Native 0.76.9** - exact version required3693. **Node.js 18+** for development3704. **PNPM 10.15.0+** as package manager371372### Platform Considerations3731. **iOS**: Support iOS 13+ with proper Info.plist configuration3742. **Android**: Target API 33+ with proper permissions3753. **Universal builds** for both platforms3764. **App Store optimization** with proper metadata377378### Version Management3791. **Semantic versioning** for releases3802. **Changelog maintenance** for all releases3813. **Branch protection** for main branch3824. **Automated builds** via GitHub Actions383384---385386## 🧪 Testing Rules387388### Component Testing3891. **Test all components** with React Native Testing Library3902. **Mock external dependencies** (Account Kit, navigation)3913. **Test user interactions** and state changes3924. **Coverage requirement**: 80% minimum393394### Integration Testing3951. **Test store interactions** with mock data3962. **Test navigation flows** between screens3973. **Test blockchain integrations** with testnet data3984. **Test error scenarios** and edge cases399400### Test Organization401```402src/403├── components/404│ └── __tests__/ # Component tests405├── store/406│ └── __tests__/ # Store tests407├── utils/408│ └── __tests__/ # Utility tests409└── __mocks__/ # Mock definitions410```411412### Mock Patterns4131. **Mock Account Kit** for wallet operations4142. **Mock Viem** for blockchain interactions4153. **Mock navigation** for routing tests4164. **Mock AsyncStorage** for storage tests417418---419420## ⚡ Performance Rules421422### Component Optimization4231. **Use React.memo** for expensive components4242. **Implement virtual lists** for long lists4253. **Optimize re-renders** with proper selectors4264. **Use useCallback** and **useMemo** strategically427428### Bundle Optimization4291. **Tree-shake unused imports**4302. **Lazy load heavy components**4313. **Optimize image assets** with proper sizing4324. **Use Hermes engine** for Android performance433434### Memory Management4351. **Cleanup listeners** in useEffect return functions4362. **Avoid memory leaks** in long-lived components4373. **Implement proper cache invalidation**4384. **Monitor memory usage** in development439440### Network Optimization4411. **Implement request caching** for API calls4422. **Use WebSocket connections** for real-time updates4433. **Batch multiple operations** where possible4444. **Implement offline support** with local storage445446---447448## 📝 Development Workflow Rules449450### Git Workflow4511. **Feature branches** from main branch4522. **Descriptive commit messages** following conventional commits4533. **Pull request reviews** required for all changes4544. **Automated tests** must pass before merge455456### Code Review Checklist457- [ ] TypeScript types are correct458- [ ] Components follow established patterns459- [ ] Security best practices are followed460- [ ] Tests are written and passing461- [ ] Documentation is updated462- [ ] Performance implications considered463464### Release Process4651. **Version bump** in package.json4662. **Update changelog** with new features4673. **Create release tag** in Git4684. **Deploy to staging** for final testing4695. **Deploy to production** after approval470471---472473## 🚨 Critical Rules (Must Follow)474475### NEVER DO These:4761. **NEVER store private keys** in plain text4772. **NEVER commit API keys** to version control4783. **NEVER use `any` type** in TypeScript4794. **NEVER skip error handling** in async operations4805. **NEVER modify HeroUI components** directly4816. **NEVER use inline styles** instead of Tailwind classes4827. **NEVER skip type safety** for blockchain operations483484### ALWAYS DO These:4851. **ALWAYS validate addresses** before transactions4862. **ALWAYS handle loading states** in async operations4873. **ALWAYS use selectors** for store subscriptions4884. **ALWAYS implement error boundaries** for major screens4895. **ALWAYS test on both platforms** before release4906. **ALWAYS follow the established patterns** in this guide4917. **ALWAYS update documentation** for API changes492493---494495## 🔍 Troubleshooting Guide496497### Common Issues4981. **Build failures**: Check package versions match requirements4992. **Type errors**: Ensure proper Viem types are used5003. **Theme issues**: Verify theme tokens are properly applied5014. **Store issues**: Check selector usage and action calls5025. **Navigation issues**: Verify file-based routing structure503504### Debug Patterns5051. **Use Flipper** for React Native debugging5062. **Enable React DevTools** for component inspection5073. **Use console logs** with proper context5084. **Test with different device sizes**5095. **Verify network connectivity** for blockchain operations510511---512513This document serves as the single source of truth for all development activities in the WalletPro Mobile project. All LLMs working on this project must follow these rules to maintain code quality, security, and consistency.514515**Last Updated**: January 14, 2026516**Version**: 1.0.0517
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 6 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/60-pubmed-python.md · 6 | Cline rules | setuptestlint-formatstyle+2 | 86/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/60-pubmed-python.md · 6 | Cline rules | setuptestlint-formatstyle+2 | 86/100 | 3 days ago |
