Cruncher Skill
Guides users through Crunch competition lifecycle: setup, quickstarter discovery, solution development, local testing, and submission.
Prerequisites
- - Python 3.9+ with
venv module (included in standard Python) - INLINECODE1 for package installation
Package Installation
This skill installs Python packages from PyPI into isolated virtual environments:
| Package | Source | Purpose |
|---|
| INLINECODE2 | PyPI | CrunchDAO competition CLI (setup, test, submit) |
| INLINECODE3 |
PyPI | Notebook support (optional) |
|
ipykernel |
PyPI | Jupyter kernel registration (optional) |
| Competition SDKs (e.g.
crunch-synth,
birdgame) | PyPI | Competition-specific libraries (varies) |
Agent rules for package installation:
- - Always use a virtual environment — never install into system Python
- Only install known packages listed above or referenced in competition docs (PACKAGES.md)
- Ask the user before installing any package not listed here
- All packages are from PyPI — no custom URLs, no
--index-url overrides, no .whl files from unknown sources
Credentials
Submission Token (required for setup & submit)
- - How to get: User logs into CrunchDAO Hub, navigates to the competition's submit page (
/competitions/<competition>/submit), and copies their token - How it's used: Passed once via
--token <TOKEN> during INLINECODE11 - Persistence: After setup, the CLI stores the token in the project's
.crunch/ config directory. All subsequent commands (crunch test, crunch push, crunch download) authenticate automatically — no need to pass the token again - If token expires: Run
crunch update-token inside the project directory to refresh it
Agent rules for tokens:
- - Always ask the user to provide the token — never assume, guess, or reuse tokens from other projects
- Never write tokens into source files, scripts, notebooks, or any committed file
- Never log or echo tokens in shell output (use
--token <TOKEN> placeholder in examples shown to user) - Tokens are user-specific and project-scoped — each
crunch setup call requires the user to supply one
GitHub API (optional, unauthenticated)
- - Used only for browsing quickstarter listings via
api.github.com (public repo, no auth needed) - Rate-limited to 60 requests/hour per IP; sufficient for normal use
Network Access
| Operation | Requires network | Endpoint |
|---|
| INLINECODE20 | Yes | hub.crunchdao.com |
| INLINECODE21 |
Yes | hub.crunchdao.com |
|
crunch download | Yes | hub.crunchdao.com |
|
crunch test |
No | Local only |
|
crunch list | Yes | hub.crunchdao.com |
|
pip install | Yes | pypi.org |
| Quickstarter browsing | Yes | api.github.com |
Quick Setup
Each competition needs its own virtual environment (dependencies can conflict).
CODEBLOCK0
For competition-specific packages and full examples, see references/competition-setup.md.
Core Workflow
1. Discover
CODEBLOCK1
2. Explain
Read the quickstarter code (
main.py or notebook) and competition's SKILL.md/README.md. Provide walkthrough covering: Goal, Interface, Data flow, Approach, Scoring, Constraints, Limitations, Improvement ideas.
3. Propose Improvements
Analyze current approach, cross-reference competition docs (SKILL.md, LITERATURE.md, PACKAGES.md), generate concrete code suggestions:
- - Model: mixture densities, NGBoost, quantile regression, ensembles
- Features: volatility regimes, cross-asset correlation, seasonality
- Architecture: online learning, Bayesian updating, horizon-specific models
4. Test
CODEBLOCK2
5. Submit
CODEBLOCK3
Phrase Mapping
| User says | Action |
|---|
| INLINECODE27 | INLINECODE28 |
| INLINECODE29 |
Fetch from GitHub API |
|
set up <competition> | Full workspace setup |
|
download the data |
crunch download |
|
get the <name> quickstarter |
crunch quickstarter --name |
|
explain this quickstarter | Structured code walkthrough |
|
propose improvements | Analyze and suggest code improvements |
|
test my solution |
crunch test |
|
compare with baseline | Run both, side-by-side results |
|
submit my solution |
crunch push |
Important Rules
- - Entrypoint must be
main.py (default for crunch push/crunch test) - Model files go in
resources/ directory - Respect competition interface and constraints (time limits, output format)
- Ask before installing new packages
Reference
Cruncher 技能
引导用户完成 Crunch 竞赛生命周期:设置、快速启动器发现、解决方案开发、本地测试和提交。
前提条件
- - Python 3.9+ 且包含 venv 模块(标准 Python 自带)
- 用于包安装的 pip
包安装
该技能从 PyPI 安装 Python 包到隔离的虚拟环境中:
| 包 | 来源 | 用途 |
|---|
| crunch-cli | PyPI | CrunchDAO 竞赛 CLI(设置、测试、提交) |
| jupyter |
PyPI | Notebook 支持(可选) |
| ipykernel |
PyPI | Jupyter 内核注册(可选) |
| 竞赛 SDK(例如 crunch-synth、birdgame) | PyPI | 竞赛专用库(因竞赛而异) |
包安装的代理规则:
- - 始终使用虚拟环境 — 切勿安装到系统 Python 中
- 仅安装上述已知包或竞赛文档(PACKAGES.md)中引用的包
- 在安装未列出的包之前询问用户
- 所有包均来自 PyPI — 无自定义 URL,无 --index-url 覆盖,无来自未知来源的 .whl 文件
凭据
提交令牌(设置和提交必需)
- - 获取方式: 用户登录 CrunchDAO Hub,导航到竞赛的提交页面(/competitions//submit),并复制其令牌
- 使用方式: 在 crunch setup 期间通过 --token 一次性传递
- 持久化: 设置后,CLI 将令牌存储在项目的 .crunch/ 配置目录中。所有后续命令(crunch test、crunch push、crunch download)自动进行身份验证 — 无需再次传递令牌
- 如果令牌过期: 在项目目录内运行 crunch update-token 以刷新
令牌的代理规则:
- - 始终要求用户提供令牌 — 切勿假设、猜测或重复使用其他项目的令牌
- 切勿将令牌写入源文件、脚本、notebook 或任何已提交的文件中
- 切勿在 shell 输出中记录或回显令牌(在向用户显示的示例中使用 --token 占位符)
- 令牌是用户特定且项目范围的 — 每次 crunch setup 调用都需要用户提供一个
GitHub API(可选,未经身份验证)
- - 仅用于通过 api.github.com 浏览快速启动器列表(公共仓库,无需身份验证)
- 每个 IP 每小时限制 60 个请求;正常使用足够
网络访问
| 操作 | 需要网络 | 端点 |
|---|
| crunch setup | 是 | hub.crunchdao.com |
| crunch push |
是 | hub.crunchdao.com |
| crunch download | 是 | hub.crunchdao.com |
| crunch test |
否 | 仅本地 |
| crunch list | 是 | hub.crunchdao.com |
| pip install | 是 | pypi.org |
| 快速启动器浏览 | 是 | api.github.com |
快速设置
每个竞赛需要自己的虚拟环境(依赖项可能冲突)。
bash
mkdir -p ~/.crunch/workspace/competitions/
cd ~/.crunch/workspace/competitions/
python -m venv .venv && source .venv/bin/activate
pip install crunch-cli jupyter ipykernel --upgrade --quiet --progress-bar=off
python -m ipykernel install --user --name --display-name Crunch -
从以下地址获取令牌:https://hub.crunchdao.com/competitions//submit
crunch setup
--token
cd -
有关竞赛专用包和完整示例,请参阅 references/competition-setup.md。
核心工作流程
1. 发现
bash
crunch list # 列出竞赛
2. 解释
阅读快速启动器代码(main.py 或 notebook)和竞赛的 SKILL.md/README.md。提供涵盖以下内容的逐步讲解:目标、接口、数据流、方法、评分、约束、限制、改进思路。
3. 提出改进建议
分析当前方法,交叉引用竞赛文档(SKILL.md、LITERATURE.md、PACKAGES.md),生成具体的代码建议:
- - 模型:混合密度、NGBoost、分位数回归、集成
- 特征:波动率制度、跨资产相关性、季节性
- 架构:在线学习、贝叶斯更新、特定周期模型
4. 测试
bash
crunch test # 本地测试解决方案
5. 提交
bash
crunch test # 始终先测试
crunch push -m 描述 # 提交
短语映射
| 用户说 | 操作 |
|---|
| 有哪些竞赛可用 | crunch list |
| 显示 <名称> 的快速启动器 |
从 GitHub API 获取 |
| 设置 <竞赛> | 完整工作区设置 |
| 下载数据 | crunch download |
| 获取 <名称> 快速启动器 | crunch quickstarter --name |
| 解释这个快速启动器 | 结构化代码讲解 |
| 提出改进建议 | 分析并建议代码改进 |
| 测试我的解决方案 | crunch test |
| 与基线比较 | 运行两者,并排显示结果 |
| 提交我的解决方案 | crunch push |
重要规则
- - 入口点必须是 main.py(crunch push/crunch test 的默认值)
- 模型文件放在 resources/ 目录中
- 遵守竞赛接口和约束(时间限制、输出格式)
- 安装新包前先询问
参考