YCC-Lover/research-starter-skills / skills/rsk-research-workflow
rsk-research-workflow
Unverified准备组会、论文汇报、开题与答辩,支持可编辑 PPTX 制作、既有模板改稿、讲稿与问答演练;也用于会议交流、研究记录与 AI 协作。只要提纲或练习时不启动制稿,现行会议与资助规则另行核验。
scripts/presentation_retention.py
View on GitHub"""Retain presentation transaction files instead of deleting task artifacts."""
import errno
import json
import os
import stat
import tempfile
import uuid
from pathlib import Path
def checked_path(value):
root_value = os.environ.get('RSK_PRESENTATION_WORK_ROOT')
if not root_value:
raise ValueError('Presentation retention requires an explicit work root.')
raw_root, raw_path = Path(root_value), Path(value)
if not raw_root.is_absolute() or '..' in raw_root.parts or '..' in raw_path.parts:
raise ValueError('Use canonical absolute retention paths without parent traversal.')
root = raw_root.absolute()
path = raw_path.absolute()
if not path.is_relative_to(root) or path == root:
raise ValueError('Refusing retention outside the presentation work root: ' + str(path))
for part in (path, *path.parents):
if part.is_symlink() or (part.exists() and getattr(part.lstat(), 'st_file_attributes', 0)
& getattr(stat, 'FILE_ATTRIBUTE_REPARSE_POINT', 0)):
raise ValueError('Linked presentation paths are not supported: ' + str(part))
return root.resolve(), path.resolve()
def retain(value, missing_ok=False, empty_only=False):
root, path = checked_path(value)
if not path.exists():
if missing_ok:
return
raise FileNotFoundError(path)
if empty_only and any(path.iterdir()):
raise OSError(errno.ENOTEMPTY, 'Directory not empty', str(path))
archive = root / '.rsk-retained' / uuid.uuid4().hex
checked_path(archive)
archive.mkdir(parents=True, exist_ok=False)
target = archive / path.name
checked_path(target)
path.rename(target)
(archive / 'retention.json').write_text(json.dumps({
'source': path.relative_to(root).as_posix(), 'retained_name': path.name,
'action': 'rename-not-delete',
}, ensure_ascii=True) + '\n', encoding='utf-8')
def unlink(path, missing_ok=False, **kwargs):
if kwargs:
raise ValueError('Unsupported unlink arguments; no files were deleted.')
_, target = checked_path(path)
if target.is_dir():
raise IsADirectoryError(target)
return retain(target, missing_ok=missing_ok)
def rmdir(path, **kwargs):
if kwargs:
raise ValueError('Unsupported rmdir arguments; no directories were deleted.')
return retain(path, empty_only=True)
def rmtree(path, ignore_errors=False, **kwargs):
if kwargs:
raise ValueError('Unsupported cleanup arguments; retained outputs require review.')
try:
return retain(path)
except OSError:
if not ignore_errors:
raise
class TemporaryDirectory:
"""Compatible scratch-directory lifetime without recursive finalization."""
def __init__(self, suffix=None, prefix=None, dir=None, ignore_cleanup_errors=False, **kwargs):
if kwargs:
raise ValueError('Unsupported temporary-directory options.')
base = Path(dir or tempfile.gettempdir())
checked_path(base / 'temporary-directory-probe')
self.name = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=base)
def __class_getitem__(cls, item):
return cls
def __enter__(self):
return self.name
def __exit__(self, *args):
self.cleanup()
def cleanup(self):
# Keep the same name so crash recovery and native export diagnostics work.
checked_path(self.name)
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 |