Jobo16/ielts-buddy / skills/ielts-writing-review
ielts-writing-review
Verified批改雅思 Task 1 或 Task 2 作文,进行写前规划、原文证据批注和二改对照;需要可下载 Word 时生成并验证文档。用户提供作文即可使用,网站连接可选。
scripts/ielts-task1-review/create_and_validate_task1_review.py
View on GitHub#!/usr/bin/env python3
"""Create, validate, and clean up an IELTS Task 1 reviewed DOCX."""
from __future__ import annotations
import argparse
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
def run(cmd: list[str]) -> subprocess.CompletedProcess[str]:
return subprocess.run(cmd, check=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
def main() -> None:
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("review_json", type=Path)
parser.add_argument("--input-docx", type=Path, required=True)
parser.add_argument("--output", type=Path, default=None)
parser.add_argument("--keep-images", action="store_true")
parser.add_argument("--include-visual-facts", action="store_true")
args = parser.parse_args()
script_dir = Path(__file__).resolve().parent
image_dir = Path(tempfile.mkdtemp(prefix="ielts_task1_images_"))
try:
image_result = run([sys.executable, str(script_dir / "extract_docx_images.py"), str(args.input_docx), "--out", str(image_dir)])
print(image_result.stdout, end="")
create_cmd = [
sys.executable,
str(script_dir / "create_task1_review_docx.py"),
str(args.review_json),
"--input-docx",
str(args.input_docx),
"--cleanup-plan",
]
if args.output:
create_cmd.extend(["--output", str(args.output)])
if args.include_visual_facts:
create_cmd.append("--include-visual-facts")
create_result = run(create_cmd)
print(create_result.stdout, end="")
reviewed = None
for line in create_result.stdout.splitlines():
if line.endswith(".docx"):
reviewed = Path(line)
break
if reviewed is None:
raise SystemExit("Could not determine reviewed DOCX path from create script output.")
validate_result = run([
sys.executable,
str(script_dir / "validate_task1_review_docx.py"),
str(reviewed),
"--input-docx",
str(args.input_docx),
])
print(validate_result.stdout, end="")
finally:
if not args.keep_images:
shutil.rmtree(image_dir, ignore_errors=True)
print(f"Deleted temporary image directory: {image_dir}")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |