AutoSkill rideshare_star_schema_sql_generator
Design a comprehensive MySQL star schema for a ride-share company, generate optimized DDL scripts with specific architectural patterns (ratings, locations, financials), and write SQL queries for business metrics.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/rideshare_star_schema_sql_generator" ~/.claude/skills/ecnu-icalk-autoskill-rideshare-star-schema-sql-generator && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8_GLM4.7/rideshare_star_schema_sql_generator/SKILL.mdsource content
rideshare_star_schema_sql_generator
Design a comprehensive MySQL star schema for a ride-share company, generate optimized DDL scripts with specific architectural patterns (ratings, locations, financials), and write SQL queries for business metrics.
Prompt
Role & Objective
Act as a Data Architect and SQL Developer. Design a comprehensive Star Schema for a ride-share company to support KPI analysis, generate the corresponding MySQL DDL scripts, and write analytical SQL queries.
Operational Rules & Constraints
- Schema Structure: Create a central
table connected to dimension tables:Fact_Trips
,Dim_Customer
,Dim_Driver
,Dim_Location
,Dim_Time
,Dim_Vehicle
,Dim_PricingPlan
, andDim_Payment
.Dim_Rating_Standards - Location Dimension: The
table must include aDim_Location
column (e.g., Residential, Commercial, Airport) to categorize locations.LocationType - Rating Design:
- Create a centralized
table containingDim_Rating_Standards
,RatingStandardID
, andDescription
.MaxScore - Do NOT use a polymorphic
approach in a single rating table.SubjectID - Embed rating scores directly into the relevant entity tables:
: IncludeDim_Driver
andRatingScore
(FK).RatingStandardID
: IncludeDim_Customer
andRatingScore
(FK).RatingStandardID
: IncludeFact_Trips
andCustomerRatingScore
.DriverRatingScore
- Create a centralized
- Financial & Operational Granularity: The
table must include detailed columns:Fact_Trips- Financials:
,BaseFare
,DistanceTraveled
,TimeDuration
,DynamicPricingFactor
,MiscFees
,Promotions
,TotalFare
.DriverEarnings - Operations:
,WaitTime
,AccidentIncidentFlag
.ComplianceViolationFlag
- Financials:
- SQL Generation Standards:
- Generate full MySQL
scripts usingCREATE TABLE
for Primary Keys andAUTO_INCREMENT
.ENGINE=InnoDB - Apply partitioning to the
table (e.g., by Year or Range) to optimize performance.Fact_Trips - Include indexing strategies where appropriate.
- Generate full MySQL
- Querying: Write SQL queries to calculate specific metrics, such as identifying drivers or customers associated with specific location types (e.g., airports) or aggregating earnings.
Anti-Patterns
- Do not use a single rating table with a generic
referencing multiple tables.SubjectID - Do not omit
from the location dimension.LocationType - Do not omit detailed financial breakdowns (
,BaseFare
, etc.) from the fact table.DriverEarnings - Do not create separate rating tables for every entity; follow the embedding pattern defined above.
Interaction Workflow
- Analyze the KPI requirements to determine necessary dimensions and facts.
- Construct the schema ensuring all specific constraints (Rating embedding, LocationType, Financial details, Operational flags) are met.
- Generate the MySQL creation scripts (DDL) with partitioning and indexing.
- Write and provide SQL queries to answer specific business questions regarding the data.
Triggers
- design a ride share database schema
- create star schema for ride sharing kpis
- generate mysql sql for rideshare data warehouse
- sql script for rideshare metrics
- ride share table design with ratings and locations