Lab logo

Lab

Community
beihaizzz
lab

大学生时间拯救计划之LabMate:指导你完成实验或帮你写实验报告。 Trigger: `/lab` command. Subcommands: `-init`, `-work`, `-guide`, `-update`, `-feedback`, `-help`. Keywords: lab report, 实验报告, experiment report, /lab-report, /lab, labmate, 实验指导, .docx template, .pdf guide, experiment writeup.

Overview

Publisherbeihaizzz
Repositorylabmate.skill
Skill namelab
Stars
30
Forks
0
Bundled files
45
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 45 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by beihaizzz on GitHub. Read the source before you install it.

Installation

Install the Lab AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/beihaizzz/labmate.skill/tree/main/lab-report
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/beihaizzz/labmate.skill.git /tmp/labmate.skill
mkdir -p .claude/skills
cp -r /tmp/labmate.skill/lab-report .claude/skills/lab
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Lab in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Lab on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Lab is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

LabMate Skill

核心原则

「实事求是。 没有调查就没有发言权。一切判断必须基于实际读取的文件内容, 不可凭经验猜测、不可假设默认值、不可编造实验数据。 遇到不确定的内容,必须先 inspect、先读文件、先问用户, 确认后再行动。对模板格式、字体、字号、对齐方式, 以 inspect_template.py 输出为准,绝不主观臆断。」

硬约束:

  • 不修改原始文件(所有操作在 shutil.copy 副本上)
  • 不覆盖标签单元格(inspect 输出中 is_label=true 的不可写)
  • 不编造实验数据(只填入用户提供或文件读取的数据)
  • 不猜测格式(必须先 inspect_template.py,以输出为准)
  • 同一方案连续 3 次失败后必须换方案(不得继续调参)
  • 准确优先于效率:宁可多做一步验证,不可跳步。不确定时停下来确认,而不是"大概是对的"就继续。违反流程比慢更糟糕。

Overview

大学生时间拯救计划之LabMate — 一个帮你完成实验报告的 OpenCode Skill。

两种模式:

  • Guide Mode:AI 读取实验指导书,展示步骤、同步进度、提醒截图、遇到问题逐步引导
  • Work Mode:AI 读取报告模板,从指导书或实验过程提取内容,填入模板生成 Word 文件

扩展能力:部分实验类型(如 Unity、STM32 开发)可以通过 MCP 扩展 让 LabMate 直接操作实验环境和设备,突破"只能写文档"的边界。查看你的实验类型是否支持 MCP 集成。

Current version: v1.2.2

  • New: 新增 ASCII 连续字符检测 (detect_long_ascii_block) + 生成后验证 (long_line_check) 防止 Word 表格溢出
  • New: 新增诊断指南 (troubleshooting.md)、代码格式规则 (de-ai-style-guide.md)、scope control / 工具复用流程约束

Previous version: v1.2.1

  • Guide Mode: AI reads your experiment guide (PDF/DOCX/PPTX/markitdown), shows all steps, tracks your progress via .labmate/progress.json(旧项目使用 .lab-report/ 也兼容), reminds you to take screenshots at key points, and provides step-by-step help when stuck. Say "继续" to sync progress.
  • Work Mode: AI reads your report template (DOCX with {{placeholders}}), extracts experiment content from Guide Mode progress OR your description, fills the template using docxtpl, and generates a new Word file. Original template is NEVER modified.

Quick Start

  1. Create a folder for your course experiment
  2. Place all materials in it (experiment guide PDF/DOCX/PPTX, report template DOCX)
  3. Open OpenCode in that folder
  4. Run /lab -init to initialize
  5. Start Guide Mode or Work Mode

Commands

所有命令以 /lab 触发:

命令作用
/lab -init初始化项目。自动发现资料、创建 project.md、配置环境。/lab -init -git 启用版本管理
/lab -work强制进入 Work Mode。直接生成实验报告
/lab -guide强制进入 Guide Mode。开始指导实验
/lab -update重新扫描项目目录。用于新增实验或大量文件变更后,刷新 project.md 和 .labmate/config.json
/lab -feedback生成技能优化反馈报告
/lab -upgrade从 GitHub 拉取最新版本更新本地 skill
/lab -fix精确修改报告某一段落(如 /lab -fix 实验原理_2 "新内容")
/lab -help显示所有命令和简要说明

Session Startup Protocol

每次会话开始时(无论 Guide Mode 还是 Work Mode):

  1. Read project.md — 了解课程信息、实验进度、通用配置
  2. Read 学生信息.md — 获取个人信息
  3. Verify key paths — 检查 project.md 中引用的文件是否还存在
  4. If paths stale → 告知用户并更新 project.md

project.md 是 session 的"快速上下文"——读它即可了解整个项目状态,无需重新扫描整个目录。

/lab -init

Initializes the project. Auto-discovers course materials, finds/creates 学生信息.md, creates .labmate/ directory. Supports -git for automatic version control.

/lab -upgrade — 更新 Skill 版本

从 GitHub(https://github.com/beihaizzz/labmate.skill)拉取最新版本更新本地 skill。

执行逻辑:

  1. 检测当前运行的平台(Claude Code / OpenCode / Cursor / 其他)

  2. 根据平台定位本地 skill 目录:

    • Claude Code: ~/.claude/skills/lab/
    • OpenCode: 读取 ~/.config/opencode/opencode.json 中的 skill 路径
    • Cursor: .cursor/rules/ 或 ~/.claude/skills/lab/
    • 其他: 请用户提供 skill 目录的绝对路径
  3. git -C skill目录 pull origin main

  4. 确认更新后的版本号(读取 SKILL.md 中 Current version 行) 展示 git log --oneline -3

  5. 告知用户更新结果:旧版本 → 新版本,新增了什么

/lab -feedback — 归因反馈

只归因,不建议。输出格式:问题描述 + 归因模块 + 责任方 + 用户介入方式。

触发后 AI 自动:

  1. 读取 git 历史
  2. 读取已有反馈文件
  3. 扫描项目状态

生成反馈报告前,AI 必须逐项检查并记录结果。 任何一项未通过,在报告开头汇总列出:

检查项验证方式违规标记
图片全部 look_at 分析?对比图片文件总数 vs look_at 实际调用次数IMAGE_SKIPPED
inspect_template 已执行?.labmate/template-inspect.json 是否存在INSPECT_MISSING
合并单元格特殊处理?检查 fill 过程中是否有 merge-cell 警告MERGE_UNHANDLED
label cell 未被覆盖?validate_docx.py --inspect 输出LABEL_OVERWRITTEN
报告迭代了几轮?git log 中 fill/fix 相关提交次数ITERATIONS=N
有未确认就修改的内容?对比用户原始请求 vs AI 实际修改范围UNCONFIRMED_CHANGE
有凭经验猜测的数据?在内容中搜索"大概""应该""估计""约"GUESSED_DATA

归因追溯链——每个问题用缩进链展示因果: 截图未 look_at → image-map.json 为 placeholder 模式 → 配图注释靠 AI 猜测 → 用户手动改了 4 处注释

严重度分级:

  • 🟢 低:纯格式问题,用户 5 秒可改
  • 🟡 中:结构损失,需用户知道该加回去什么
  • 🟠 高:内容错误,老师看了扣分
  • 🔴 致命:数据编造,学术诚信问题 问题列表按严重度降序排列。
  1. 生成反馈文件到 .labmate/feedback/ 目录(旧项目 .lab-report/feedback/):
    • feedback_report_vN.md — 可读报告
    • feedback_report_vN.json — 结构化数据

/lab -fix — 段落精确重写

用户发现报告中某段内容需要修改时,无需关闭文件重新生成,直接定位修改。

触发方式:/lab -fix <逻辑ID> "<新内容>"

执行逻辑:

  1. AI 读取 .labmate/section-map.json(由 section_map.py 生成)
  2. 根据逻辑ID(如 实验原理_2)查找对应的单元格坐标(table/row/col)
  3. 构造 cells JSON:[{"table": t, "row": r, "col": c, "text": "新内容"}]
  4. 调用 fill_template.py --cells 仅修改指定单元格,写入报告副本
  5. 自动运行 validate_docx.py 检查修改后报告
  6. 对比修改前后 section-map.json,确认仅目标单元格变化

命令格式:

  • /lab -fix 实验原理_2 "STM32F407的GPIO端口通过AHB1总线时钟使能..."
  • /lab -fix 实验步骤_3 "1. 连接PB0至LED正极\n2. GND接LED负极"

验证机制:

  • label cell 自动跳过(fill_template.py --inspect 保护)
  • 修改失败时回滚,保留原文件

Guide Mode Workflow

See references/guide-mode-workflow.md for detailed workflow.

Summary:

  1. Parse experiment guide → extract all steps
  2. Display all steps with notes and screenshot reminders
  3. Student completes steps independently
  4. AI syncs progress when student says "继续"
  5. When student has questions about a step → step-by-step guidance
  6. Progress saved to .labmate/progress.json

Work Mode Workflow

See references/work-mode-workflow.md for detailed workflow.

Summary:

  1. Confirm metadata: AI asks for experiment date, location, teacher, group members using question tool
  2. Ask style: Offer perfect (detail) or normal (standard, 90+)
  3. Check if .labmate/progress.json exists (from Guide Mode)
  4. Extract experiment data from progress OR ask student to describe
  5. Analyze photos: Scan directory for experiment photos/videos → read/look_at each to extract code values, wiring details, phenomenon
  6. ⭐ Inspect template FIRST: Run scripts/inspect_template.py --input template.docx --format human — dump exact cell-level formatting (font/size/bold/eastAsia/alignment) before writing any code 6b. ⭐ If template has NO {{placeholder}} syntax → run auto_prepare_template.py to inject them automatically → then continue with standard fill
  7. Parse template DOCX → identify {{placeholders}}
  8. Build JSON data context from student info + experiment metadata + photo analysis + inspect data
  9. Call scripts/fill_template.py --inspect .labmate/template-inspect.json to generate report
    • Script auto-preserves label cells (does NOT overwrite "提交文档" etc.)
    • Script applies formatting from inspect data only (no guessing font/size/eastAsia)
    • Post-fill diff check detects accidental overwrites
  10. Generate new Word file (original template untouched)
  11. Git 管理:默认仅报告文件位置(留在 Changes 面板)。--stage 暂存、--commit 提交

File Format Support

FormatReadScript
PDFpdfplumber + pymupdf4llm(扫描件支持 --ocr)scripts/parse_pdf.py
DOCXpython-docxscripts/parse_docx.py
PPTXmarkitdownscripts/parse_pptx.py

Scanned PDFs (image-only) are detected and reported. Ask user whether to skip, attempt --ocr, or enter text manually.

Student Info Management

学生信息.md stores reusable student info:

  • 姓名, 学号, 学院, 专业, 班级
  • Auto-discovered from CWD upward (up to 3 parent dirs)
  • Found? → Auto-load. Not found? → Ask user or create with scripts/student_info.py --create
  • Copy this file to other course folders for reuse

Report Styles

Two styles, both apply de-AI guidelines:

  • normal: 标准实验报告。内容完整、结构清晰、语言规范,老师看了能给 90+ 分。日常使用的主要风格。
  • perfect: 极少数场景使用。尽最大可能详尽,覆盖所有细节和可能情况,适合特别重要的提交。
  • Both: No AI signature words (首先, 其次, 最后...), natural paragraph flow, no bullet lists

Scripts Reference

Run scripts via uv run --with <pkgs> python scripts/<name>.py:

ScriptPurpose
check_deps.pyCheck uv, Python, packages
student_info.pyDiscover/create 学生信息.md
parse_pdf.pyExtract text from PDF
parse_docx.pyParse DOCX + placeholders
parse_pptx.pyExtract text from PPTX
init_project.pyOrchestrate initialization
fill_template.pyFill DOCX template
progress_manager.pyManage progress.json
git_manager.pyGit management (default: report status)
auto_prepare_template.pyAuto-detect labels and inject {{placeholders}} in blank templates
validate_docx.pyValidate generated DOCX report structure

Troubleshooting

  • Chinese text shows as boxes: CJK font not set. Scripts auto-set w:eastAsia but verify with python -c "from docx import Document; ..."
  • Scanned PDF detected: PDF has no text layer. Ask user to provide text version or manually enter content.
  • Placeholders not replaced: Check that template uses {{placeholder}} syntax. scripts/parse_docx.py lists all detected placeholders.
  • Template has no {{placeholder}} syntax: Most university templates use fixed table labels ("姓名", "学号", etc.) without placeholders. Run auto_prepare_template.py to auto-detect labels and inject {{placeholder}} syntax. The script preserves all original formatting.
  • uv not found: Install from https://github.com/astral-sh/uv
  • 不需要手写解析脚本: 项目已包含 PDF/DOCX/PPTX 完整解析脚本。优先使用已有工具。特殊需求时 AI 自行判断。

PowerShell 编码规则(Windows 必读)

绝对禁止以下模式(在 PowerShell 下含中文的 inline Python 会崩溃):

powershell
# ❌ 会导致编码错误,浪费 token
uv run python -c "print('中文')"
uv run python -c "with open('实验.txt') as f: ..."

必须写成文件再执行:

powershell
# ✅ 正确做法
Set-Content script.py "print('中文')" -Encoding UTF8
uv run python script.py

原因: PowerShell 下 python -c 的引号嵌套 + UTF-8 编码有已知 bug,中文必炸。写成文件零成本避免,省去每次重试 + 排查的 token 开销。

临时脚本管理

所有 AI 自动生成的临时 Python 脚本(调试、测试、格式检查等) 必须放在 .labmate/(旧项目 .lab-report/)目录下, 禁止在用户项目根目录或子目录创建。 使用完毕后自行清理。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Lab AI skill do?

大学生时间拯救计划之LabMate:指导你完成实验或帮你写实验报告。 Trigger: `/lab` command. Subcommands: `-init`, `-work`, `-guide`, `-update`, `-feedback`, `-help`. Keywords: lab report, 实验报告, experiment report, /lab-report, /lab, labmate, 实验指导, .docx template, .pdf guide, experiment writeup.

Why use Lab on TypingMind?

Because you install it once and use it with any model. Lab is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Lab in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/beihaizzz/labmate.skill/tree/main/lab-report. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Lab?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Lab?

As many as you like. As long as a model supports skills, you can use Lab with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Lab AI skill free?

It is published on GitHub by beihaizzz. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇