skills/ballee/flutter-query-lint/SKILL.md
Lint Flutter Supabase queries against database schema; use when validating mobile app queries, debugging query failures, or before pushing mobile changes
npx skillsauth add javeedishaq/ai-workflow-orchestrator flutter-query-lintInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Validates Supabase queries in Flutter API files against the database schema (database.types.ts). Reports mismatches in table names, column names, relationships, and RPC function calls.
DO use this skill when:
DO NOT use this skill when:
# From project root
npx ts-node .claude/skills/flutter-query-lint/scripts/lint-queries.ts
The linter produces a markdown report with:
.from('table_name')
// Simple
.select('col1, col2, col3')
// With relationships
.select('*, relation_name(col1, col2)')
// Aliased relationships
.select('alias:table_name!foreign_key(col1, col2)')
// Multiline
.select('''
col1,
col2,
relation(nested_col)
''')
.eq('column', value)
.inFilter('column', ['values'])
.gte('column', value)
.lte('column', value)
.neq('column', value)
.rpc('function_name')
.rpc('function_name', params: {...})
.order('column', ascending: true)
Checks that the table name in .from('table') exists in database.types.ts.
For each column in .select(), .eq(), .order(), etc., validates it exists on the target table.
Note: The linter handles:
* wildcard (skipped)relation(col1, col2)alias:table!fk(col1)For relationship queries like:
.select('productions(id, name)')
Validates that productions is either:
Checks .rpc('function_name') against Functions in database.types.ts.
Error: Column 'name' does not exist on table 'events'
Suggestion: Did you mean 'title'?
Fix: Update the query to use the correct column name.
Error: Table 'event_participations' does not exist
Suggestion: Did you mean 'event_participants'?
Fix: Use the correct table name.
Warning: Relationship 'venue' on 'events' cannot be validated
Note: May be valid if using implicit FK. Check manually.
Error: RPC function 'get_user_events' does not exist
Fix: Either create the function or remove the call.
# Run lint before committing API changes
npx ts-node .claude/skills/flutter-query-lint/scripts/lint-queries.ts
When you modify the database schema:
pnpm supabase:web:typegenThe linter scans:
apps/mobile/lib/modules/*/api/*.dart
apps/mobile/lib/core/data/api/*.dart
Validation uses:
apps/web/supabase/database.types.ts
tools
# 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
tools
# 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
development
# 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
# 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