weishao2/tizhuang-agent-skills / skills/tizhuang-local-bank
tizhuang-local-bank
Verified老师的本地题库(Obsidian 兼容,不需要账号或插件):把 PDF 试卷还原成可编辑题目入库、下载题庄知识树并给题目分类、按教材/章节/考点/标签检索、核对后组卷并生成无答案 Word/打印稿与教师答案稿。用于“本地题库、Obsidian 题库、PDF 试卷入库、题目分类、找题、组卷、出 Word 试卷、导出题目包”。仅供教师备课打印,不做学生端。在线取题属于可选的旧 question-bank skill。Teacher-side local question bank: PDF import, knowledge-tree classification, search, paper assembly (DOCX/HTML).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.0 KB |
| agents/openai.yaml | config | 174 B |
| references/conversation-guide.md | markdown | 2.6 KB |
| references/family.md | markdown | 2.0 KB |
| references/install.md | markdown | 4.9 KB |
| references/paper-basket.md | markdown | 5.6 KB |
| references/pdf-import.md | markdown | 5.2 KB |
| references/question-contract.md | markdown | 4.2 KB |
| references/teacher-workspace.md | markdown | 6.2 KB |
| references/tree-and-textbook.md | markdown | 3.1 KB |
| scripts/auto_classify.py | script | 5.3 KB |
| scripts/doctor.py | script | 3.5 KB |
| scripts/docx_export.py | script | 11.0 KB |
| scripts/install_local_bank.py | script | 20.1 KB |
| scripts/local_bank.py | script | 58.0 KB |
| scripts/paper-print.css | other | 2.1 KB |
| scripts/paper_builder.py | script | 11.3 KB |
| scripts/paper_links.py | script | 2.7 KB |
| scripts/pdf_import.py | script | 23.2 KB |
| scripts/requirements.txt | manifest | 150 B |
| scripts/teacher_library.py | script | 15.9 KB |
| scripts/ui_layout.py | script | 7.4 KB |
| version.json | config | 52 B |
scripts/auto_classify.py
View on GitHub"""Conservative offline knowledge matching, with explicit Agent handoff for ambiguity."""
from pathlib import Path
from types import SimpleNamespace
import datetime as dt
import json
import re
import uuid
def suggest(q, nodes):
"""Trust exact named teaching tags, never short keywords occurring in a stem."""
from ui_layout import native_tags
names = {}
for n in nodes.values():
# Obsidian tags replace punctuation with underscores. Apply the same
# normalization to the catalog label, while retaining ambiguity checks.
aliases = {n['name'].strip(), *native_tags([n['name'].strip()])}
for alias in aliases:
names.setdefault(alias, []).append(n)
tags = {str(t).split('/')[-1].strip() for t in q.get('tags', [])}
# Imported website labels are handled by enrich(); here only teacher/Agent tags
# are evidence. A mention of e.g. '圆' in a long word must not classify a question.
matches, ambiguous = [], []
for tag in sorted(tags):
found = names.get(tag, [])
if len(found) == 1:
matches.append((str(found[0]['id']), '已有标签「' + tag + '」与本学科学段知识点完全匹配'))
elif len(found) > 1:
ambiguous.append(tag)
if ambiguous:
return [], '同名知识点有多个位置,需要 Agent 核对:' + '、'.join(ambiguous)
if len(matches) > 12:
return [], '候选知识点超过 12 个,需要核对核心考点'
if matches:
return matches, ''
return [], '缺少可直接对应的考点标签,需要 Agent 阅读题目判断'
def run(bank, args):
import local_bank as lb
from teacher_library import classify
questions = bank.questions()
selected = set(getattr(args, 'ids', None) or [])
batch = getattr(args, 'batch', None)
if batch:
if not re.fullmatch(r'[a-f0-9]{24}', batch):
raise ValueError('PDF 批次编号无效')
manifest = lb.read_json(bank.root / '.bank/imports' / batch / 'manifest.json')
selected = set(manifest.get('imported', {}).values())
if selected and not selected.issubset({q['id'] for q in questions}):
raise ValueError('待分类题目已变化,请刷新后重试')
if batch or selected:
questions = [q for q in questions if q['id'] in selected]
questions = [q for q in questions if not q.get('knowledge_tree_ids')]
if len(questions) > 500:
raise ValueError('一次最多处理 500 道未关联知识点的题目,请按批次分开处理')
items, pending = [], []
for q in questions:
tree_path = bank.root / f".bank/taxonomy/{q.get('subject_id')}-{q.get('phase_id')}.json"
nodes = bank.taxonomy(q['subject_id'], q['phase_id']) if tree_path.exists() else {}
matches, reason = suggest(q, nodes) if nodes else ([], '尚未下载该学科学段的知识树')
if matches:
items.append({'id': q['id'], 'knowledge_tree_ids': [n for n, _ in matches],
'expected_content_sha256': lb.digest('\n'.join(q[k] for k in ('content', 'answer', 'analysis')).encode()),
'reason': ';'.join(r for _, r in matches)})
else:
pending.append({'id': q['id'], 'title': q['title'], 'reason': reason})
if not questions:
return {'classified': 0, 'pending': 0, 'considered': 0, 'message': '所有题目都已关联知识点'}
folder = bank.root / '.bank/classification' / ('auto-' + dt.datetime.now().strftime('%Y%m%d-%H%M%S') + '-' + uuid.uuid4().hex[:6])
folder.mkdir(parents=True)
plan = folder / 'plan.json'
lb.atomic(plan, lb.json_text({'schema': 'tizhuang.classification/v1', 'items': items}))
applied = classify(bank, SimpleNamespace(file=plan, plan=False)) if items else {}
result = {'classified': len(items), 'pending': len(pending), 'considered': len(questions),
'pending_questions': pending, 'backup': applied.get('backup'), 'plan': str(plan)}
lb.atomic(folder / 'result.json', lb.json_text(result))
report = bank.root / '待整理' / ('知识点自动分类 · ' + folder.name + '.md')
lines = ['# 知识点自动分类', '', f'已关联 {len(items)} 题 · 待 Agent 判断 {len(pending)} 题。', '',
'依据已有标签精确匹配本地知识树;不使用网站题目额度。教材章节、原文和核对状态保持原样。', '']
byid = {q['id']: q for q in questions}
for item in items:
lines.extend(['- 已关联:' + byid[item['id']]['title'], ' - ' + item['reason']])
for item in pending:
note = bank.note_paths[item['id']].relative_to(bank.root).with_suffix('').as_posix()
lines.extend(['- [[' + note + '|' + item['title'].replace('|', '|') + ']]', ' - ' + item['reason']])
lines.extend(['', '## Agent 继续处理', '', '只处理本报告待判断的题目,阅读题干、配图、原答案和解析,查找本地对应学科学段的标准知识树。'
'按真实节点生成 tizhuang.classification/v1 清单,经 classify --plan 验证后应用。不要猜教材,不改变正文或审核状态。', '',
'任务记录:`' + str(folder.relative_to(bank.root)) + '/result.json`'])
lb.atomic(report, '\n'.join(lines) + '\n')
result['report'] = str(report)
return result
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |