chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
---
|
||||
allowed-tools: Bash, Read
|
||||
description: Create, alter, and validate Snowflake semantic views using Snowflake CLI (snow). Use when asked to build or troubleshoot semantic views/semantic layer definitions with CREATE/ALTER SEMANTIC VIEW, to validate semantic-view DDL against Snowflake via CLI, or to guide Snowflake CLI installation and connection setup.
|
||||
---
|
||||
|
||||
# Snowflake Semantic Views
|
||||
|
||||
## One-Time Setup
|
||||
|
||||
- Verify Snowflake CLI installation by opening a new terminal and running `snow --help`.
|
||||
- If Snowflake CLI is missing or the user cannot install it, direct them to https://docs.snowflake.com/en/developer-guide/snowflake-cli/installation/installation.
|
||||
- Configure a Snowflake connection with `snow connection add` per https://docs.snowflake.com/en/developer-guide/snowflake-cli/connecting/configure-connections#add-a-connection.
|
||||
- Use the configured connection for all validation and execution steps.
|
||||
|
||||
## Workflow For Each Semantic View Request
|
||||
|
||||
1. Confirm the target database, schema, role, warehouse, and final semantic view name.
|
||||
2. Confirm the model follows a star schema (facts with conformed dimensions).
|
||||
3. Draft the semantic view DDL using the official syntax:
|
||||
- https://docs.snowflake.com/en/sql-reference/sql/create-semantic-view
|
||||
4. Populate synonyms and comments for each dimension, fact, and metric:
|
||||
- Read Snowflake table/view/column comments first (preferred source):
|
||||
- https://docs.snowflake.com/en/sql-reference/sql/comment
|
||||
- If comments or synonyms are missing, ask whether you can create them, whether the user wants to provide text, or whether you should draft suggestions for approval.
|
||||
5. Create a temporary validation name (for example, append `__tmp_validate`) while keeping the same database and schema.
|
||||
6. Always validate by sending the DDL to Snowflake via Snowflake CLI before finalizing:
|
||||
- Use `snow sql` to execute the statement with the configured connection.
|
||||
- If flags differ by version, check `snow sql --help` and use the connection option shown there.
|
||||
7. If validation fails, iterate on the DDL and re-run the validation step until it succeeds.
|
||||
8. Apply the final DDL (create or alter) using the real semantic view name.
|
||||
9. Clean up any temporary semantic view created during validation.
|
||||
|
||||
## Synonyms And Comments (Required)
|
||||
|
||||
- Use the semantic view syntax for synonyms and comments:
|
||||
|
||||
```
|
||||
WITH SYNONYMS [ = ] ( 'synonym' [ , ... ] )
|
||||
COMMENT = 'comment_about_dim_fact_or_metric'
|
||||
```
|
||||
|
||||
- Treat synonyms as informational only; do not use them to reference dimensions, facts, or metrics elsewhere.
|
||||
- Use Snowflake comments as the preferred and first source for synonyms and comments:
|
||||
- https://docs.snowflake.com/en/sql-reference/sql/comment
|
||||
- If Snowflake comments are missing, ask whether you can create them, whether the user wants to provide text, or whether you should draft suggestions for approval.
|
||||
- Do not invent synonyms or comments without user approval.
|
||||
|
||||
## Validation Pattern (Required)
|
||||
|
||||
- Never skip validation. Always execute the DDL against Snowflake with Snowflake CLI before presenting it as final.
|
||||
- Prefer a temporary name for validation to avoid clobbering the real view.
|
||||
|
||||
## Example CLI Validation (Template)
|
||||
|
||||
```bash
|
||||
# Replace placeholders with real values.
|
||||
snow sql -q "<CREATE OR ALTER SEMANTIC VIEW ...>" --connection <connection_name>
|
||||
```
|
||||
|
||||
If the CLI uses a different connection flag in your version, run:
|
||||
|
||||
```bash
|
||||
snow sql --help
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
- Treat installation and connection setup as one-time steps, but confirm they are done before the first validation.
|
||||
- Keep the final semantic view definition identical to the validated temporary definition except for the name.
|
||||
- Do not omit synonyms or comments; consider them required for completeness even if optional in syntax.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [operation] | --backup | --restore | --schedule | --validate | --cleanup
|
||||
description: Manage Supabase database backups with automated scheduling and recovery procedures
|
||||
---
|
||||
|
||||
# Supabase Backup Manager
|
||||
|
||||
Manage comprehensive Supabase database backups with automated scheduling and recovery validation: **$ARGUMENTS**
|
||||
|
||||
## Current Backup Context
|
||||
|
||||
- Supabase project: MCP integration for backup operations and status monitoring
|
||||
- Backup storage: Current backup configuration and storage capacity
|
||||
- Recovery testing: Last backup validation and recovery procedure verification
|
||||
- Automation status: !`find . -name "*.yml" -o -name "*.json" | xargs grep -l "backup\|cron" 2>/dev/null | head -3` scheduled backup configuration
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive backup management with automated procedures and recovery validation:
|
||||
|
||||
**Backup Operation**: Use $ARGUMENTS to specify backup creation, data restoration, schedule management, backup validation, or cleanup procedures
|
||||
|
||||
**Backup Management Framework**:
|
||||
1. **Backup Strategy** - Design backup schedules, implement retention policies, configure incremental backups, optimize storage usage
|
||||
2. **Automated Backup** - Create database snapshots, export schema and data, validate backup integrity, monitor backup completion
|
||||
3. **Recovery Procedures** - Test restore processes, validate data integrity, implement point-in-time recovery, optimize recovery time
|
||||
4. **Schedule Management** - Configure automated backup schedules, implement backup monitoring, setup failure notifications, optimize backup windows
|
||||
5. **Storage Optimization** - Manage backup storage, implement compression strategies, archive old backups, monitor storage costs
|
||||
6. **Disaster Recovery** - Plan disaster recovery procedures, test recovery scenarios, document recovery processes, validate business continuity
|
||||
|
||||
**Advanced Features**: Automated backup validation, recovery time optimization, cross-region backup replication, backup encryption, compliance reporting.
|
||||
|
||||
**Monitoring Integration**: Backup success monitoring, failure alerting, storage usage tracking, recovery time measurement, compliance reporting.
|
||||
|
||||
**Output**: Complete backup management system with automated schedules, recovery procedures, validation reports, and disaster recovery planning.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [table-name] | --query [sql] | --export | --inspect
|
||||
description: Explore and analyze Supabase database data with intelligent querying and visualization
|
||||
---
|
||||
|
||||
# Supabase Data Explorer
|
||||
|
||||
Explore and analyze Supabase database with intelligent querying and data insights: **$ARGUMENTS**
|
||||
|
||||
## Current Data Context
|
||||
|
||||
- Supabase MCP: Connected with read-only access for safe data exploration
|
||||
- Target table: Analysis of $ARGUMENTS for data exploration scope
|
||||
- Local queries: !`find . -name "*.sql" | head -5` existing SQL files for reference
|
||||
- Data models: !`find . -name "types" -o -name "models" -type d | head -3` application data structures
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive database exploration with intelligent analysis and insights:
|
||||
|
||||
**Exploration Focus**: Use $ARGUMENTS to specify table inspection, SQL query execution, data export, or comprehensive database inspection
|
||||
|
||||
**Data Exploration Framework**:
|
||||
1. **Database Discovery** - Explore table structures, analyze relationships, identify data patterns, assess data quality metrics
|
||||
2. **Intelligent Querying** - Execute read-only queries via MCP, optimize query performance, provide result analysis, suggest query improvements
|
||||
3. **Data Analysis** - Generate data insights, identify trends and anomalies, calculate statistical summaries, analyze data distribution
|
||||
4. **Schema Inspection** - Examine table schemas, analyze foreign key relationships, assess index effectiveness, review constraint validations
|
||||
5. **Export & Visualization** - Export data in multiple formats, create data visualizations, generate summary reports, optimize data presentation
|
||||
6. **Performance Analysis** - Analyze query execution plans, identify performance bottlenecks, suggest optimization strategies, monitor resource usage
|
||||
|
||||
**Advanced Features**: Interactive data exploration, automated insight generation, data quality assessment, relationship mapping, trend analysis.
|
||||
|
||||
**Safety Features**: Read-only operations, query validation, result limiting, performance monitoring, error handling.
|
||||
|
||||
**Output**: Comprehensive data exploration with insights, optimized queries, export files, and performance recommendations.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [migration-type] | --create | --alter | --seed | --rollback
|
||||
description: Generate and manage Supabase database migrations with automated testing and validation
|
||||
---
|
||||
|
||||
# Supabase Migration Assistant
|
||||
|
||||
Generate and manage Supabase migrations with comprehensive testing and validation: **$ARGUMENTS**
|
||||
|
||||
## Current Migration Context
|
||||
|
||||
- Supabase project: MCP integration for migration management and validation
|
||||
- Migration files: !`find . -name "*migrations*" -type d -o -name "*.sql" | head -5` existing migration structure
|
||||
- Schema version: Current database schema state and migration history
|
||||
- Local changes: !`git diff --name-only | grep -E "\\.sql$|\\.ts$" | head -3` pending database modifications
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive migration management with automated validation and testing:
|
||||
|
||||
**Migration Type**: Use $ARGUMENTS to specify table creation, schema alterations, data seeding, or migration rollback
|
||||
|
||||
**Migration Management Framework**:
|
||||
1. **Migration Planning** - Analyze schema requirements, design migration strategy, identify dependencies, plan rollback procedures
|
||||
2. **Code Generation** - Generate migration SQL files, create TypeScript types, implement safety checks, optimize execution order
|
||||
3. **Validation Testing** - Test migration on development data, validate schema changes, verify data integrity, check constraint violations
|
||||
4. **Supabase Integration** - Apply migrations via MCP server, monitor execution status, handle error conditions, validate final state
|
||||
5. **Type Generation** - Generate TypeScript types, update application interfaces, sync with client-side schemas, maintain type safety
|
||||
6. **Rollback Strategy** - Create rollback migrations, test rollback procedures, implement data preservation, validate recovery process
|
||||
|
||||
**Advanced Features**: Automated type generation, migration testing, performance impact analysis, team collaboration, CI/CD integration.
|
||||
|
||||
**Safety Measures**: Pre-migration backups, dry-run validation, rollback testing, data integrity checks, performance monitoring.
|
||||
|
||||
**Output**: Complete migration suite with SQL files, TypeScript types, test validation, rollback procedures, and deployment documentation.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [optimization-type] | --queries | --indexes | --storage | --rls | --functions
|
||||
description: Optimize Supabase database performance with intelligent analysis and recommendations
|
||||
---
|
||||
|
||||
# Supabase Performance Optimizer
|
||||
|
||||
Optimize Supabase database performance with intelligent analysis and automated improvements: **$ARGUMENTS**
|
||||
|
||||
## Current Performance Context
|
||||
|
||||
- Supabase metrics: Database performance data via MCP integration
|
||||
- Query patterns: !`find . -name "*.sql" -o -name "*.ts" -o -name "*.js" | xargs grep -l "from\|select\|insert\|update" 2>/dev/null | head -5` application queries
|
||||
- Schema analysis: Current table structures and relationship complexity
|
||||
- Performance logs: Recent query execution times and resource usage patterns
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive performance optimization with intelligent analysis and automated improvements:
|
||||
|
||||
**Optimization Focus**: Use $ARGUMENTS to focus on query optimization, index management, storage optimization, RLS policies, or database functions
|
||||
|
||||
**Performance Optimization Framework**:
|
||||
1. **Performance Analysis** - Analyze query execution times, identify slow operations, assess resource utilization, evaluate bottlenecks
|
||||
2. **Index Optimization** - Analyze index usage, recommend new indexes, identify redundant indexes, optimize index strategies
|
||||
3. **Query Optimization** - Review application queries, suggest query improvements, implement query caching, optimize join operations
|
||||
4. **Storage Optimization** - Analyze storage patterns, recommend archival strategies, optimize data types, implement compression
|
||||
5. **RLS Policy Review** - Analyze Row Level Security policies, optimize policy performance, reduce policy complexity, improve security efficiency
|
||||
6. **Function Optimization** - Review database functions, optimize function performance, implement caching strategies, improve execution plans
|
||||
|
||||
**Advanced Features**: Automated index recommendations, query plan analysis, performance trend monitoring, cost optimization, scaling recommendations.
|
||||
|
||||
**Monitoring Integration**: Real-time performance tracking, alert configuration, performance regression detection, optimization impact measurement.
|
||||
|
||||
**Output**: Comprehensive optimization plan with performance improvements, index recommendations, query optimizations, and monitoring setup.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [monitoring-type] | --connections | --subscriptions | --performance | --debug | --analytics
|
||||
description: Monitor and optimize Supabase realtime connections with performance analysis and debugging
|
||||
---
|
||||
|
||||
# Supabase Realtime Monitor
|
||||
|
||||
Monitor and optimize Supabase realtime connections with comprehensive performance analysis: **$ARGUMENTS**
|
||||
|
||||
## Current Realtime Context
|
||||
|
||||
- Supabase realtime: Connection status and subscription management via MCP
|
||||
- Application subscriptions: !`find . -name "*.ts" -o -name "*.js" | xargs grep -l "subscribe\|realtime\|channel" 2>/dev/null | head -5` active subscription code
|
||||
- Performance metrics: Current connection performance and message throughput
|
||||
- Error patterns: Recent realtime connection issues and debugging information
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive realtime monitoring with performance optimization and debugging support:
|
||||
|
||||
**Monitoring Type**: Use $ARGUMENTS to focus on connection monitoring, subscription analysis, performance optimization, debugging assistance, or analytics reporting
|
||||
|
||||
**Realtime Monitoring Framework**:
|
||||
1. **Connection Analysis** - Monitor active connections, analyze connection stability, track connection lifecycle, identify connection issues
|
||||
2. **Subscription Management** - Track active subscriptions, analyze subscription performance, optimize subscription patterns, manage subscription lifecycle
|
||||
3. **Performance Optimization** - Analyze message throughput, optimize payload sizes, reduce connection overhead, improve subscription efficiency
|
||||
4. **Error Monitoring** - Track connection errors, analyze failure patterns, implement retry strategies, provide debugging insights
|
||||
5. **Analytics Dashboard** - Generate usage analytics, track performance trends, monitor resource utilization, provide optimization recommendations
|
||||
6. **Developer Tools** - Provide debugging utilities, implement connection testing, create performance profiling, optimize development workflow
|
||||
|
||||
**Advanced Features**: Real-time performance monitoring, predictive analytics, automated optimization suggestions, comprehensive logging, alert management.
|
||||
|
||||
**Integration Support**: Application performance monitoring, CI/CD integration, team collaboration tools, documentation generation, troubleshooting guides.
|
||||
|
||||
**Output**: Comprehensive realtime monitoring with performance analytics, optimization recommendations, debugging tools, and developer documentation.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [action] | --pull | --push | --diff | --validate
|
||||
description: Synchronize database schema with Supabase using MCP integration
|
||||
---
|
||||
|
||||
# Supabase Schema Sync
|
||||
|
||||
Synchronize database schema between local and Supabase with comprehensive validation: **$ARGUMENTS**
|
||||
|
||||
## Current Supabase Context
|
||||
|
||||
- MCP connection: Supabase MCP server with read-only access configured
|
||||
- Local schema: !`find . -name "schema.sql" -o -name "migrations" -type d | head -3` local database files
|
||||
- Project config: !`find . -name "supabase" -type d -o -name ".env*" | grep -v node_modules | head -3` configuration files
|
||||
- Git status: !`git status --porcelain | grep -E "\\.sql$|\\.ts$" | head -5` database-related changes
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive schema synchronization with Supabase integration:
|
||||
|
||||
**Sync Action**: Use $ARGUMENTS to specify pull from remote, push to remote, diff comparison, or schema validation
|
||||
|
||||
**Schema Synchronization Framework**:
|
||||
1. **MCP Integration** - Connect to Supabase via MCP server, authenticate with project credentials, validate connection status
|
||||
2. **Schema Analysis** - Compare local vs remote schema, identify structural differences, analyze migration requirements, assess breaking changes
|
||||
3. **Sync Operations** - Execute pull/push operations, apply schema migrations, handle conflict resolution, validate data integrity
|
||||
4. **Validation Process** - Verify schema consistency, validate foreign key constraints, check index performance, test query compatibility
|
||||
5. **Migration Management** - Generate migration scripts, track version history, implement rollback procedures, optimize execution order
|
||||
6. **Safety Checks** - Backup critical data, validate permissions, check production impact, implement dry-run mode
|
||||
|
||||
**Advanced Features**: Automated conflict resolution, schema version control, performance impact analysis, team collaboration workflows, CI/CD integration.
|
||||
|
||||
**Quality Assurance**: Schema validation, data integrity checks, performance optimization, rollback readiness, team synchronization.
|
||||
|
||||
**Output**: Complete schema sync with validation reports, migration scripts, conflict resolution, and team collaboration updates.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [audit-scope] | --rls | --permissions | --auth | --api-keys | --comprehensive
|
||||
description: Conduct comprehensive Supabase security audit with RLS analysis and vulnerability assessment
|
||||
---
|
||||
|
||||
# Supabase Security Audit
|
||||
|
||||
Conduct comprehensive Supabase security audit with RLS policy analysis and vulnerability assessment: **$ARGUMENTS**
|
||||
|
||||
## Current Security Context
|
||||
|
||||
- Supabase access: MCP integration for security analysis and policy review
|
||||
- RLS policies: Current Row Level Security implementation and policy effectiveness
|
||||
- Auth configuration: !`find . -name "*auth*" -o -name "*supabase*" | grep -E "\\.(js|ts|json)$" | head -5` authentication setup
|
||||
- API security: Current API key management and access control implementation
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive security audit with vulnerability assessment and policy optimization:
|
||||
|
||||
**Audit Scope**: Use $ARGUMENTS to focus on RLS policies, permission analysis, authentication security, API key management, or comprehensive security review
|
||||
|
||||
**Security Audit Framework**:
|
||||
1. **RLS Policy Analysis** - Review Row Level Security policies, test policy effectiveness, identify policy gaps, optimize policy performance
|
||||
2. **Permission Assessment** - Analyze table permissions, review role-based access, validate permission hierarchies, identify over-privileged access
|
||||
3. **Authentication Security** - Review auth configuration, analyze JWT security, validate session management, assess multi-factor authentication
|
||||
4. **API Key Management** - Audit API key usage, review key rotation policies, validate key scoping, assess exposure risks
|
||||
5. **Data Protection** - Analyze sensitive data handling, review encryption implementation, validate data masking, assess backup security
|
||||
6. **Vulnerability Scanning** - Identify security vulnerabilities, assess injection risks, review CORS configuration, validate rate limiting
|
||||
|
||||
**Advanced Features**: Automated security testing, policy simulation, vulnerability scoring, compliance checking, security monitoring setup.
|
||||
|
||||
**Compliance Integration**: GDPR compliance checking, SOC2 requirements validation, security best practices enforcement, audit trail analysis.
|
||||
|
||||
**Output**: Comprehensive security audit report with vulnerability assessments, policy recommendations, security improvements, and compliance validation.
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
allowed-tools: Read, Write, Edit, Bash
|
||||
argument-hint: [generation-scope] | --all-tables | --specific-table | --functions | --enums | --views
|
||||
description: Generate TypeScript types from Supabase schema with automatic synchronization and validation
|
||||
---
|
||||
|
||||
# Supabase Type Generator
|
||||
|
||||
Generate comprehensive TypeScript types from Supabase schema with automatic synchronization: **$ARGUMENTS**
|
||||
|
||||
## Current Type Context
|
||||
|
||||
- Supabase schema: Database schema accessible via MCP integration
|
||||
- Type definitions: !`find . -name "types" -type d -o -name "*.d.ts" | head -5` existing TypeScript definitions
|
||||
- Application usage: !`find . -name "*.ts" -o -name "*.tsx" | xargs grep -l "Database\|Table\|Row" 2>/dev/null | head -3` type usage patterns
|
||||
- Build configuration: !`find . -name "tsconfig.json" -o -name "*.config.ts" | head -3` TypeScript setup
|
||||
|
||||
## Task
|
||||
|
||||
Execute comprehensive type generation with schema synchronization and application integration:
|
||||
|
||||
**Generation Scope**: Use $ARGUMENTS to generate all table types, specific table types, function signatures, enum definitions, or view types
|
||||
|
||||
**Type Generation Framework**:
|
||||
1. **Schema Analysis** - Extract database schema via MCP, analyze table structures, identify relationships, map data types to TypeScript
|
||||
2. **Type Generation** - Generate table interfaces, create utility types, implement type guards, optimize type definitions
|
||||
3. **Integration Setup** - Configure import paths, setup type exports, implement auto-completion, integrate with build process
|
||||
4. **Validation Process** - Validate generated types, test type compatibility, verify application integration, check build success
|
||||
5. **Synchronization** - Monitor schema changes, auto-regenerate types, validate breaking changes, notify development team
|
||||
6. **Developer Experience** - Implement IDE integration, provide type hints, create usage examples, optimize development workflow
|
||||
|
||||
**Advanced Features**: Automatic type updates, breaking change detection, custom type transformations, documentation generation, IDE plugin integration.
|
||||
|
||||
**Quality Assurance**: Type accuracy validation, application compatibility testing, performance impact assessment, developer feedback integration.
|
||||
|
||||
**Output**: Complete TypeScript type definitions with schema synchronization, application integration, validation procedures, and developer documentation.
|
||||
Reference in New Issue
Block a user