
# Row-Level Security Patterns Database security patterns for multi-tenant and user-scoped data. > **Template Usage:** Customize for your database (PostgreSQL, Supabase, etc.) and auth system. ## RLS Fundamentals ### Enable RLS on Tables ```sql -- Enable RLS (required before policies take effect) ALTER TABLE users ENABLE ROW LEVEL SECURITY; ALTER TABLE posts ENABLE ROW LEVEL SECURITY; ALTER TABLE comments ENABLE ROW LEVEL SECURITY; -- Force RLS for table owners too (recommended) ALTER TABLE
Debug and implement Airtable synchronization logic including duplicate prevention, cache management, change detection, and RLS considerations; use when debugging sync failures, stale cache issues, or implementing new Airtable sync features
Server action patterns for Ballee with auth wrappers, Zod validation, error handling, and path revalidation. Use when creating server actions, implementing API endpoints, or handling form submissions.
# API Patterns Server-side API patterns for building secure, validated, and type-safe endpoints. > **Template Usage:** Customize for your framework (Next.js, Express, Fastify, etc.) and validation library (Zod, Yup, etc.). ## Server Action Pattern (Next.js App Router) ```typescript 'use server'; import { z } from 'zod'; import { revalidatePath } from 'next/cache'; // 1. Define validation schema const CreateItemSchema = z.object({ name: z.string().min(1).max(100).transform(v => v.trim()),
# Authentication Patterns Authentication and authorization patterns for secure applications. > **Template Usage:** Customize for your auth provider (NextAuth, Supabase Auth, Auth0, Clerk, etc.). ## Session vs JWT | Aspect | Session-Based | JWT-Based | |--------|---------------|-----------| | Storage | Server (DB/Redis) | Client (cookie/localStorage) | | Scalability | Needs shared session store | Stateless, easy to scale | | Revocation | Immediate (delete session) | Harder (need blocklist) |
# Background Jobs Patterns Queue-based job processing, scheduled tasks, and worker patterns. > **Template Usage:** Customize for your queue provider (BullMQ, Inngest, Trigger.dev, AWS SQS) and runtime. ## Job Types | Type | Use Case | Example | |------|----------|---------| | **Async Tasks** | Deferred processing | Send email, process image | | **Scheduled** | Recurring tasks | Daily reports, cleanup | | **Delayed** | Future execution | Reminder after 24h | | **Batch** | Process many items |
# CI/CD Patterns Continuous Integration and Deployment patterns for modern applications. > **Template Usage:** Customize for your CI provider (GitHub Actions, GitLab CI, CircleCI) and deployment target (Vercel, AWS, etc.). ## GitHub Actions Structure ```yaml # .github/workflows/ci.yml name: CI on: push: branches: [main, dev] pull_request: branches: [main, dev] # Cancel in-progress runs on new commits concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-pro
Automated code quality fixes for linting, types, unused variables, and error handling; use when fixing code quality issues in bulk
Create production-ready Supabase migrations for Ballee following strict naming conventions, idempotent SQL, RLS patterns, and storage bucket policies; use when user requests schema changes, adding columns, RLS policies, database functions, or storage buckets
Detection rules and grep patterns for database performance anti-patterns. Use when scanning codebase for N+1 queries, sequential queries, or connection pool issues.
# Database Anti-Patterns Detection and fix patterns for common database performance issues. > **Template Usage:** Customize the code patterns and grep commands for your ORM (Prisma, Drizzle, TypeORM, Sequelize, etc.). ## N+1 Query Detection ### What is N+1? ```typescript // BAD: N+1 Query - 1 query for users + N queries for posts const users = await db.user.findMany(); // 1 query for (const user of users) { // N queries - one per user! user.posts = await db.post.findMany({ where: {
Lint PostgreSQL functions against schema, analyze usage, and generate fix reports; use when detecting broken functions, validating schema contracts, or cleaning up unused database functions
Manage local development environment, database resets, health checks, deployment validation, production data sync, and Vercel environment variables; use when setting up dev environment, resetting databases, running pre-deployment checks, syncing production data to staging/local, or fixing Vercel env vars with trailing newlines
# Error Handling Patterns Comprehensive error handling for robust applications. > **Template Usage:** Customize for your framework (React, Vue, Express) and error tracking service (Sentry, Bugsnag, etc.). ## Error Class Hierarchy ```typescript // lib/errors.ts // Base application error export class AppError extends Error { constructor( message: string, public code: string, public statusCode: number = 500, public isOperational: boolean = true ) { super(message); t
Comprehensive Flutter development patterns for Ballee mobile app. Covers architecture, Riverpod 3.x state management, Supabase integration, error handling, performance optimization, and navigation.
# Flutter Development Patterns Architecture and state management patterns for Flutter applications. > **Template Usage:** Customize for your state management (Riverpod, Bloc, Provider) and backend (Supabase, Firebase, REST API). ## Architecture ### 3-Layer Architecture ``` lib/ ├── core/ # Shared utilities │ ├── config/ # App configuration │ ├── constants/ # App constants │ ├── extensions/ # Dart extensions │ ├── guards/
Comprehensive Flutter Supabase query testing: static validation, live testing, RLS verification, and CI integration. Use when validating queries before deployment, debugging query failures, or setting up query testing pipelines.
Flutter testing patterns for Ballee mobile app. Covers unit tests, widget tests, golden tests, integration tests, and mocking with Riverpod.
# Flutter Testing Patterns Comprehensive testing patterns for Flutter applications. > **Template Usage:** Customize for your state management (Riverpod, Bloc, Provider) and testing preferences. ## Test Structure ``` test/ ├── unit/ # Pure Dart logic tests │ ├── models/ │ ├── repositories/ │ └── utils/ ├── widget/ # Widget tests │ ├── screens/ │ └── components/ ├── golden/ # Visual regression tests │ └── screenshots/ ├── integra
Manage Google Tag Manager containers, tags, triggers, and variables. Use when working with GTM configuration, analytics tracking, conversion tracking, or event management. Triggers on "GTM", "Google Tag Manager", "tags", "triggers", "analytics".
Generate and deploy Supabase Auth email templates with hosted logos for reliable display; use when email images aren't displaying, updating email content/styling, or deploying template changes
# Mobile Deployment Skill Comprehensive guide for deploying the Ballee mobile app to iOS (TestFlight/App Store) and Android (Play Store). ## Overview | Platform | CI/CD | Local Deploy | Distribution | |----------|-------|--------------|--------------| | **iOS** | Xcode Cloud | Fastlane / xcodebuild | TestFlight, App Store | | **Android** | GitHub Actions | Fastlane / Gradle | Firebase App Distribution, Play Store | ## Prerequisites ### iOS Prerequisites 1. **Apple Developer Account** with
# Production Readiness Patterns Patterns for deploying and operating applications in production with confidence. > **Template Usage:** Customize health checks, monitoring, and runbooks for your infrastructure (Kubernetes, Vercel, AWS, etc.). ## Health Check Endpoints ### Basic Health Check ```typescript // app/api/health/route.ts import { NextResponse } from 'next/server'; export async function GET() { return NextResponse.json( { status: 'healthy', timestamp: new Date().t
Fetch, analyze, and resolve Sentry errors with CLI integration; use when reviewing production errors, resolving issues, analyzing error patterns, or managing Sentry configuration
# Service Patterns Service layer patterns for clean architecture with proper error handling, logging, and type safety. > **Template Usage:** Customize for your ORM (Prisma, Drizzle, TypeORM, etc.) and logging solution. ## Result Type Pattern Never throw exceptions from services. Always return a Result type. ```typescript // lib/result.ts export type Result<T, E = Error> = | { success: true; data: T } | { success: false; error: E }; export function ok<T>(data: T): Result<T, never> { r
Testing patterns for Ballee using Vitest E2E tests with dual-client architecture, RLS validation, and authentication patterns. Use when writing tests, validating RLS policies, or debugging test failures.
# Test Patterns Testing patterns for reliable, maintainable, and fast tests. > **Template Usage:** Customize for your test framework (Vitest, Jest, Playwright, etc.) and assertion library. ## Test Structure ```typescript // user.test.ts import { describe, it, expect, beforeEach, afterEach } from 'vitest'; import { userService } from '@/services/user.service'; import { createTestUser, cleanupTestData } from '@/tests/helpers'; describe('UserService', () => { let testUserId: string; befor
Shopify theme development workflows and best practices. Use for theme deployment, local development, asset management, and theme customization.
Manage Shopify store translations with French as source language. Use when working with translation files, updating translations, or managing multi-language Shopify content. Triggers on "translate", "translations", "localization", "i18n", "French to German/Italian/English".
Manage user stories: create, list, update status, link migrations/tests, validate; use when working on features, tracking progress, or creating new stories (project)
Run the app locally and take screenshots using Puppeteer to verify UI changes; use when validating demo pages, checking visual regressions, or capturing UI state for analysis
Xcode Cloud CI/CD setup for Flutter iOS apps. Covers ci_post_clone.sh scripts, workflow configuration, TestFlight deployment, environment secrets, App Store distribution, and API management. Use when setting up CI/CD, troubleshooting builds, deploying to TestFlight/App Store, or managing workflows via API.
Send bulk messages to dancers via Ballee Support chat. Use when sending apology messages, system updates, or personalized notifications to users.
Implement internationalization (i18n) in Ballee using react-i18next with Trans component and useTranslation hook; use when adding user-facing text, translating components, implementing toast messages, or organizing translation files
Query Ballee production and staging databases safely using .env.local credentials (with 1Password fallback); use when debugging production/staging data, verifying data exists, investigating bugs, checking RLS behavior, applying hotfix migrations, or triggering Meteor sync
Implement Supabase Realtime subscriptions for live data updates; use when building real-time features like live notifications, collaborative editing, presence detection, or live data feeds
UI patterns for Ballee using MakerKit @kit/ui components, React Server Components, dark mode support, and admin CRUD pages. Use when building UI components, forms, tables, or admin pages.
Common Liquid code patterns for Shopify theme development. Use when writing Liquid templates, handling translations, product displays, or theme customizations.
# Caching Patterns Caching strategies for web applications including in-memory, Redis, and HTTP caching. > **Template Usage:** Customize for your cache provider (Redis, Memcached, Upstash) and framework (Next.js, Express, etc.). ## Cache Types | Type | Use Case | TTL | Example | |------|----------|-----|---------| | **In-Memory** | Single instance, fast access | Short (seconds-minutes) | Rate limiting, session | | **Redis** | Distributed, persistence | Medium (minutes-hours) | User sessions,
# Mobile CI/CD Patterns CI/CD patterns for Flutter/mobile applications with Xcode Cloud, Fastlane, and GitHub Actions. > **Template Usage:** Customize for your platform (iOS, Android, both) and CI provider (Xcode Cloud, GitHub Actions, Codemagic, Bitrise). ## Xcode Cloud Setup ### ci_post_clone.sh Script ```bash #!/bin/bash # ci_scripts/ci_post_clone.sh # Runs after Xcode Cloud clones the repository set -e echo "=== CI Post Clone Script ===" # Navigate to Flutter project cd $CI_PRIMARY_R
# State Management Patterns Client-side state management patterns for modern applications. > **Template Usage:** Customize for your state library (React Query, Zustand, Jotai, Redux, etc.). ## State Categories | Type | Description | Solution | |------|-------------|----------| | **Server State** | Data from API/database | React Query, SWR | | **Client State** | UI state, user preferences | Zustand, Jotai, useState | | **Form State** | Form inputs, validation | React Hook Form, Formik | | **U
Create and manage Supabase database migrations. Use when making schema changes, creating tables, adding columns, or managing database structure. Triggers on "migration", "schema", "database", "table", "Supabase".
CI/CD pipeline guide covering GitHub Actions, Lefthook hooks, Dependabot, and deployment scripts. Use when asking about workflows, automation, or deployment.
Patterns for optimizing database queries and preventing connection pool exhaustion. Use when writing batch operations, debugging slow queries, or reviewing code for performance.
Document and PDF patterns for Ballee using @kit/documents for document management and @kit/pdf-core for PDF generation. Use when working with file uploads, document viewers, or generating PDFs.
Sync and integrate Fever Partners API for plans, reviews, attendees, and venues. Use when implementing Fever data sync, debugging API issues, or building review/analytics features.
Lint Flutter Supabase queries against database schema; use when validating mobile app queries, debugging query failures, or before pushing mobile changes
Sync data from Meteor MongoDB to Supabase; use when running syncs, debugging sync failures, investigating entity mapping issues, or implementing new mappers
Query Ballee production MongoDB (Meteor app) using .env.local credentials; use when debugging Meteor data, verifying MongoDB documents, investigating sync issues, or exploring legacy data for migration
Generate production-ready Row Level Security (RLS) policies for Supabase tables with is_super_admin() bypass, proper USING/WITH CHECK, and common relationship patterns; use when creating RLS policies, securing tables, implementing data access controls, or securing storage buckets
Service layer patterns for Ballee using BaseService, Result types, mappers, storage operations, soft delete handling, and proper error handling. Use when creating services, implementing CRUD operations, handling file uploads, or managing business logic.
Tipalti payment integration guide for payee onboarding, payment processing, webhooks, and tax compliance. Use when implementing payment features.
Manage WIP document lifecycle: create, track, review, and archive work-in-progress documentation; use when starting features, reviewing active WIPs, or archiving completed work (project)
Implement and manage lead scoring systems. Use when working with lead qualification, conversion tracking, or lead funnel optimization. Triggers on "lead", "scoring", "conversion", "funnel", "qualification".
# Data Management Skill Patterns for data migrations, backups, retention, compliance, and versioning. > **Template Usage:** Customize for your database (PostgreSQL, MySQL, etc.), ORM, and compliance requirements. ## Zero-Downtime Data Migrations ### Expand-Contract Pattern Safe schema changes without downtime: ``` Phase 1: EXPAND - Add new structure alongside old Phase 2: MIGRATE - Copy/transform data Phase 3: SWITCH - Update application to use new structure Phase 4: CONTRACT - Remove old
# Internationalization Patterns Internationalization (i18n) and localization patterns for multi-language applications. > **Template Usage:** Customize for your i18n library (react-i18next, next-intl, vue-i18n, etc.). ## File Structure ``` public/ └── locales/ ├── en/ │ ├── common.json # Shared translations │ ├── auth.json # Auth-related │ ├── dashboard.json # Feature-specific │ └── errors.json # Error messages ├── es/ │ ├── common.json
# Logging & Observability Patterns Structured logging, tracing, and metrics patterns for production applications. > **Template Usage:** Customize for your logging library (Pino, Winston, Bunyan) and observability platform (Datadog, New Relic, Grafana). ## Logging Levels | Level | Use Case | Example | |-------|----------|---------| | `fatal` | App cannot continue | Database connection lost | | `error` | Operation failed | Payment processing failed | | `warn` | Unexpected but handled | Rate li