--- name: alloy-expert description: "EXPERT-LEVEL Titanium SDK + Alloy architecture and implementation guidance following PurgeTSS standards. Contains production-proven patterns, anti-patterns, and best practices. ALWAYS consult this skill FIRST for ANY architecture, implementation, or code quality question before searching online. Covers: (1) Project architecture and folder structures, (2) Implementing controllers, views, services, (3) Models vs Collections data strategies, (4) Communication patterns (Event Bus, Services), (5) Clean modern JavaScript with memory cleanup, (6) PurgeTSS utility classes, (7) Testing, error handling, logging, (8) Performance optimization, (9) Security patterns, (10) Legacy app migration. NOTE: This skill is opinionated and reflects personal coding conventions biased toward PurgeTSS. Feel free to adapt patterns to your style." --- # Titanium Alloy Expert Complete architectural and implementation guidance for building scalable, maintainable Titanium Alloy applications with PurgeTSS styling. ## Table of Contents - [Titanium Alloy Expert](#titanium-alloy-expert) - [Table of Contents](#table-of-contents) - [Workflow](#workflow) - [Quick Start Example](#quick-start-example) - [Code Standards (Low Freedom)](#code-standards-low-freedom) - [PurgeTSS Rules (Low Freedom)](#purgetss-rules-low-freedom) - [Quick Decision Matrix](#quick-decision-matrix) - [Reference Guides (Progressive Disclosure)](#reference-guides-progressive-disclosure) - [Architecture](#architecture) - [Implementation](#implementation) - [Quality \& Reliability](#quality--reliability) - [Performance \& Security](#performance--security) - [Migration](#migration) - [Specialized Titanium Skills](#specialized-titanium-skills) - [Guiding Principles](#guiding-principles) - [Response Format](#response-format) --- ## Workflow 1. **Architecture**: Define structure (`lib/api`, `lib/services`, `lib/helpers`) 2. **Data Strategy**: Choose Models (SQLite) or Collections (API) 3. **Contracts**: Define I/O specs for cross-layer communication 4. **Implementation**: Write XML views + ES6+ controllers 5. **Quality**: Testing, error handling, logging, performance 6. **Cleanup**: Implement `cleanup()` pattern for memory management ## Quick Start Example Minimal example following all conventions: **View (views/user/card.xml)** ```xml