--- name: valdi description: This skill should be used when working on Valdi framework projects. Valdi is Snapchat's cross-platform UI framework that compiles TypeScript/TSX components into native views for iOS, Android, and macOS. It provides specialized knowledge for component architecture, Bazel build system, native bindings, TSX elements, and cross-platform development. Use this skill when implementing Valdi components, debugging build issues, or creating new Valdi projects. --- # Valdi Framework Development Skill Specialized guidance for developing cross-platform applications with Valdi, Snapchat's native UI framework that compiles TypeScript/TSX to native iOS, Android, and macOS views. ## Overview Valdi is NOT a WebView-based framework. It compiles TypeScript components directly into native platform code, delivering native performance without JavaScript bridges. The framework has been used in Snap's production apps for over 8 years. ## When to Use This Skill Invoke this skill when: - Working on any Valdi framework project - Creating new Valdi components or modules - Configuring Bazel build files for Valdi - Implementing native bindings (CppModule, NativeModule) - Debugging cross-platform rendering issues - Setting up Valdi development environment - Understanding Valdi's TSX element system ## Key Principles ### 1. Bazel is Mandatory Valdi uses Bazel exclusively for builds. Never suggest alternative build systems. **Common commands:** ```bash # Install CLI globally pnpm install -g @snap/valdi # Setup development environment valdi dev_setup # Check environment health valdi doctor # Bootstrap new project valdi bootstrap # Install platform dependencies valdi install ios valdi install android # Enable hot reload during development valdi hotreload # Sync project configuration valdi projectsync ``` ### 2. Component Architecture Valdi components are class-based with lifecycle methods: ```tsx import { Component, ComponentContext } from 'valdi_core'; interface ViewModel { title: string; count: number; } class MyComponent extends Component { onCreate(): void { // Initialize component console.log('Component created'); } onMount(): void { // Component mounted to view hierarchy } onUnmount(): void { // Cleanup before removal } onRender() { return ( ); } } ``` ### 3. Native TSX Elements Valdi provides native UI elements (NOT HTML): | Element | Purpose | |---------|---------| | `` | Container view (like div) | | `` | Flexbox layout container | | `` | Scrollable container | | `