altimate-code 0.4.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +13 -13
  3. package/postinstall.mjs +35 -0
  4. package/skills/cost-report/SKILL.md +134 -0
  5. package/skills/data-viz/SKILL.md +135 -0
  6. package/skills/data-viz/references/component-guide.md +394 -0
  7. package/skills/dbt-analyze/SKILL.md +130 -0
  8. package/skills/dbt-analyze/references/altimate-dbt-commands.md +66 -0
  9. package/skills/dbt-analyze/references/lineage-interpretation.md +58 -0
  10. package/skills/dbt-develop/SKILL.md +151 -0
  11. package/skills/dbt-develop/references/altimate-dbt-commands.md +66 -0
  12. package/skills/dbt-develop/references/common-mistakes.md +49 -0
  13. package/skills/dbt-develop/references/incremental-strategies.md +118 -0
  14. package/skills/dbt-develop/references/layer-patterns.md +158 -0
  15. package/skills/dbt-develop/references/medallion-architecture.md +125 -0
  16. package/skills/dbt-develop/references/yaml-generation.md +90 -0
  17. package/skills/dbt-docs/SKILL.md +99 -0
  18. package/skills/dbt-docs/references/altimate-dbt-commands.md +66 -0
  19. package/skills/dbt-docs/references/documentation-standards.md +94 -0
  20. package/skills/dbt-test/SKILL.md +121 -0
  21. package/skills/dbt-test/references/altimate-dbt-commands.md +66 -0
  22. package/skills/dbt-test/references/custom-tests.md +59 -0
  23. package/skills/dbt-test/references/schema-test-patterns.md +103 -0
  24. package/skills/dbt-test/references/unit-test-guide.md +121 -0
  25. package/skills/dbt-troubleshoot/SKILL.md +187 -0
  26. package/skills/dbt-troubleshoot/references/altimate-dbt-commands.md +66 -0
  27. package/skills/dbt-troubleshoot/references/compilation-errors.md +57 -0
  28. package/skills/dbt-troubleshoot/references/runtime-errors.md +71 -0
  29. package/skills/dbt-troubleshoot/references/test-failures.md +95 -0
  30. package/skills/lineage-diff/SKILL.md +64 -0
  31. package/skills/pii-audit/SKILL.md +117 -0
  32. package/skills/query-optimize/SKILL.md +86 -0
  33. package/skills/schema-migration/SKILL.md +119 -0
  34. package/skills/sql-review/SKILL.md +118 -0
  35. package/skills/sql-translate/SKILL.md +68 -0
  36. package/skills/teach/SKILL.md +54 -0
  37. package/skills/train/SKILL.md +51 -0
  38. package/skills/training-status/SKILL.md +45 -0
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: pii-audit
3
+ description: Classify schema columns for PII (SSN, email, phone, name, address, credit card) and check whether queries expose them. Use for GDPR/CCPA/HIPAA compliance audits.
4
+ ---
5
+
6
+ # PII Audit
7
+
8
+ ## Requirements
9
+ **Agent:** any (read-only analysis)
10
+ **Tools used:** altimate_core_classify_pii, altimate_core_query_pii, schema_detect_pii, schema_inspect, read, glob
11
+
12
+ ## When to Use This Skill
13
+
14
+ **Use when the user wants to:**
15
+ - Scan a database schema for PII columns (SSN, email, phone, name, address, credit card, IP)
16
+ - Check if a specific query exposes PII data
17
+ - Audit dbt models for PII leakage before production deployment
18
+ - Generate a PII inventory for compliance (GDPR, CCPA, HIPAA)
19
+
20
+ **Do NOT use for:**
21
+ - SQL injection scanning -> use `sql-review`
22
+ - General SQL quality checks -> use `sql-review`
23
+ - Access control auditing -> finops role tools in `cost-report`
24
+
25
+ ## Workflow
26
+
27
+ ### 1. Classify Schema for PII
28
+
29
+ **Option A — From schema YAML/JSON:**
30
+
31
+ ```
32
+ altimate_core_classify_pii(schema_context: <schema_object>)
33
+ ```
34
+
35
+ Analyzes column names, types, and patterns to detect PII categories:
36
+ - **Direct identifiers**: SSN, email, phone, full name, credit card number
37
+ - **Quasi-identifiers**: Date of birth, zip code, IP address, device ID
38
+ - **Sensitive data**: Salary, health records, religious affiliation
39
+
40
+ **Option B — From warehouse connection:**
41
+
42
+ First index the schema, inspect it, then classify:
43
+ ```
44
+ schema_index(warehouse: <name>)
45
+ schema_inspect(warehouse: <name>, database: <db>, schema: <schema>, table: <table>)
46
+ schema_detect_pii(warehouse: <name>)
47
+ ```
48
+
49
+ `schema_detect_pii` scans all indexed columns using pattern matching against the schema cache (requires `schema_index` to have been run).
50
+
51
+ ### 2. Check Query PII Exposure
52
+
53
+ For each query or dbt model, check which PII columns it accesses:
54
+
55
+ ```
56
+ altimate_core_query_pii(sql: <sql>, schema_context: <schema_object>)
57
+ ```
58
+
59
+ Returns:
60
+ - Which PII-classified columns are selected, filtered, or joined on
61
+ - Risk level per column (HIGH for direct identifiers, MEDIUM for quasi-identifiers)
62
+ - Whether PII is exposed in the output (SELECT) vs only used internally (WHERE/JOIN)
63
+
64
+ ### 3. Audit dbt Models (Batch)
65
+
66
+ For a full project audit:
67
+ ```bash
68
+ glob models/**/*.sql
69
+ ```
70
+
71
+ For each model:
72
+ 1. Read the compiled SQL
73
+ 2. Run `altimate_core_query_pii` against the project schema
74
+ 3. Classify the model's PII risk level
75
+
76
+ ### 4. Present the Audit Report
77
+
78
+ ```
79
+ PII Audit Report
80
+ ================
81
+
82
+ Schema: analytics.public (42 tables, 380 columns)
83
+
84
+ PII Columns Found: 18
85
+
86
+ HIGH RISK (direct identifiers):
87
+ customers.email -> EMAIL
88
+ customers.phone_number -> PHONE
89
+ customers.ssn -> SSN
90
+ payments.card_number -> CREDIT_CARD
91
+
92
+ MEDIUM RISK (quasi-identifiers):
93
+ customers.date_of_birth -> DOB
94
+ customers.zip_code -> ZIP
95
+ events.ip_address -> IP_ADDRESS
96
+
97
+ Model PII Exposure:
98
+
99
+ | Model | PII Columns Exposed | Risk | Action |
100
+ |-------|-------------------|------|--------|
101
+ | stg_customers | email, phone, ssn | HIGH | Mask or hash before mart layer |
102
+ | mart_user_profile | email | HIGH | Requires access control |
103
+ | int_order_summary | (none) | SAFE | No PII in output |
104
+ | mart_daily_revenue | zip_code | MEDIUM | Aggregation reduces risk |
105
+
106
+ Recommendations:
107
+ 1. Hash SSN and credit_card in staging layer (never expose raw)
108
+ 2. Add column-level masking policy for email and phone
109
+ 3. Restrict mart_user_profile to authorized roles only
110
+ 4. Document PII handling in schema.yml column descriptions
111
+ ```
112
+
113
+ ## Usage
114
+
115
+ - `/pii-audit` -- Scan the full project schema for PII
116
+ - `/pii-audit models/marts/mart_customers.sql` -- Check a specific model for PII exposure
117
+ - `/pii-audit --schema analytics.public` -- Audit a specific database schema
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: query-optimize
3
+ description: Analyze and optimize SQL queries for better performance
4
+ ---
5
+
6
+ # Query Optimize
7
+
8
+ ## Requirements
9
+ **Agent:** any (read-only analysis)
10
+ **Tools used:** sql_optimize, sql_analyze, sql_explain, altimate_core_equivalence, read, glob, schema_inspect, warehouse_list
11
+
12
+ Analyze SQL queries for performance issues and suggest concrete optimizations including rewritten SQL.
13
+
14
+ ## Workflow
15
+
16
+ 1. **Get the SQL query** -- Either:
17
+ - Read SQL from a file path provided by the user
18
+ - Accept SQL directly from the conversation
19
+ - Read from clipboard or stdin if mentioned
20
+
21
+ 2. **Determine the dialect** -- Default to `snowflake`. If the user specifies a dialect (postgres, bigquery, duckdb, etc.), use that instead. Check the project for warehouse connections using `warehouse_list` if unsure.
22
+
23
+ 3. **Run the optimizer**:
24
+ - Call `sql_optimize` with the SQL, dialect, and schema context if available
25
+ - If the user has a warehouse connection, first call `schema_inspect` on the relevant tables to build schema context for better optimization (e.g., SELECT * expansion)
26
+
27
+ 4. **Run detailed analysis**:
28
+ - Call `sql_analyze` with the same SQL and dialect to get the full anti-pattern breakdown with recommendations
29
+
30
+ 5. **Get execution plan** (if warehouse connected):
31
+ - Call `sql_explain` to run EXPLAIN on the query and get the execution plan
32
+ - Look for: full table scans, sort operations on large datasets, inefficient join strategies, missing partition pruning
33
+ - Include key findings in the report under "Execution Plan Insights"
34
+
35
+ 6. **Verify rewrites preserve correctness**:
36
+ - If `sql_optimize` produced a rewritten query, call `altimate_core_equivalence` to verify the original and optimized queries produce the same result set
37
+ - If not equivalent, flag the difference and present both versions for the user to decide
38
+ - This prevents "optimization" that silently changes query semantics
39
+
40
+ 7. **Present findings** in a structured format:
41
+
42
+ ```
43
+ Query Optimization Report
44
+ =========================
45
+
46
+ Summary: X suggestions found, Y anti-patterns detected
47
+
48
+ High Impact:
49
+ 1. [REWRITE] Replace SELECT * with explicit columns
50
+ Before: SELECT *
51
+ After: SELECT id, name, email
52
+
53
+ 2. [REWRITE] Use UNION ALL instead of UNION
54
+ Before: ... UNION ...
55
+ After: ... UNION ALL ...
56
+
57
+ Medium Impact:
58
+ 3. [PERFORMANCE] Add LIMIT to ORDER BY
59
+ ...
60
+
61
+ Optimized SQL:
62
+ --------------
63
+ SELECT id, name, email
64
+ FROM users
65
+ WHERE status = 'active'
66
+ ORDER BY name
67
+ LIMIT 100
68
+
69
+ Anti-Pattern Details:
70
+ ---------------------
71
+ [WARNING] SELECT_STAR: Query uses SELECT * ...
72
+ -> Consider selecting only the columns you need.
73
+ ```
74
+
75
+ 8. **If schema context is available**, mention that the optimization used real table schemas for more accurate suggestions (e.g., expanding SELECT * to actual columns).
76
+
77
+ 9. **If no issues are found**, confirm the query looks well-optimized and briefly explain why (no anti-patterns, proper use of limits, explicit columns, etc.).
78
+
79
+ ## Usage
80
+
81
+ The user invokes this skill with SQL or a file path:
82
+ - `/query-optimize SELECT * FROM users ORDER BY name` -- Optimize inline SQL
83
+ - `/query-optimize models/staging/stg_orders.sql` -- Optimize SQL from a file
84
+ - `/query-optimize` -- Optimize the most recently discussed SQL in the conversation
85
+
86
+ Use the tools: `sql_optimize`, `sql_analyze`, `sql_explain` (execution plans), `altimate_core_equivalence` (rewrite verification), `read` (for file-based SQL), `glob` (to find SQL files), `schema_inspect` (for schema context), `warehouse_list` (to check connections).
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: schema-migration
3
+ description: Analyze DDL migrations for data loss risks — type narrowing, missing defaults, dropped constraints, breaking column changes. Use before applying schema changes to production.
4
+ ---
5
+
6
+ # Schema Migration Analysis
7
+
8
+ ## Requirements
9
+ **Agent:** any (read-only analysis)
10
+ **Tools used:** altimate_core_migration, altimate_core_schema_diff, schema_diff, read, glob, bash (for git operations)
11
+
12
+ ## When to Use This Skill
13
+
14
+ **Use when the user wants to:**
15
+ - Analyze a DDL migration for data loss risks before applying it
16
+ - Compare two schema versions to find breaking changes
17
+ - Review ALTER TABLE / CREATE TABLE changes in a PR
18
+ - Validate that a model refactoring doesn't break the column contract
19
+
20
+ **Do NOT use for:**
21
+ - Writing new models -> use `dbt-develop`
22
+ - Analyzing downstream impact of SQL logic changes -> use `dbt-analyze`
23
+ - Optimizing queries -> use `query-optimize`
24
+
25
+ ## Workflow
26
+
27
+ ### 1. Get the Schema Versions
28
+
29
+ **For DDL migrations** (ALTER TABLE, CREATE TABLE):
30
+ - Read the migration file(s) from disk
31
+ - The "old" schema is the current state; the "new" schema is after applying the migration
32
+
33
+ **For dbt model changes** (comparing before/after SQL):
34
+ ```bash
35
+ # Get the old version from git
36
+ git show HEAD:<path/to/model.sql> > /tmp/old_model.sql
37
+ # The new version is the current file
38
+ ```
39
+
40
+ **For schema YAML changes:**
41
+ - Read both versions of the schema.yml file
42
+
43
+ ### 2. Analyze DDL Migration Safety
44
+
45
+ Call `altimate_core_migration` to detect data loss risks:
46
+
47
+ ```
48
+ altimate_core_migration(old_ddl: <old_ddl>, new_ddl: <new_ddl>, dialect: <dialect>)
49
+ ```
50
+
51
+ This checks for:
52
+ - **Type narrowing**: VARCHAR(100) -> VARCHAR(50) (truncation risk)
53
+ - **NOT NULL without default**: Adding NOT NULL column without DEFAULT (fails on existing rows)
54
+ - **Dropped columns**: Data loss if column has values
55
+ - **Dropped constraints**: Unique/check constraints removed (data integrity risk)
56
+ - **Type changes**: INTEGER -> VARCHAR (irreversible in practice)
57
+ - **Index drops**: Performance regression risk
58
+
59
+ ### 3. Diff Schema Structures
60
+
61
+ **For YAML/JSON schemas:** Call `altimate_core_schema_diff` to compare two schema definitions:
62
+
63
+ ```
64
+ altimate_core_schema_diff(schema1: <old_schema>, schema2: <new_schema>)
65
+ ```
66
+
67
+ Returns: added/removed/modified tables and columns, type changes, constraint changes, breaking change detection.
68
+
69
+ **For SQL model changes:** Call `schema_diff` to compare two SQL models for column-level breaking changes:
70
+
71
+ ```
72
+ schema_diff(old_sql: <old_sql>, new_sql: <new_sql>, dialect: <dialect>)
73
+ ```
74
+
75
+ Returns: dropped columns (BREAKING), type changes (WARNING), potential renames (Levenshtein distance matching).
76
+
77
+ ### 4. Present the Analysis
78
+
79
+ ```
80
+ Schema Migration Analysis
81
+ =========================
82
+
83
+ Migration: alter_orders_table.sql
84
+ Dialect: snowflake
85
+
86
+ BREAKING CHANGES (2):
87
+ [DATA LOSS] Dropped column: orders.discount_amount
88
+ -> Column has 1.2M non-NULL values. Data will be permanently lost.
89
+
90
+ [TRUNCATION] Type narrowed: orders.customer_name VARCHAR(200) -> VARCHAR(50)
91
+ -> 3,400 rows exceed 50 chars. Values will be truncated.
92
+
93
+ WARNINGS (1):
94
+ [CONSTRAINT] Dropped unique constraint on orders.external_id
95
+ -> Duplicates may be inserted after migration.
96
+
97
+ SAFE CHANGES (3):
98
+ [ADD] New column: orders.updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
99
+ [ADD] New column: orders.version INTEGER DEFAULT 1
100
+ [WIDEN] Type widened: orders.amount DECIMAL(10,2) -> DECIMAL(18,2)
101
+
102
+ Recommendation: DO NOT apply without addressing BREAKING changes.
103
+ 1. Back up discount_amount data before dropping
104
+ 2. Verify no values exceed 50 chars, or widen the target type
105
+ 3. Confirm external_id uniqueness is no longer required
106
+ ```
107
+
108
+ ### 5. For dbt Model Refactoring
109
+
110
+ When the user is refactoring a dbt model (renaming columns, changing types):
111
+ 1. Run `schema_diff` on old vs new compiled SQL
112
+ 2. Cross-reference with `dbt-analyze` to check downstream consumers
113
+ 3. Flag any downstream model that references a dropped/renamed column
114
+
115
+ ## Usage
116
+
117
+ - `/schema-migration migrations/V003__alter_orders.sql` -- Analyze a DDL migration file
118
+ - `/schema-migration models/staging/stg_orders.sql` -- Compare current file against last commit
119
+ - `/schema-migration --old schema_v1.yml --new schema_v2.yml` -- Compare two schema files
@@ -0,0 +1,118 @@
1
+ ---
2
+ name: sql-review
3
+ description: Pre-merge SQL quality gate — lint 26 anti-patterns, grade readability/performance A-F, validate syntax, and scan for injection threats. Use before committing or reviewing SQL changes.
4
+ ---
5
+
6
+ # SQL Review
7
+
8
+ ## Requirements
9
+ **Agent:** any (read-only analysis)
10
+ **Tools used:** altimate_core_check, altimate_core_grade, sql_analyze, read, glob, bash (for git operations)
11
+
12
+ ## When to Use This Skill
13
+
14
+ **Use when the user wants to:**
15
+ - Review SQL quality before merging a PR
16
+ - Get a quality grade (A-F) on a query or model
17
+ - Run a comprehensive lint + safety + syntax check in one pass
18
+ - Audit SQL files in a directory for anti-patterns
19
+
20
+ **Do NOT use for:**
21
+ - Optimizing query performance -> use `query-optimize`
22
+ - Fixing broken SQL -> use `dbt-troubleshoot`
23
+ - Translating between dialects -> use `sql-translate`
24
+
25
+ ## Workflow
26
+
27
+ ### 1. Collect SQL to Review
28
+
29
+ Either:
30
+ - Read SQL from a file path provided by the user
31
+ - Accept SQL directly from the conversation
32
+ - Auto-detect changed SQL files from git:
33
+
34
+ ```bash
35
+ git diff --name-only HEAD~1 | grep '\.sql$'
36
+ ```
37
+
38
+ For dbt models, compile first to get the full SQL:
39
+ ```bash
40
+ altimate-dbt compile --model <name>
41
+ ```
42
+
43
+ ### 2. Run Comprehensive Check
44
+
45
+ Call `altimate_core_check` — this is the single-call code review that composes:
46
+ - **Syntax validation**: Parse errors with line/column positions
47
+ - **Lint (26 anti-patterns)**: SELECT *, unused CTEs, implicit casts, NULL comparisons, missing WHERE on DELETE/UPDATE, cartesian joins, non-sargable predicates, missing partition filters, and more
48
+ - **Injection scan**: Tautology attacks, UNION injection, stacked queries, comment injection, Jinja template injection
49
+ - **PII exposure**: Flags queries accessing columns classified as PII
50
+
51
+ ```
52
+ altimate_core_check(sql: <sql>, schema_context: <schema_object>)
53
+ ```
54
+
55
+ ### 3. Grade the SQL
56
+
57
+ Call `altimate_core_grade` to get an A-F quality score with per-category breakdown:
58
+
59
+ ```
60
+ altimate_core_grade(sql: <sql>, schema_context: <schema_object>)
61
+ ```
62
+
63
+ Categories scored:
64
+ - **Readability**: Naming, formatting, CTE structure
65
+ - **Performance**: Anti-patterns, index usage, scan efficiency
66
+ - **Correctness**: NULL handling, join logic, type safety
67
+ - **Best Practices**: Explicit columns, proper materialization hints
68
+
69
+ ### 4. Run Anti-Pattern Analysis
70
+
71
+ Call `sql_analyze` for the detailed anti-pattern breakdown with severity levels and concrete recommendations:
72
+
73
+ ```
74
+ sql_analyze(sql: <sql>, dialect: <dialect>)
75
+ ```
76
+
77
+ ### 5. Present the Review
78
+
79
+ ```
80
+ SQL Review: <file_or_query_name>
81
+ ==============================
82
+
83
+ Grade: B+ (82/100)
84
+ Readability: A (clear CTEs, good naming)
85
+ Performance: B- (missing partition filter on large table)
86
+ Correctness: A (proper NULL handling)
87
+ Best Practices: C (SELECT * in staging model)
88
+
89
+ Issues Found: 3
90
+ [HIGH] SELECT_STAR — Use explicit column list for contract stability
91
+ [MEDIUM] MISSING_PARTITION_FILTER — Add date filter to avoid full scan
92
+ [LOW] IMPLICIT_CAST — VARCHAR compared to INTEGER on line 23
93
+
94
+ Safety: PASS (no injection vectors detected)
95
+ PII: PASS (no PII columns exposed)
96
+
97
+ Verdict: Fix HIGH issues before merging. MEDIUM issues are recommended.
98
+ ```
99
+
100
+ ### 6. Batch Mode
101
+
102
+ When reviewing multiple files (e.g., all changed SQL in a PR):
103
+ - Run the check on each file
104
+ - Present a summary table:
105
+
106
+ ```
107
+ | File | Grade | Issues | Safety | Verdict |
108
+ |------|-------|--------|--------|---------|
109
+ | stg_orders.sql | A | 0 | PASS | Ship |
110
+ | int_revenue.sql | B- | 2 | PASS | Fix HIGH |
111
+ | mart_daily.sql | C | 5 | WARN | Block |
112
+ ```
113
+
114
+ ## Usage
115
+
116
+ - `/sql-review models/marts/fct_orders.sql` -- Review a specific file
117
+ - `/sql-review` -- Review all SQL files changed in the current git diff
118
+ - `/sql-review --all models/` -- Review all SQL files in a directory
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: sql-translate
3
+ description: Translate SQL queries between database dialects (Snowflake, BigQuery, PostgreSQL, MySQL, etc.)
4
+ ---
5
+
6
+ # SQL Translate
7
+
8
+ ## Requirements
9
+ **Agent:** builder or migrator (may write translated SQL to files)
10
+ **Tools used:** sql_translate, read, write, sql_validate
11
+
12
+ Translate SQL queries from one database dialect to another using sqlglot's transpilation engine.
13
+
14
+ ## Workflow
15
+
16
+ 1. **Determine source and target dialects** — If the user did not specify both dialects, ask which source and target dialects to use. Common dialects: `snowflake`, `bigquery`, `postgres`, `mysql`, `tsql`, `hive`, `spark`, `databricks`, `redshift`, `duckdb`.
17
+
18
+ 2. **Get the SQL to translate** — Either:
19
+ - Read from a file path provided by the user (use `read`)
20
+ - Accept inline SQL from the user's message
21
+ - Read from clipboard or stdin if mentioned
22
+
23
+ 3. **Call `sql_translate`** with:
24
+ - `sql`: The SQL query text
25
+ - `source_dialect`: The source dialect
26
+ - `target_dialect`: The target dialect
27
+
28
+ 4. **Review the result**:
29
+ - If `success` is true, present the translated SQL
30
+ - If there are `warnings`, explain each one and what may need manual adjustment
31
+ - If `success` is false, explain the error and suggest fixes
32
+
33
+ 5. **Format the output** showing:
34
+ - Original SQL (labeled with source dialect)
35
+ - Translated SQL (labeled with target dialect)
36
+ - Any warnings about lossy translations or features that need manual review
37
+
38
+ 6. **Offer next steps** if applicable:
39
+ - Suggest running `sql_validate` on the translated SQL to verify syntax
40
+ - Offer to write the translated SQL to a file
41
+ - Offer to translate additional queries
42
+
43
+ ## Usage
44
+
45
+ The user invokes this skill with optional dialect and SQL arguments:
46
+ - `/sql-translate` — Interactive: ask for source dialect, target dialect, and SQL
47
+ - `/sql-translate snowflake postgres` — Translate from Snowflake to PostgreSQL (will ask for SQL)
48
+ - `/sql-translate snowflake postgres SELECT DATEADD(day, 7, CURRENT_TIMESTAMP())` — Full inline translation
49
+
50
+ ## Supported Dialects
51
+
52
+ | Dialect | Key |
53
+ |---------|-----|
54
+ | Snowflake | `snowflake` |
55
+ | BigQuery | `bigquery` |
56
+ | PostgreSQL | `postgres` |
57
+ | MySQL | `mysql` |
58
+ | SQL Server | `tsql` |
59
+ | Hive | `hive` |
60
+ | Spark SQL | `spark` |
61
+ | Databricks | `databricks` |
62
+ | Redshift | `redshift` |
63
+ | DuckDB | `duckdb` |
64
+ | SQLite | `sqlite` |
65
+ | Oracle | `oracle` |
66
+ | Trino/Presto | `trino` / `presto` |
67
+
68
+ Use the tools: `sql_translate`, `read`, `write`, `sql_validate`.
@@ -0,0 +1,54 @@
1
+ ---
2
+ name: teach
3
+ description: Teach your AI teammate a pattern by showing it an example file from your codebase
4
+ ---
5
+
6
+ # Teach
7
+
8
+ ## Purpose
9
+ Learn a reusable pattern from an example file. The user shows you a well-written artifact (model, query, config), and you extract the patterns worth following.
10
+
11
+ ## Workflow
12
+
13
+ 1. **Identify the file**: The user provides a file reference (e.g., `@models/staging/stg_orders.sql`). Read the file.
14
+
15
+ 2. **Analyze patterns**: Extract the structural patterns, NOT the specific content. Focus on:
16
+ - File structure and organization (sections, ordering)
17
+ - Naming conventions (prefixes, suffixes, casing)
18
+ - SQL patterns (CTE vs subquery, join style, column ordering)
19
+ - dbt conventions (materialization, tests, config blocks)
20
+ - Common boilerplate (headers, comments, imports)
21
+ - Data type choices
22
+ - Error handling patterns
23
+
24
+ 3. **Present findings**: Show the user what you learned in a structured list. Be specific:
25
+ - Good: "Column order: keys first, then dimensions, then measures, then timestamps"
26
+ - Bad: "Good column ordering"
27
+
28
+ 4. **Ask for confirmation**: Let the user confirm, modify, or reject your findings before saving.
29
+
30
+ 5. **Save via training_save**: Use the `training_save` tool with:
31
+ - `kind`: "pattern"
32
+ - `name`: A descriptive slug (e.g., "staging-model", "incremental-config")
33
+ - `content`: The extracted patterns as a concise, actionable checklist
34
+ - `scope`: "project" (default — shared with team via git)
35
+ - `source`: The file path you learned from
36
+ - `citations`: Reference to the source file
37
+
38
+ ## Important Guidelines
39
+
40
+ - Extract PATTERNS, not content. "Use `{{ source() }}` macro" is a pattern. "Query the orders table" is content.
41
+ - Keep it concise — max 10 bullet points per pattern. If more are needed, split into multiple patterns.
42
+ - Use the file's actual conventions, don't impose your own preferences.
43
+ - If the file doesn't have clear patterns worth learning, say so honestly.
44
+ - Do NOT make any LLM calls beyond the normal conversation flow — pattern extraction happens in your analysis, not via separate API calls.
45
+
46
+ ## Usage Examples
47
+
48
+ ```
49
+ /teach @models/staging/stg_orders.sql
50
+ /teach staging-model @models/staging/stg_customers.sql
51
+ /teach @dbt_project.yml
52
+ ```
53
+
54
+ If the user provides a name (first argument before the @file), use that as the pattern name. Otherwise, infer a name from the file type and purpose.
@@ -0,0 +1,51 @@
1
+ ---
2
+ name: train
3
+ description: Train your AI teammate on team standards from a document or style guide
4
+ ---
5
+
6
+ # Train
7
+
8
+ ## Purpose
9
+ Learn team standards and conventions from a document (style guide, review checklist, coding standards, etc.). Extracts actionable rules and saves them as training.
10
+
11
+ ## Workflow
12
+
13
+ 1. **Get the document**: The user provides either:
14
+ - A file reference: `@docs/sql-style-guide.md`
15
+ - A URL: The full URL to fetch (use webfetch tool)
16
+ - Inline text: Pasted directly in the chat
17
+
18
+ 2. **Read and analyze**: Parse the document and extract:
19
+ - Specific, enforceable rules (naming, formatting, prohibited patterns)
20
+ - Review criteria and checklists
21
+ - Glossary terms and definitions
22
+ - Architectural standards
23
+
24
+ 3. **Categorize**: Group findings by training kind:
25
+ - `rule` — Specific do/don't rules (e.g., "Never use SELECT *")
26
+ - `standard` — Broader conventions (e.g., "SQL style guide compliance")
27
+ - `glossary` — Term definitions (e.g., "ARR = Annual Recurring Revenue")
28
+
29
+ 4. **Present summary**: Show the user what you extracted:
30
+ - Number of rules, standards, and glossary terms found
31
+ - Preview of each item
32
+ - Ask for confirmation before saving
33
+
34
+ 5. **Save via training_save**: Save each item using the `training_save` tool. For documents with many rules, consolidate related rules into logical groups (e.g., "sql-naming-rules" with 5 rules, rather than 5 separate entries).
35
+
36
+ ## Important Guidelines
37
+
38
+ - Only extract ACTIONABLE items. Skip vague guidance like "write clean code."
39
+ - Consolidate related rules into single training entries to avoid clutter.
40
+ - Preserve the original wording when it's specific and clear.
41
+ - If the document is too large, focus on the most impactful rules.
42
+ - Always use `scope: project` unless the user specifies global.
43
+ - Do NOT make any extra LLM calls — analysis happens in the normal conversation flow.
44
+
45
+ ## Usage Examples
46
+
47
+ ```
48
+ /train @docs/sql-style-guide.md
49
+ /train https://wiki.company.com/data-team/review-checklist
50
+ /train (then paste content inline)
51
+ ```
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: training-status
3
+ description: Show what your AI teammate has learned — patterns, rules, glossary, and standards
4
+ ---
5
+
6
+ # Training Status
7
+
8
+ ## Purpose
9
+ Display a comprehensive overview of everything your AI teammate has been trained on.
10
+
11
+ ## Workflow
12
+
13
+ 1. **Fetch all training**: Use the `training_list` tool with no filters to get all training entries.
14
+
15
+ 2. **Present the dashboard**: Format the output as a clean status report:
16
+
17
+ ```
18
+ Training Status
19
+
20
+ Patterns: X (staging-model, incremental-config, ...)
21
+ Rules: X (no-float, no-select-star, ...)
22
+ Glossary: X (arr, mrr, churn-date, ...)
23
+ Standards: X (sql-style-guide, review-checklist, ...)
24
+
25
+ Recent Training:
26
+ - 2 days ago: Learned rule "no-float" (from user correction)
27
+ - 5 days ago: Learned pattern "staging-model" (from stg_orders.sql)
28
+ - 1 week ago: Loaded standard "sql-style-guide" (from docs/sql-style.md)
29
+
30
+ Most Applied:
31
+ - "staging-model" pattern — applied 12 times
32
+ - "no-float" rule — applied 8 times
33
+ ```
34
+
35
+ 3. **Offer actions**: After showing status, suggest:
36
+ - `/teach` to learn new patterns
37
+ - `/train` to load standards from documents
38
+ - `training_remove` to remove outdated entries
39
+ - `training_list` with filters for detailed views
40
+
41
+ ## Usage
42
+
43
+ ```
44
+ /training-status
45
+ ```