Skip to content

Commit 02a4ad6

Browse files
authored
feat(templates): add analytics workflow template (#115)
feat(templates): add analytics workflow template
2 parents 3b6c3ce + c7f8934 commit 02a4ad6

File tree

4 files changed

+308
-12
lines changed

4 files changed

+308
-12
lines changed

scripts/init-session.ps1

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
# Initialize planning files for a new session
2-
# Usage: .\init-session.ps1 [project-name]
2+
# Usage: .\init-session.ps1 [-Template TYPE] [project-name]
3+
# Templates: default, analytics
34

45
param(
5-
[string]$ProjectName = "project"
6+
[string]$ProjectName = "project",
7+
[string]$Template = "default"
68
)
79

810
$DATE = Get-Date -Format "yyyy-MM-dd"
911

10-
Write-Host "Initializing planning files for: $ProjectName"
12+
# Resolve template directory (skill root is one level up from scripts/)
13+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
14+
$SkillRoot = Split-Path -Parent $ScriptDir
15+
$TemplateDir = Join-Path $SkillRoot "templates"
16+
17+
Write-Host "Initializing planning files for: $ProjectName (template: $Template)"
18+
19+
# Validate template
20+
if ($Template -ne "default" -and $Template -ne "analytics") {
21+
Write-Host "Unknown template: $Template (available: default, analytics). Using default."
22+
$Template = "default"
23+
}
1124

1225
# Create task_plan.md if it doesn't exist
1326
if (-not (Test-Path "task_plan.md")) {
14-
@"
27+
$AnalyticsPlan = Join-Path $TemplateDir "analytics_task_plan.md"
28+
if ($Template -eq "analytics" -and (Test-Path $AnalyticsPlan)) {
29+
Copy-Item $AnalyticsPlan "task_plan.md"
30+
} else {
31+
@"
1532
# Task Plan: [Brief Description]
1633
1734
## Goal
@@ -56,14 +73,19 @@ Phase 1
5673
| Error | Resolution |
5774
|-------|------------|
5875
"@ | Out-File -FilePath "task_plan.md" -Encoding UTF8
76+
}
5977
Write-Host "Created task_plan.md"
6078
} else {
6179
Write-Host "task_plan.md already exists, skipping"
6280
}
6381

6482
# Create findings.md if it doesn't exist
6583
if (-not (Test-Path "findings.md")) {
66-
@"
84+
$AnalyticsFindings = Join-Path $TemplateDir "analytics_findings.md"
85+
if ($Template -eq "analytics" -and (Test-Path $AnalyticsFindings)) {
86+
Copy-Item $AnalyticsFindings "findings.md"
87+
} else {
88+
@"
6789
# Findings & Decisions
6890
6991
## Requirements
@@ -83,14 +105,37 @@ if (-not (Test-Path "findings.md")) {
83105
## Resources
84106
-
85107
"@ | Out-File -FilePath "findings.md" -Encoding UTF8
108+
}
86109
Write-Host "Created findings.md"
87110
} else {
88111
Write-Host "findings.md already exists, skipping"
89112
}
90113

91114
# Create progress.md if it doesn't exist
92115
if (-not (Test-Path "progress.md")) {
93-
@"
116+
if ($Template -eq "analytics") {
117+
@"
118+
# Progress Log
119+
120+
## Session: $DATE
121+
122+
### Current Status
123+
- **Phase:** 1 - Data Discovery
124+
- **Started:** $DATE
125+
126+
### Actions Taken
127+
-
128+
129+
### Query Log
130+
| Query | Result Summary | Interpretation |
131+
|-------|---------------|----------------|
132+
133+
### Errors
134+
| Error | Resolution |
135+
|-------|------------|
136+
"@ | Out-File -FilePath "progress.md" -Encoding UTF8
137+
} else {
138+
@"
94139
# Progress Log
95140
96141
## Session: $DATE
@@ -110,6 +155,7 @@ if (-not (Test-Path "progress.md")) {
110155
| Error | Resolution |
111156
|-------|------------|
112157
"@ | Out-File -FilePath "progress.md" -Encoding UTF8
158+
}
113159
Write-Host "Created progress.md"
114160
} else {
115161
Write-Host "progress.md already exists, skipping"

scripts/init-session.sh

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,48 @@
11
#!/bin/bash
22
# Initialize planning files for a new session
3-
# Usage: ./init-session.sh [project-name]
3+
# Usage: ./init-session.sh [--template TYPE] [project-name]
4+
# Templates: default, analytics
45

56
set -e
67

7-
PROJECT_NAME="${1:-project}"
8+
# Parse arguments
9+
TEMPLATE="default"
10+
PROJECT_NAME="project"
11+
12+
while [[ $# -gt 0 ]]; do
13+
case "$1" in
14+
--template|-t)
15+
TEMPLATE="$2"
16+
shift 2
17+
;;
18+
*)
19+
PROJECT_NAME="$1"
20+
shift
21+
;;
22+
esac
23+
done
24+
825
DATE=$(date +%Y-%m-%d)
926

10-
echo "Initializing planning files for: $PROJECT_NAME"
27+
# Resolve template directory (skill root is one level up from scripts/)
28+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
29+
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
30+
TEMPLATE_DIR="$SKILL_ROOT/templates"
31+
32+
echo "Initializing planning files for: $PROJECT_NAME (template: $TEMPLATE)"
33+
34+
# Validate template
35+
if [ "$TEMPLATE" != "default" ] && [ "$TEMPLATE" != "analytics" ]; then
36+
echo "Unknown template: $TEMPLATE (available: default, analytics). Using default."
37+
TEMPLATE="default"
38+
fi
1139

1240
# Create task_plan.md if it doesn't exist
1341
if [ ! -f "task_plan.md" ]; then
14-
cat > task_plan.md << 'EOF'
42+
if [ "$TEMPLATE" = "analytics" ] && [ -f "$TEMPLATE_DIR/analytics_task_plan.md" ]; then
43+
cp "$TEMPLATE_DIR/analytics_task_plan.md" task_plan.md
44+
else
45+
cat > task_plan.md << 'EOF'
1546
# Task Plan: [Brief Description]
1647
1748
## Goal
@@ -56,14 +87,18 @@ Phase 1
5687
| Error | Resolution |
5788
|-------|------------|
5889
EOF
90+
fi
5991
echo "Created task_plan.md"
6092
else
6193
echo "task_plan.md already exists, skipping"
6294
fi
6395

6496
# Create findings.md if it doesn't exist
6597
if [ ! -f "findings.md" ]; then
66-
cat > findings.md << 'EOF'
98+
if [ "$TEMPLATE" = "analytics" ] && [ -f "$TEMPLATE_DIR/analytics_findings.md" ]; then
99+
cp "$TEMPLATE_DIR/analytics_findings.md" findings.md
100+
else
101+
cat > findings.md << 'EOF'
67102
# Findings & Decisions
68103
69104
## Requirements
@@ -83,14 +118,37 @@ if [ ! -f "findings.md" ]; then
83118
## Resources
84119
-
85120
EOF
121+
fi
86122
echo "Created findings.md"
87123
else
88124
echo "findings.md already exists, skipping"
89125
fi
90126

91127
# Create progress.md if it doesn't exist
92128
if [ ! -f "progress.md" ]; then
93-
cat > progress.md << EOF
129+
if [ "$TEMPLATE" = "analytics" ]; then
130+
cat > progress.md << EOF
131+
# Progress Log
132+
133+
## Session: $DATE
134+
135+
### Current Status
136+
- **Phase:** 1 - Data Discovery
137+
- **Started:** $DATE
138+
139+
### Actions Taken
140+
-
141+
142+
### Query Log
143+
| Query | Result Summary | Interpretation |
144+
|-------|---------------|----------------|
145+
146+
### Errors
147+
| Error | Resolution |
148+
|-------|------------|
149+
EOF
150+
else
151+
cat > progress.md << EOF
94152
# Progress Log
95153
96154
## Session: $DATE
@@ -110,6 +168,7 @@ if [ ! -f "progress.md" ]; then
110168
| Error | Resolution |
111169
|-------|------------|
112170
EOF
171+
fi
113172
echo "Created progress.md"
114173
else
115174
echo "progress.md already exists, skipping"

templates/analytics_findings.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Findings & Decisions
2+
<!--
3+
WHAT: Knowledge base for your analytics session. Stores data sources, hypotheses, and results.
4+
WHY: Context windows are limited. This file is your "external memory" for analytical work.
5+
WHEN: Update after ANY discovery, especially after running queries or viewing charts.
6+
-->
7+
8+
## Data Sources
9+
<!--
10+
WHAT: Every data source you connected to, with schema details and quality notes.
11+
WHY: Knowing where your data came from and its limitations is critical for reproducibility.
12+
EXAMPLE:
13+
| user_events | PostgreSQL prod replica | 2.3M rows | user_id, event_type, ts | 0.2% null user_id |
14+
| revenue.csv | Finance team export | 45K rows | account_id, mrr, churn_date | Complete, no nulls |
15+
-->
16+
| Source | Location | Size | Key Fields | Quality Notes |
17+
|--------|----------|------|------------|---------------|
18+
| | | | | |
19+
20+
## Hypothesis Log
21+
<!--
22+
WHAT: Each hypothesis you tested, the method used, and the result.
23+
WHY: Structured tracking prevents p-hacking and makes your reasoning auditable.
24+
EXAMPLE:
25+
| H1: Churn > 50% for low-activity users | Chi-squared test | Confirmed (p=0.003) | High |
26+
| H2: Feature X correlates with retention | Pearson correlation | Rejected (r=0.08) | High |
27+
-->
28+
| Hypothesis | Test Method | Result | Confidence |
29+
|------------|-------------|--------|------------|
30+
| | | | |
31+
32+
## Query Results
33+
<!--
34+
WHAT: Key queries you ran and what they revealed.
35+
WHY: Queries are ephemeral - if you don't write down the results, they're lost on context reset.
36+
WHEN: After EVERY significant query. Don't wait.
37+
EXAMPLE:
38+
### Churn rate by activity segment
39+
Query: SELECT activity_bucket, COUNT(*), AVG(churned) FROM user_segments GROUP BY 1
40+
Result: Low activity: 62% churn, Medium: 28%, High: 8%
41+
Interpretation: Strong inverse relationship between activity and churn
42+
-->
43+
<!-- Record query, result summary, and interpretation for each significant query -->
44+
45+
## Statistical Findings
46+
<!--
47+
WHAT: Formal statistical test results with all relevant metrics.
48+
WHY: Recording p-values, effect sizes, and confidence intervals makes results reproducible.
49+
EXAMPLE:
50+
| Chi-squared (churn ~ activity) | p=0.003 | Cramer's V=0.31 | Reject null: activity segments differ significantly in churn |
51+
| Pearson (feature_x ~ retention) | p=0.42 | r=0.08 | Fail to reject: no meaningful correlation |
52+
-->
53+
| Test | p-value | Effect Size | Conclusion |
54+
|------|---------|-------------|------------|
55+
| | | | |
56+
57+
## Technical Decisions
58+
<!--
59+
WHAT: Analytical method choices with reasoning.
60+
EXAMPLE:
61+
| Use log transform on revenue | Right-skewed distribution, normalizes for parametric tests |
62+
-->
63+
| Decision | Rationale |
64+
|----------|-----------|
65+
| | |
66+
67+
## Issues Encountered
68+
| Issue | Resolution |
69+
|-------|------------|
70+
| | |
71+
72+
## Resources
73+
<!-- URLs, file paths, documentation links -->
74+
-
75+
76+
## Visual/Browser Findings
77+
<!--
78+
CRITICAL: Update after viewing charts, dashboards, or browser results.
79+
Multimodal content doesn't persist in context - capture as text immediately.
80+
-->
81+
-
82+
83+
---
84+
*Update this file after every 2 view/browser/search operations*
85+
*This prevents visual information from being lost*

0 commit comments

Comments
 (0)