重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
asciinema-streaming-backup by terrylica/cc-skills
npx skills add https://github.com/terrylica/cc-skills --skill asciinema-streaming-backup将 asciinema 录制内容流式传输到 GitHub 并自动进行 brotli 归档的完整系统。使用空闲检测进行智能分块,使用 zstd 进行可串联的流式压缩,并使用 GitHub Actions 进行最终的 brotli 再压缩。
在以下情况下使用此技能:
平台 : macOS, Linux 隔离性 : 使用 Git 孤立分支(独立历史记录,不会污染主分支)
┌─────────────────┐ zstd 分块 ┌─────────────────┐ Actions ┌─────────────────┐
│ asciinema rec │ ──────────────────▶ │ GitHub 孤立 │ ───────────────▶ │ brotli 归档 │
│ + 空闲分块器 │ (可串联) │ gh-recordings │ │ (300x 压缩) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ 空闲 ≥30s 触发分块 │ 独立历史记录
▼ │ 无法向主分支发起 PR
~/asciinema_recordings/ ▼
└── repo-name/ .github/workflows/
└── chunks/*.zst └── recompress.yml
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 组件 | 必需 | 安装方法 | 版本 |
|---|---|---|---|
| asciinema CLI | 是 | brew install asciinema | 3.0+ (Rust) |
| zstd | 是 | brew install zstd | 任意 |
| brotli | 是 | brew install brotli | 任意 |
| git | 是 | 预安装 | 2.20+ |
| gh CLI | 是 | brew install gh | 任意 |
| fswatch | 可选 | brew install fswatch | 用于实时监控 |
验证所有工具是否已安装,如果缺失则提供自我纠正。运行预检检查脚本,然后通过 AskUserQuestion 为缺失的工具提供安装选项。
完整 preflight-check.sh 脚本请参见 设置脚本。
自我纠正 : 如果工具缺失,则生成安装命令并提供运行选项。
从 5 个来源(SSH 配置、SSH 密钥、gh CLI、mise 环境、git 配置)检测可用的 GitHub 账户,并让用户选择使用哪一个。
检测脚本、评分逻辑和 AskUserQuestion 流程请参见 账户与仓库检测。
检测当前的 git 仓库上下文(CURRENT_REPO_OWNER、CURRENT_REPO_NAME、DETECTED_FROM),为阶段 2 提供智能默认值。
检测脚本请参见 账户与仓库检测。
收集基本配置:仓库 URL(使用阶段 1.5 的自动检测)、录制目录和分支名称。
所有 AskUserQuestion 序列和 URL 规范化逻辑请参见 配置参考。
允许自定义压缩和行为参数:
| 参数 | 默认值 | 范围 |
|---|---|---|
| 空闲阈值 | 30s | 5-300s |
| zstd 级别 | 3 | 1-22 |
| Brotli 级别 | 9 | 1-11 |
| 自动推送 | 是 | 是/否 |
| 轮询间隔 | 5s | 2s, 5s, 10s |
所有 AskUserQuestion 序列请参见 配置参考。
使用 GitHub Actions 工作流创建或配置孤立分支。首先检查分支是否已存在,并提供克隆/重置/验证选项。
关键操作:
git ls-remote 检查远程是否存在该分支完整 setup-orphan-branch.sh 脚本请参见 设置脚本。完整 recompress.yml Actions 工作流请参见 GitHub 工作流。
配置本地目录并生成定制的 idle-chunker.sh,其中嵌入了来自阶段 3 的用户参数。
关键操作:
~/asciinema_recordings/<repo>/idle-chunker.shClaude 自主执行 8 项测试,并显示格式化结果。只有 2 项测试需要用户操作(录制测试、分块器实时测试)。
| 测试类别 | 数量 | 是否自主? |
|---|---|---|
| 工具预检 | 5 | 是 |
| 压缩往返测试 | 3 | 是 |
| 仓库验证 | 4 | 是 |
| GitHub Actions 触发 | 1 | 是 |
| 录制测试 | 1 | 否 (用户) |
| 分块器实时测试 | 1 | 否 (用户) |
完整的验证脚本、需要用户参与的测试流程和故障排除表请参见 自主验证。
/usr/bin/env bash << 'PREFLIGHT_EOF'
# 1. 检查要求
for tool in asciinema zstd brotli git gh; do
command -v "$tool" &>/dev/null && echo "$tool: OK" || echo "$tool: MISSING"
done
# 2. 创建孤立分支(替换为你的仓库)
REPO="git@github.com:YOUR/REPO.git"
./setup-orphan-branch.sh "$REPO"
# 3. 验证设置
./validate-setup.sh "$HOME/asciinema_recordings/REPO"
PREFLIGHT_EOF
/usr/bin/env bash << 'SKILL_SCRIPT_EOF'
# 终端 1: 开始录制
WORKSPACE=$(basename "$PWD")
asciinema rec $PWD/tmp/${WORKSPACE}_$(date +%Y-%m-%d_%H-%M).cast
# 终端 2: 启动空闲分块器
~/asciinema_recordings/REPO/idle-chunker.sh $PWD/tmp/${WORKSPACE}_*.cast
SKILL_SCRIPT_EOF
| 决策 | 理由 |
|---|---|
| 使用 zstd 进行流式传输 | 支持帧串联(brotli 不支持) |
| 使用 brotli 进行归档 | 最佳压缩比(对于 .cast 文件约 300 倍) |
| 使用孤立分支 | 完全隔离,不会污染主分支历史记录 |
| 基于空闲的分块 | 语义断点,而非输出中途分割 |
| 浅克隆 | 最小化磁盘使用,无法意外访问主分支 |
| 30 秒空闲阈值 | 平衡分块频率与语义完整性 |
常见问题及修复方法请参见 故障排除指南。
修改此技能后:
每周安装次数
65
仓库
GitHub 星标数
26
首次出现
2026年1月24日
安全审计
安装于
opencode62
gemini-cli60
codex60
claude-code59
cursor58
github-copilot58
Complete system for streaming asciinema recordings to GitHub with automatic brotli archival. Uses idle-detection for intelligent chunking, zstd for concatenatable streaming compression, and GitHub Actions for final brotli recompression.
Use this skill when:
Platform : macOS, Linux Isolation : Uses Git orphan branch (separate history, cannot pollute main)
┌─────────────────┐ zstd chunks ┌─────────────────┐ Actions ┌─────────────────┐
│ asciinema rec │ ──────────────────▶ │ GitHub Orphan │ ───────────────▶ │ brotli archive │
│ + idle-chunker │ (concatenatable) │ gh-recordings │ │ (300x compress)│
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ Idle ≥30s triggers chunk │ Separate history
▼ │ Cannot PR to main
~/asciinema_recordings/ ▼
└── repo-name/ .github/workflows/
└── chunks/*.zst └── recompress.yml
| Component | Required | Installation | Version |
|---|---|---|---|
| asciinema CLI | Yes | brew install asciinema | 3.0+ (Rust) |
| zstd | Yes | brew install zstd | Any |
| brotli | Yes | brew install brotli | Any |
| git | Yes | Pre-installed | 2.20+ |
Verify all tools installed, offer self-correction if missing. Run the preflight check script, then AskUserQuestion to offer installation for missing tools.
See Setup Scripts for the complete preflight-check.sh script.
Self-Correction : If tools are missing, generate installation command and offer to run it.
Detect available GitHub accounts from 5 sources (SSH config, SSH keys, gh CLI, mise env, git config) and let user choose which to use.
See Account & Repository Detection for the detection script, scoring logic, and AskUserQuestion flow.
Detect current git repository context (CURRENT_REPO_OWNER, CURRENT_REPO_NAME, DETECTED_FROM) to provide intelligent defaults for Phase 2.
See Account & Repository Detection for the detection script.
Gather essential configuration: repository URL (with auto-detection from Phase 1.5), recording directory, and branch name.
See Configuration Reference for all AskUserQuestion sequences and URL normalization logic.
Allow customization of compression and behavior parameters:
| Parameter | Default | Range |
|---|---|---|
| Idle threshold | 30s | 5-300s |
| zstd level | 3 | 1-22 |
| Brotli level | 9 | 1-11 |
| Auto-push | Yes | Yes/No |
| Poll interval | 5s | 2s, 5s, 10s |
See Configuration Reference for all AskUserQuestion sequences.
Create or configure the orphan branch with GitHub Actions workflow. Checks for existing branch first and offers clone/reset/verify options.
Key actions:
git ls-remoteSee Setup Scripts for the complete setup-orphan-branch.sh script. See GitHub Workflow for the full recompress.yml Actions workflow.
Configure local directory and generate customized idle-chunker.sh with user parameters embedded from Phase 3.
Key actions:
~/asciinema_recordings/<repo>/idle-chunker.sh with embedded configurationSee Setup Scripts for local setup scripts. See Idle Chunker for the complete chunker implementation.
Claude executes 8 tests autonomously, displaying formatted results. Only 2 tests require user action (recording test, chunker live test).
| Test Category | Count | Autonomous? |
|---|---|---|
| Tool preflight | 5 | Yes |
| Compression round-trip | 3 | Yes |
| Repository validation | 4 | Yes |
| GitHub Actions trigger | 1 | Yes |
| Recording test | 1 | No (USER) |
| Chunker live test | 1 | No (USER) |
See Autonomous Validation for the complete validation script, user-required test flows, and troubleshooting table.
/usr/bin/env bash << 'PREFLIGHT_EOF'
# 1. Check requirements
for tool in asciinema zstd brotli git gh; do
command -v "$tool" &>/dev/null && echo "$tool: OK" || echo "$tool: MISSING"
done
# 2. Create orphan branch (replace with your repo)
REPO="git@github.com:YOUR/REPO.git"
./setup-orphan-branch.sh "$REPO"
# 3. Validate setup
./validate-setup.sh "$HOME/asciinema_recordings/REPO"
PREFLIGHT_EOF
/usr/bin/env bash << 'SKILL_SCRIPT_EOF'
# Terminal 1: Start recording
WORKSPACE=$(basename "$PWD")
asciinema rec $PWD/tmp/${WORKSPACE}_$(date +%Y-%m-%d_%H-%M).cast
# Terminal 2: Start idle-chunker
~/asciinema_recordings/REPO/idle-chunker.sh $PWD/tmp/${WORKSPACE}_*.cast
SKILL_SCRIPT_EOF
| Decision | Rationale |
|---|---|
| zstd for streaming | Supports frame concatenation (brotli doesn't) |
| brotli for archival | Best compression ratio (~300x for .cast files) |
| Orphan branch | Complete isolation, can't pollute main history |
| Idle-based chunking | Semantic breakpoints, not mid-output splits |
| Shallow clone | Minimal disk usage, can't accidentally access main |
| 30s idle threshold | Balances chunk frequency vs semantic completeness |
See Troubleshooting Guide for common issues and fixes.
After modifying this skill:
Weekly Installs
65
Repository
GitHub Stars
26
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
opencode62
gemini-cli60
codex60
claude-code59
cursor58
github-copilot58
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
48,700 周安装
| Yes |
brew install gh |
| Any |
| fswatch | Optional | brew install fswatch | For real-time |