Skill Tracer
Skills › Knowledge Work Plugins › data-context-extractor › example-output.md

example-output.md

198 lines · data/skills/data-context-extractor/references/example-output.md at 2574e29

Open on GitHub
1# Example: Generated Skill
2
3This is an example of what a generated skill looks like after the bootstrap process. This example is for a fictional e-commerce company called "ShopCo" using Snowflake.
4
5---
6

Example: Generated Skill

This is an example of what a generated skill looks like after the bootstrap process. This example is for a fictional e-commerce company called "ShopCo" using Snowflake.


Raw lines 1 to 6
7## Example SKILL.md
8
9```markdown
10---
11name: shopco-data-analyst
12description: "ShopCo data analysis skill for Snowflake. Provides context for querying e-commerce data including customer, order, and product analytics. Use when analyzing ShopCo data for: (1) Revenue and order metrics, (2) Customer behavior and retention, (3) Product performance, or any data questions requiring ShopCo-specific context."
13---
15# ShopCo Data Analysis
17## SQL Dialect: Snowflake
19- **Table references**: `SHOPCO_DW.SCHEMA.TABLE` or with quotes for case-sensitive: `"Column_Name"`
20- **Safe division**: `DIV0(a, b)` returns 0, `DIV0NULL(a, b)` returns NULL
21- **Date functions**:
22 - `DATE_TRUNC('MONTH', date_col)`
23 - `DATEADD(DAY, -1, date_col)`
24 - `DATEDIFF(DAY, start_date, end_date)`
25- **Column exclusion**: `SELECT * EXCLUDE (column_to_exclude)`
27---
29## Entity Disambiguation
31**"Customer" can mean:**
32- **User**: A login account that can browse and save items (CORE.DIM_USERS: user_id)
33- **Customer**: A user who has made at least one purchase (CORE.DIM_CUSTOMERS: customer_id)
34- **Account**: A billing entity, can have multiple users in B2B (CORE.DIM_ACCOUNTS: account_id)
36**Relationships:**
37- User → Customer: 1:1 (customer_id = user_id for purchasers)
38- Account → User: 1:many (join on account_id)
40---
42## Business Terminology
44| Term | Definition | Notes |
45|------|------------|-------|
46| GMV | Gross Merchandise Value - total order value before returns/discounts | Use for top-line reporting |
47| NMV | Net Merchandise Value - GMV minus returns and discounts | Use for actual revenue |
48| AOV | Average Order Value - NMV / order count | Exclude $0 orders |
49| LTV | Lifetime Value - total NMV per customer since first order | Rolling calc, updates daily |
50| CAC | Customer Acquisition Cost - marketing spend / new customers | By cohort month |
52---
54## Standard Filters
56Always apply these filters unless explicitly told otherwise:
58```sql
59-- Exclude test and internal orders
60WHERE order_status != 'TEST'
61 AND customer_type != 'INTERNAL'
62 AND is_employee_order = FALSE
64-- Exclude cancelled orders for revenue metrics
65 AND order_status NOT IN ('CANCELLED', 'FRAUDULENT')
66```
68---
70## Key Metrics
72### Gross Merchandise Value (GMV)
73- **Definition**: Total value of all orders placed
74- **Formula**: `SUM(order_total_gross)`
75- **Source**: `CORE.FCT_ORDERS.order_total_gross`
76- **Time grain**: Daily, aggregated to weekly/monthly
77- **Caveats**: Includes orders that may later be cancelled or returned
79### Net Revenue
80- **Definition**: Actual revenue after returns and discounts
81- **Formula**: `SUM(order_total_gross - return_amount - discount_amount)`
82- **Source**: `CORE.FCT_ORDERS`
83- **Caveats**: Returns can occur up to 90 days post-order; use settled_revenue for finalized numbers
85---
87## Knowledge Base Navigation
89| Domain | Reference File | Use For |
90|--------|----------------|---------|
91| Orders | `references/orders.md` | Order tables, GMV/NMV calculations |
92| Customers | `references/customers.md` | User/customer entities, LTV, cohorts |
93| Products | `references/products.md` | Catalog, inventory, categories |
95---
97## Common Query Patterns
99### Daily GMV by Channel
100```sql
101SELECT
102 DATE_TRUNC('DAY', order_timestamp) AS order_date,
103 channel,
104 SUM(order_total_gross) AS gmv,
105 COUNT(DISTINCT order_id) AS order_count
106FROM SHOPCO_DW.CORE.FCT_ORDERS
107WHERE order_status NOT IN ('TEST', 'CANCELLED', 'FRAUDULENT')
108 AND order_timestamp >= DATEADD(DAY, -30, CURRENT_DATE())
109GROUP BY 1, 2
110ORDER BY 1 DESC, 3 DESC
111```
113### Customer Cohort Retention
114```sql
115WITH cohorts AS (
116 SELECT
117 customer_id,
118 DATE_TRUNC('MONTH', first_order_date) AS cohort_month
119 FROM SHOPCO_DW.CORE.DIM_CUSTOMERS
121SELECT
122 c.cohort_month,
123 DATEDIFF(MONTH, c.cohort_month, DATE_TRUNC('MONTH', o.order_timestamp)) AS months_since_first,
124 COUNT(DISTINCT c.customer_id) AS active_customers
125FROM cohorts c
126JOIN SHOPCO_DW.CORE.FCT_ORDERS o ON c.customer_id = o.customer_id
127WHERE o.order_status NOT IN ('TEST', 'CANCELLED')
128GROUP BY 1, 2
129ORDER BY 1, 2
130```
131```
133---

Example SKILL.md

---
name: shopco-data-analyst
description: "ShopCo data analysis skill for Snowflake. Provides context for querying e-commerce data including customer, order, and product analytics. Use when analyzing ShopCo data for: (1) Revenue and order metrics, (2) Customer behavior and retention, (3) Product performance, or any data questions requiring ShopCo-specific context."
---

# ShopCo Data Analysis

## SQL Dialect: Snowflake

- **Table references**: `SHOPCO_DW.SCHEMA.TABLE` or with quotes for case-sensitive: `"Column_Name"`
- **Safe division**: `DIV0(a, b)` returns 0, `DIV0NULL(a, b)` returns NULL
- **Date functions**:
  - `DATE_TRUNC('MONTH', date_col)`
  - `DATEADD(DAY, -1, date_col)`
  - `DATEDIFF(DAY, start_date, end_date)`
- **Column exclusion**: `SELECT * EXCLUDE (column_to_exclude)`

---

## Entity Disambiguation

**"Customer" can mean:**
- **User**: A login account that can browse and save items (CORE.DIM_USERS: user_id)
- **Customer**: A user who has made at least one purchase (CORE.DIM_CUSTOMERS: customer_id)
- **Account**: A billing entity, can have multiple users in B2B (CORE.DIM_ACCOUNTS: account_id)

**Relationships:**
- User → Customer: 1:1 (customer_id = user_id for purchasers)
- Account → User: 1:many (join on account_id)

---

## Business Terminology

| Term | Definition | Notes |
|------|------------|-------|
| GMV | Gross Merchandise Value - total order value before returns/discounts | Use for top-line reporting |
| NMV | Net Merchandise Value - GMV minus returns and discounts | Use for actual revenue |
| AOV | Average Order Value - NMV / order count | Exclude $0 orders |
| LTV | Lifetime Value - total NMV per customer since first order | Rolling calc, updates daily |
| CAC | Customer Acquisition Cost - marketing spend / new customers | By cohort month |

---

## Standard Filters

Always apply these filters unless explicitly told otherwise:

-- Exclude test and internal orders WHERE order_status != 'TEST' AND customer_type != 'INTERNAL' AND is_employee_order = FALSE

-- Exclude cancelled orders for revenue metrics AND order_status NOT IN ('CANCELLED', 'FRAUDULENT')


---

## Key Metrics

### Gross Merchandise Value (GMV)
- **Definition**: Total value of all orders placed
- **Formula**: `SUM(order_total_gross)`
- **Source**: `CORE.FCT_ORDERS.order_total_gross`
- **Time grain**: Daily, aggregated to weekly/monthly
- **Caveats**: Includes orders that may later be cancelled or returned

### Net Revenue
- **Definition**: Actual revenue after returns and discounts
- **Formula**: `SUM(order_total_gross - return_amount - discount_amount)`
- **Source**: `CORE.FCT_ORDERS`
- **Caveats**: Returns can occur up to 90 days post-order; use settled_revenue for finalized numbers

---

## Knowledge Base Navigation

| Domain | Reference File | Use For |
|--------|----------------|---------|
| Orders | `references/orders.md` | Order tables, GMV/NMV calculations |
| Customers | `references/customers.md` | User/customer entities, LTV, cohorts |
| Products | `references/products.md` | Catalog, inventory, categories |

---

## Common Query Patterns

### Daily GMV by Channel

SELECT DATE_TRUNC('DAY', order_timestamp) AS order_date, channel, SUM(order_total_gross) AS gmv, COUNT(DISTINCT order_id) AS order_count FROM SHOPCO_DW.CORE.FCT_ORDERS WHERE order_status NOT IN ('TEST', 'CANCELLED', 'FRAUDULENT') AND order_timestamp >= DATEADD(DAY, -30, CURRENT_DATE()) GROUP BY 1, 2 ORDER BY 1 DESC, 3 DESC


### Customer Cohort Retention

WITH cohorts AS ( SELECT customer_id, DATE_TRUNC('MONTH', first_order_date) AS cohort_month FROM SHOPCO_DW.CORE.DIM_CUSTOMERS ) SELECT c.cohort_month, DATEDIFF(MONTH, c.cohort_month, DATE_TRUNC('MONTH', o.order_timestamp)) AS months_since_first, COUNT(DISTINCT c.customer_id) AS active_customers FROM cohorts c JOIN SHOPCO_DW.CORE.FCT_ORDERS o ON c.customer_id = o.customer_id WHERE o.order_status NOT IN ('TEST', 'CANCELLED') GROUP BY 1, 2 ORDER BY 1, 2


Raw lines 7 to 134
135## Example references/orders.md
137```markdown
138# Orders Tables
140Order and transaction data for ShopCo.
142---
144## Key Tables
146### FCT_ORDERS
147**Location**: `SHOPCO_DW.CORE.FCT_ORDERS`
148**Description**: Fact table of all orders. One row per order.
149**Primary Key**: `order_id`
150**Update Frequency**: Hourly (15 min lag)
151**Partitioned By**: `order_date`
153| Column | Type | Description | Notes |
154|--------|------|-------------|-------|
155| **order_id** | VARCHAR | Unique order identifier | |
156| **customer_id** | VARCHAR | FK to DIM_CUSTOMERS | NULL for guest checkout |
157| **order_timestamp** | TIMESTAMP_NTZ | When order was placed | UTC |
158| **order_date** | DATE | Date portion of order_timestamp | Partition column |
159| **order_status** | VARCHAR | Current status | PENDING, SHIPPED, DELIVERED, CANCELLED, RETURNED |
160| **channel** | VARCHAR | Acquisition channel | WEB, APP, MARKETPLACE |
161| **order_total_gross** | DECIMAL(12,2) | Pre-discount total | |
162| **discount_amount** | DECIMAL(12,2) | Total discounts applied | |
163| **return_amount** | DECIMAL(12,2) | Value of returned items | Updates async |
165**Relationships**:
166- Joins to `DIM_CUSTOMERS` on `customer_id`
167- Parent of `FCT_ORDER_ITEMS` via `order_id`
169---
171## Sample Queries
173### Orders with Returns Rate
174```sql
175SELECT
176 DATE_TRUNC('WEEK', order_date) AS week,
177 COUNT(*) AS total_orders,
178 SUM(CASE WHEN return_amount > 0 THEN 1 ELSE 0 END) AS orders_with_returns,
179 DIV0(SUM(CASE WHEN return_amount > 0 THEN 1 ELSE 0 END), COUNT(*)) AS return_rate
180FROM SHOPCO_DW.CORE.FCT_ORDERS
181WHERE order_status NOT IN ('TEST', 'CANCELLED')
182 AND order_date >= DATEADD(MONTH, -3, CURRENT_DATE())
183GROUP BY 1
184ORDER BY 1
185```
186```
188---
190This example demonstrates:
191- Complete frontmatter with triggering description
192- Dialect-specific SQL notes
193- Clear entity disambiguation
194- Terminology glossary
195- Standard filters as copy-paste SQL
196- Metric definitions with formulas
197- Navigation to reference files
198- Real, runnable query examples

Example references/orders.md

# Orders Tables

Order and transaction data for ShopCo.

---

## Key Tables

### FCT_ORDERS
**Location**: `SHOPCO_DW.CORE.FCT_ORDERS`
**Description**: Fact table of all orders. One row per order.
**Primary Key**: `order_id`
**Update Frequency**: Hourly (15 min lag)
**Partitioned By**: `order_date`

| Column | Type | Description | Notes |
|--------|------|-------------|-------|
| **order_id** | VARCHAR | Unique order identifier | |
| **customer_id** | VARCHAR | FK to DIM_CUSTOMERS | NULL for guest checkout |
| **order_timestamp** | TIMESTAMP_NTZ | When order was placed | UTC |
| **order_date** | DATE | Date portion of order_timestamp | Partition column |
| **order_status** | VARCHAR | Current status | PENDING, SHIPPED, DELIVERED, CANCELLED, RETURNED |
| **channel** | VARCHAR | Acquisition channel | WEB, APP, MARKETPLACE |
| **order_total_gross** | DECIMAL(12,2) | Pre-discount total | |
| **discount_amount** | DECIMAL(12,2) | Total discounts applied | |
| **return_amount** | DECIMAL(12,2) | Value of returned items | Updates async |

**Relationships**:
- Joins to `DIM_CUSTOMERS` on `customer_id`
- Parent of `FCT_ORDER_ITEMS` via `order_id`

---

## Sample Queries

### Orders with Returns Rate

SELECT DATE_TRUNC('WEEK', order_date) AS week, COUNT() AS total_orders, SUM(CASE WHEN return_amount > 0 THEN 1 ELSE 0 END) AS orders_with_returns, DIV0(SUM(CASE WHEN return_amount > 0 THEN 1 ELSE 0 END), COUNT()) AS return_rate FROM SHOPCO_DW.CORE.FCT_ORDERS WHERE order_status NOT IN ('TEST', 'CANCELLED') AND order_date >= DATEADD(MONTH, -3, CURRENT_DATE()) GROUP BY 1 ORDER BY 1


This example demonstrates:

  • Complete frontmatter with triggering description
  • Dialect-specific SQL notes
  • Clear entity disambiguation
  • Terminology glossary
  • Standard filters as copy-paste SQL
  • Metric definitions with formulas
  • Navigation to reference files
  • Real, runnable query examples
Raw lines 135 to 198