Setup
On first use, read setup.md and align activation behavior and risk boundaries before proposing notebook changes.
When to Use
User needs Google Colab notebook work that must be reproducible, not one-off trial and error. Agent handles runtime setup, package and dependency hygiene, data import and export flows, debugging failures, and experiment tracking.
Architecture
Memory lives in ~/google-colab/. See memory-template.md for setup and status values.
CODEBLOCK0
Quick Reference
Use the smallest relevant file for the active task.
| Topic | File |
|---|
| Setup and activation behavior | INLINECODE3 |
| Memory and local templates |
memory-template.md |
| Notebook structure and cell contracts |
notebook-architecture.md |
| Runtime setup, pinning, and restart recovery |
runtime-playbook.md |
| Data import, export, and schema checks |
data-io-patterns.md |
| Debugging triage and failure recovery |
debugging-runbook.md |
| Experiment log format and promotion rules |
experiment-log-template.md |
Requirements
- - For diagnostics and lightweight API checks:
curl, INLINECODE11 - For notebook execution: Google account with Colab access
- For dataset mounting: explicit permission for Drive, GCS, or external endpoints
Never ask users to paste API keys, OAuth refresh tokens, or private dataset credentials into chat.
Data Storage
Local operational notes stay in ~/google-colab/:
- - notebook inventory with objective, owner, and current status
- runtime and dependency decisions with pinned versions
- dataset and schema validation history
- experiment outcomes and unresolved risks
Core Rules
1. Start with Objective, Constraints, and Exit Criteria
Before writing notebook steps, identify:
- - objective: prototype, benchmark, fine-tuning, teaching, or production prep
- constraints: runtime tier, budget, execution time, and data availability
- exit criteria: metric threshold, artifact output, or decision checkpoint
Without explicit exit criteria, notebook sessions drift and become hard to evaluate.
2. Design Notebook Cells as Contracts
Each cell should have a contract:
- - inputs required and where they come from
- deterministic output shape and validation check
- failure mode and fallback behavior
Treat hidden state between cells as technical debt and document every state dependency.
3. Pin Runtime and Dependency State
Any runnable plan must define:
- - Python version and runtime class (CPU, T4, L4, A100 when relevant)
- pinned package versions for non-standard libraries
- rehydration steps after runtime disconnect or restart
Never assume a fresh runtime matches previous package state.
4. Validate Data Paths and Schema Before Training or Evaluation
Before expensive operations:
- - verify mount success and path existence
- sample and validate schema and null patterns
- block execution when split boundaries or label columns are ambiguous
Fast schema checks prevent long failed runs and invalid metrics.
5. Make Cost and Time Guardrails Explicit
For any medium or high-cost run:
- - estimate runtime duration and checkpoint intervals
- define early-stop conditions and budget cutoff
- recommend smaller dry-run dataset before full execution
No full-scale run should start without budget and cutoff rules.
6. Triage Failures by Layer, Not by Guessing
Debug in layers:
- 1. runtime health and package import layer
- data loading and preprocessing layer
- model logic and training loop layer
- evaluation and artifact export layer
Layered triage shortens incident resolution and avoids random patching.
7. Log Reproducibility Evidence in Every Significant Run
For each meaningful run, capture:
- - notebook id or link, runtime class, seed, and dependency snapshot
- dataset version or timestamp and split method
- primary metric result and whether exit criteria passed
If reproducibility evidence is missing, treat conclusions as provisional.
Common Traps
- - Installing packages ad hoc across cells without pins -> results differ after runtime reconnect
- Using absolute local paths copied from old sessions -> file not found during replay
- Training before schema and null validation -> wasted GPU time and misleading metrics
- Mixing exploratory and production cells in one notebook -> brittle execution order
- Treating cached outputs as fresh ground truth -> stale evaluation and wrong decisions
- Ignoring random seeds and data splits -> impossible to compare experiment outcomes
- Exporting artifacts without metadata -> model files cannot be audited later
External Endpoints
| Endpoint | Data Sent | Purpose |
|---|
| https://colab.research.google.com | Notebook execution metadata and selected runtime actions | Interactive notebook execution and runtime control |
| https://www.googleapis.com |
File identifiers and requested object payloads | Google Drive and related API interactions |
| https://storage.googleapis.com | Dataset or artifact object requests | Read or write objects in Google Cloud Storage |
| https://pypi.org | Package names and version requests | Python dependency installation and version resolution |
No other data should be sent externally unless the user explicitly configures additional systems.
Security & Privacy
Data that leaves your machine:
- - notebook payloads and runtime metadata required by Colab services
- selected file and object metadata required for Drive or GCS operations
- package lookup requests for dependency installation
Data that stays local:
- - workflow memory and decision logs under INLINECODE13
- incident notes, experiment summaries, and validation evidence
This skill does NOT:
- - request or store raw secrets in conversation text
- execute high-cost runs without explicit guardrails
- bypass user-defined data boundaries or compliance rules
Trust
This skill relies on Google Colab, Google APIs, and package repositories used during notebook setup.
Only install and run it if you trust those systems with your code and data.
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
gcp - Plan cloud workloads, storage, and service boundaries for Google environments - INLINECODE16 - Design resilient API contracts for data and model integrations
- INLINECODE17 - Build robust tabular data transformations and validation pipelines
- INLINECODE18 - Improve numerical computation patterns and vectorized operations
- INLINECODE19 - Convert repeatable notebook steps into reliable automation workflows
Feedback
- - If useful: INLINECODE20
- Stay updated: INLINECODE21
技能名称: Google Colab
详细描述:
设置
首次使用时,请阅读 setup.md,并在提出笔记本修改建议前对齐激活行为与风险边界。
使用时机
用户需要可复现的 Google Colab 笔记本工作,而非一次性试错。代理负责运行时设置、包与依赖管理、数据导入导出流程、调试故障以及实验追踪。
架构
记忆存储在 ~/google-colab/ 目录下。参见 memory-template.md 了解设置与状态值。
text
~/google-colab/
|-- memory.md # 激活偏好、约束条件和当前目标
|-- notebooks.md # 笔记本注册表,包含每个笔记本的所有者与目标
|-- runtimes.md # 运行时选择、依赖锁定与重启历史
|-- datasets.md # 数据源映射、挂载路径与验证说明
|-- incidents.md # 错误时间线、根本原因与修复方案
-- experiments.md # 假设、指标与可复现性证据
快速参考
针对当前任务,使用最小相关文件。
| 主题 | 文件 |
|---|
| 设置与激活行为 | setup.md |
| 记忆与本地模板 |
memory-template.md |
| 笔记本结构与单元格契约 | notebook-architecture.md |
| 运行时设置、锁定与重启恢复 | runtime-playbook.md |
| 数据导入、导出与模式检查 | data-io-patterns.md |
| 调试分类与故障恢复 | debugging-runbook.md |
| 实验日志格式与升级规则 | experiment-log-template.md |
要求
- - 诊断与轻量级 API 检查:curl、jq
- 笔记本执行:拥有 Colab 访问权限的 Google 账号
- 数据集挂载:对 Drive、GCS 或外部端点的明确权限
切勿要求用户将 API 密钥、OAuth 刷新令牌或私有数据集凭据粘贴到聊天中。
数据存储
本地操作记录保存在 ~/google-colab/ 目录下:
- - 笔记本清单,包含目标、所有者与当前状态
- 运行时与依赖决策,附带锁定版本
- 数据集与模式验证历史
- 实验结果与未解决风险
核心规则
1. 从目标、约束与退出标准开始
在编写笔记本步骤之前,明确:
- - 目标:原型、基准测试、微调、教学或生产准备
- 约束:运行时层级、预算、执行时间与数据可用性
- 退出标准:指标阈值、产物输出或决策检查点
没有明确的退出标准,笔记本会话会偏离方向,难以评估。
2. 将笔记本单元格设计为契约
每个单元格应有一个契约:
- - 所需输入及其来源
- 确定的输出形状与验证检查
- 故障模式与回退行为
将单元格之间的隐藏状态视为技术债务,并记录每个状态依赖。
3. 锁定运行时与依赖状态
任何可执行的计划必须定义:
- - Python 版本与运行时类别(相关时包括 CPU、T4、L4、A100)
- 非标准库的锁定包版本
- 运行时断开或重启后的重新水化步骤
切勿假设新的运行时会与之前的包状态一致。
4. 在训练或评估前验证数据路径与模式
在执行昂贵操作之前:
- - 验证挂载成功与路径存在
- 采样并验证模式与空值模式
- 当分割边界或标签列不明确时阻止执行
快速模式检查可避免长时间失败运行与无效指标。
5. 明确成本与时间护栏
对于任何中高成本运行:
- - 估算运行时长与检查点间隔
- 定义早停条件与预算截止点
- 建议在完整执行前先进行小规模试运行数据集
没有预算与截止规则,不应启动全规模运行。
6. 按层分类故障,而非猜测
按层调试:
- 1. 运行健康与包导入层
- 数据加载与预处理层
- 模型逻辑与训练循环层
- 评估与产物导出层
分层分类可缩短事件解决时间,避免随机修补。
7. 在每次重要运行中记录可复现性证据
对于每次有意义的运行,记录:
- - 笔记本 ID 或链接、运行时类别、种子与依赖快照
- 数据集版本或时间戳以及分割方法
- 主要指标结果以及是否通过退出标准
如果缺少可复现性证据,将结论视为临时性的。
常见陷阱
- - 在单元格间临时安装包而不锁定 -> 运行时重连后结果不同
- 使用从旧会话复制的绝对本地路径 -> 重放时文件未找到
- 在模式与空值验证前训练 -> 浪费 GPU 时间并产生误导性指标
- 将探索性与生产单元格混合在一个笔记本中 -> 脆弱的执行顺序
- 将缓存输出视为真实数据 -> 过时的评估与错误决策
- 忽略随机种子与数据分割 -> 无法比较实验结果
- 导出产物时不附带元数据 -> 模型文件后续无法审计
外部端点
| 端点 | 发送数据 | 用途 |
|---|
| https://colab.research.google.com | 笔记本执行元数据与选定的运行时操作 | 交互式笔记本执行与运行时控制 |
| https://www.googleapis.com |
文件标识符与请求的对象负载 | Google Drive 及相关 API 交互 |
| https://storage.googleapis.com | 数据集或产物对象请求 | 在 Google Cloud Storage 中读写对象 |
| https://pypi.org | 包名称与版本请求 | Python 依赖安装与版本解析 |
除非用户明确配置额外系统,否则不应向外部发送其他数据。
安全与隐私
离开您机器的数据:
- - Colab 服务所需的笔记本负载与运行时元数据
- Drive 或 GCS 操作所需的选定文件与对象元数据
- 依赖安装的包查找请求
保留在本地数据:
- - ~/google-colab/ 下的工作流记忆与决策日志
- 事件记录、实验摘要与验证证据
此技能不会:
- - 在对话文本中请求或存储原始密钥
- 在没有明确护栏的情况下执行高成本运行
- 绕过用户定义的数据边界或合规规则
信任
此技能依赖于笔记本设置期间使用的 Google Colab、Google API 与包仓库。
仅当您信任这些系统处理您的代码与数据时,才安装并运行它。
相关技能
如果用户确认,使用 clawhub install
安装:
- - gcp - 为 Google 环境规划云工作负载、存储与服务边界
- api - 为数据与模型集成设计弹性 API 契约
- pandas - 构建稳健的表格数据转换与验证管道
- numpy - 改进数值计算模式与向量化操作
- automate - 将可重复的笔记本步骤转换为可靠的自动化工作流
反馈
- - 如果有用:clawhub star google-colab
- 保持更新:clawhub sync