一键导入
dstack-upgrade
Upgrade data-stack to the latest version. Detects global vs vendored install, runs the upgrade, and shows what's new.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Upgrade data-stack to the latest version. Detects global vs vendored install, runs the upgrade, and shows what's new.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Recommends which data skill to run next. Use when starting a new analysis session or unsure where to begin. Asks what you are trying to accomplish and recommends the right skill with reasoning. Trigger phrases: "where should I start?", "what skill should I use?", "advisor", "help me figure out what to run", "I don't know where to begin".
Period-over-period or cohort comparison. Use to understand what changed between two time periods, groups, or experiments. Breaks down the delta by key dimensions to find where the difference comes from. Trigger phrases: "last week vs prior week", "before vs after launch", "compare these two groups", "A/B results", "what changed?", "why is X different?".
Dataset discovery and schema mapping. Use when starting fresh with data, exploring what's available, or mapping a new data source. Opens an Upsolve thread, surfaces available tables and schemas, profiles row counts and key columns, and outputs a structured data map. Strongly recommended as the first step before any analysis. Trigger phrases: "what data do I have?", "show me my tables", "explore this dataset", "what's available?", "I'm new to this data".
Funnel drop-off analysis. Define conversion steps and get conversion rates, absolute drop-off counts, and segment breakdowns at each stage. Use for product analytics, marketing funnels, checkout flows, or any sequential user journey. Trigger phrases: "funnel analysis", "where are users dropping off?", "conversion rate", "show me the funnel", "why aren't users converting?".
Anomaly root cause analysis. Use when a metric looks wrong or surprising. Runs a structured 4-phase investigation over a single Upsolve thread: confirm → narrow → hypothesize → validate. Findings use numbered codes (1A CONFIRMED, 1B CANDIDATE, 2A RULED_OUT). Trigger phrases: "revenue dropped", "metric is spiking", "why did X change?", "something looks wrong", "root cause", "debug this metric".
KPI deep dive report. Given a metric name, produces a structured brief: current value, WoW and MoM trend, top contributing segments, and notable outliers. Outputs a shareable summary for Slack, docs, or stakeholder updates. Trigger phrases: "summarize this metric", "metric brief", "what's happening with X", "give me a KPI summary", "how is [metric] doing?", "weekly metric update".
| name | dstack-upgrade |
| description | Upgrade data-stack to the latest version. Detects global vs vendored install, runs the upgrade, and shows what's new. |
| disable-model-invocation | true |
| license | MIT |
| metadata | {"author":"Upsolve Labs"} |
Upgrade data-stack to the latest version and show what's new.
This section is referenced by all skill preambles when they detect UPGRADE_AVAILABLE.
First, check if auto-upgrade is enabled:
_AUTO=""
[ "${DATA_STACK_AUTO_UPGRADE:-}" = "1" ] && _AUTO="true"
[ -z "$_AUTO" ] && _AUTO=$(~/.claude/skills/data-stack/bin/data-stack-config get auto_upgrade 2>/dev/null || .claude/skills/data-stack/bin/data-stack-config get auto_upgrade 2>/dev/null || true)
echo "AUTO_UPGRADE=$_AUTO"
If AUTO_UPGRADE=true or AUTO_UPGRADE=1: Skip AskUserQuestion. Log "Auto-upgrading data-stack v{old} → v{new}..." and proceed directly to Step 2. If ./install.sh fails during auto-upgrade, restore from backup (.bak directory) and warn the user: "Auto-upgrade failed — restored previous version. Run /upgrade manually to retry."
Otherwise, use AskUserQuestion:
If "Yes, upgrade now": Proceed to Step 2.
If "Always keep me up to date":
~/.claude/skills/data-stack/bin/data-stack-config set auto_upgrade true 2>/dev/null || .claude/skills/data-stack/bin/data-stack-config set auto_upgrade true 2>/dev/null
Tell user: "Auto-upgrade enabled. Future updates will install automatically." Then proceed to Step 2.
If "Not now": Write snooze state with escalating backoff (first snooze = 24h, second = 48h, third+ = 1 week), then continue with the current skill. Do not mention the upgrade again.
_SNOOZE_FILE="${DATA_STACK_STATE_DIR:-$HOME/.data-stack}/update-snoozed"
_REMOTE_VER="{new}"
_CUR_LEVEL=0
if [ -f "$_SNOOZE_FILE" ]; then
_SNOOZED_VER=$(awk '{print $1}' "$_SNOOZE_FILE")
if [ "$_SNOOZED_VER" = "$_REMOTE_VER" ]; then
_CUR_LEVEL=$(awk '{print $2}' "$_SNOOZE_FILE")
case "$_CUR_LEVEL" in *[!0-9]*) _CUR_LEVEL=0 ;; esac
fi
fi
_NEW_LEVEL=$((_CUR_LEVEL + 1))
[ "$_NEW_LEVEL" -gt 3 ] && _NEW_LEVEL=3
echo "$_REMOTE_VER $_NEW_LEVEL $(date +%s)" > "$_SNOOZE_FILE"
Note: {new} is the remote version from the UPGRADE_AVAILABLE output — substitute it from the update check result.
Tell user the snooze duration: "Next reminder in 24h" (or 48h or 1 week, depending on level). Tip: "Set auto_upgrade: true in ~/.data-stack/config.yaml for automatic upgrades."
If "Never ask again":
~/.claude/skills/data-stack/bin/data-stack-config set update_check false 2>/dev/null || .claude/skills/data-stack/bin/data-stack-config set update_check false 2>/dev/null
Tell user: "Update checks disabled. Run ~/.claude/skills/data-stack/bin/data-stack-config set update_check true to re-enable."
Continue with the current skill.
if [ -d "$HOME/.claude/skills/data-stack/.git" ]; then
INSTALL_TYPE="global-git"
INSTALL_DIR="$HOME/.claude/skills/data-stack"
elif [ -d ".claude/skills/data-stack/.git" ]; then
INSTALL_TYPE="local-git"
INSTALL_DIR=".claude/skills/data-stack"
elif [ -d ".claude/skills/data-stack" ]; then
INSTALL_TYPE="vendored"
INSTALL_DIR=".claude/skills/data-stack"
elif [ -d "$HOME/.claude/skills/data-stack" ]; then
INSTALL_TYPE="vendored-global"
INSTALL_DIR="$HOME/.claude/skills/data-stack"
else
echo "ERROR: data-stack not found"
exit 1
fi
echo "Install type: $INSTALL_TYPE at $INSTALL_DIR"
OLD_VERSION=$(cat "$INSTALL_DIR/VERSION" 2>/dev/null || echo "unknown")
For git installs (global-git, local-git):
cd "$INSTALL_DIR"
STASH_OUTPUT=$(git stash 2>&1)
git fetch origin
git reset --hard origin/main
./install.sh
If $STASH_OUTPUT contains "Saved working directory", warn the user: "Note: local changes were stashed. Run git stash pop in the skill directory to restore them."
For vendored installs (vendored, vendored-global):
PARENT=$(dirname "$INSTALL_DIR")
TMP_DIR=$(mktemp -d)
git clone --depth 1 https://github.com/Upsolve-Labs/data-stack.git "$TMP_DIR/data-stack"
mv "$INSTALL_DIR" "$INSTALL_DIR.bak"
mv "$TMP_DIR/data-stack" "$INSTALL_DIR"
cd "$INSTALL_DIR" && ./install.sh
rm -rf "$INSTALL_DIR.bak" "$TMP_DIR"
After upgrading the primary install, check if there's also a local copy in the current project that needs updating:
_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
LOCAL_UPSTACK=""
if [ -n "$_ROOT" ] && [ -d "$_ROOT/.claude/skills/data-stack" ]; then
_RESOLVED_LOCAL=$(cd "$_ROOT/.claude/skills/data-stack" && pwd -P)
_RESOLVED_PRIMARY=$(cd "$INSTALL_DIR" && pwd -P)
if [ "$_RESOLVED_LOCAL" != "$_RESOLVED_PRIMARY" ]; then
LOCAL_UPSTACK="$_ROOT/.claude/skills/data-stack"
fi
fi
echo "LOCAL_UPSTACK=$LOCAL_UPSTACK"
If LOCAL_UPSTACK is non-empty, update it by copying from the freshly-upgraded primary install:
mv "$LOCAL_UPSTACK" "$LOCAL_UPSTACK.bak"
cp -Rf "$INSTALL_DIR" "$LOCAL_UPSTACK"
rm -rf "$LOCAL_UPSTACK/.git"
cd "$LOCAL_UPSTACK" && ./install.sh
rm -rf "$LOCAL_UPSTACK.bak"
Tell user: "Also updated vendored copy at $LOCAL_UPSTACK — commit .claude/skills/data-stack/ when you're ready."
mkdir -p "${DATA_STACK_STATE_DIR:-$HOME/.data-stack}"
echo "$OLD_VERSION" > "${DATA_STACK_STATE_DIR:-$HOME/.data-stack}/just-upgraded-from"
rm -f "${DATA_STACK_STATE_DIR:-$HOME/.data-stack}/last-update-check"
rm -f "${DATA_STACK_STATE_DIR:-$HOME/.data-stack}/update-snoozed"
Read $INSTALL_DIR/CHANGELOG.md. Find all version entries between the old version and the new version. Summarize as 5-7 bullets grouped by theme. Focus on user-facing changes.
Format:
data-stack v{new} — upgraded from v{old}!
What's new:
- [bullet 1]
- [bullet 2]
- ...
Happy shipping!
After showing What's New, continue with whatever skill the user originally invoked. The upgrade is done — no further action needed.
When invoked directly as /upgrade (not from a preamble), follow Steps 2-6 above. If already on the latest version, tell the user: "You're already on the latest version (v{version})."