一键导入
blog-import-post
Import existing Markdown files into the Hugo blog with smart metadata handling, automatic image processing, and token optimization
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Import existing Markdown files into the Hugo blog with smart metadata handling, automatic image processing, and token optimization
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate or execute Git commits on Windows with a required emoji prefix, conventional commit type, and short Chinese summary. Use when the user asks to write a commit message, create a commit, submit local changes, or "帮我提交/生成 git commit". Apply this skill when Codex needs to inspect changed files, choose a commit type, build a message in the required `emoji + type + 描述` format, commit with Windows-side Git in PowerShell, and then ask whether to review the patch quality for patch-on-patch cleanup or refactoring.
用于管理 wzh001create Hugo 站点的内容发布流程。适用于导入、编辑、发布或删除 `content/posts/` 下的 Markdown 文章并同步 front matter 与图片;新增或更新独立 HTML 页面及其 `content/specials/` 包装页;以及创建、更新、发布 `skills/` 下的可复用技能,补齐 `skill.json`、`agents/openai.yaml`、生成技能库页面、zip 压缩包与上线校验。
用于通过 OpenOCD 和 ST-Link 对 STM32 目标进行烧录、复位或基础调试。Use this skill for OpenOCD plus ST-Link flashing, reset handling, verified programming, and basic debug bring-up on STM32 targets.
用于 Windows 上的 Qt/C++ 项目构建、环境排错、qmake/CMake 识别、MinGW/Qt 路径修复、VSCode tasks.json 和 launch.json 生成、编译后在 VSCode 中打开并进入调试。适用于需要处理 Qt 构建失败、PATH 污染、uic/moc/rcc 缺失、g++/cc1plus 不可用、区分 qmake 与 CMake、为现有 Qt 项目补齐 VSCode 调试配置的场景。Keywords: Qt, qmake, CMake, MinGW, MSVC, VSCode, launch.json, tasks.json, debug, build.
用于 STM32 固件工程的 CMake 或 CMakePresets 检查、配置、编译与产物确认。Use this skill for STM32 firmware projects that need CMake preset inspection, configure/build loops, and artifact validation on Windows PowerShell.
用于通过 UART 日志确认 STM32 固件运行状态或分析运行时问题。Use this skill for STM32 runtime validation from UART logs, baud selection, startup checks, timestamp correlation, and structured serial analysis.
| name | blog-import-post |
| description | Import existing Markdown files into the Hugo blog with smart metadata handling, automatic image processing, and token optimization |
Import existing Markdown files into the Hugo blog with intelligent handling of front matter, automatic image processing, and optimized token usage.
content/posts/ directorycp + sed commands (saves 70% tokens)Use this skill when the user wants to:
Check if the user provided a markdown file path:
# Verify file exists
if [ ! -f "<file-path>" ]; then
echo "错误: 文件不存在"
exit 1
fi
# Check extension
if [[ ! "<file-path>" =~ \.md$ ]] && [[ ! "<file-path>" =~ \.markdown$ ]]; then
echo "错误: 文件不是 Markdown 格式"
exit 1
fi
If not provided or invalid:
If valid:
✓ 找到文件: <file-path>IMPORTANT: Only read the first 50 lines to save tokens
Use Read tool with limit:
filePath: <source-file>
offset: 0
limit: 50
Check for front matter structure:
------ within first 50 linesDetermine completeness:
title field (minimum requirement). Keep existing metadata and do not ask follow-ups.title or no front matter at all. Ask user for metadata.When to use: File has --- ... --- structure with at least a title field
Token estimate: ~500-800 tokens (saves 70% compared to Write)
Commands:
cd ~/wzh_blog/my-blog
# Extract original filename (preserve Chinese characters)
ORIGINAL_NAME=$(basename "<source-file>" .md)
ORIGINAL_NAME=$(basename "$ORIGINAL_NAME" .markdown)
# Copy file directly
cp "<source-file>" "content/posts/${ORIGINAL_NAME}.md"
# Update author to wzh001create
sed -i 's/^author:.*/author: "wzh001create"/' "content/posts/${ORIGINAL_NAME}.md"
# Add date if missing
if ! grep -q "^date:" "content/posts/${ORIGINAL_NAME}.md"; then
CURRENT_DATE=$(date +"%Y-%m-%dT%H:%M:%S+08:00")
sed -i "/^---$/a date: $CURRENT_DATE" "content/posts/${ORIGINAL_NAME}.md"
fi
# Add draft: false if missing
if ! grep -q "^draft:" "content/posts/${ORIGINAL_NAME}.md"; then
sed -i "/^date:/a draft: false" "content/posts/${ORIGINAL_NAME}.md"
fi
Show progress:
✓ 找到文件: <source-file>
✓ 检测到完整的 front matter,保留原有元数据
- 标题: <extracted-title>
- 标签: <extracted-tags>
- 分类: <extracted-categories>
✓ 文章已导入到 content/posts/<filename>.md
Then jump to Step 4 (handle images)
When to use: File has no front matter OR incomplete front matter (no title)
Token estimate: ~2500-3000 tokens (normal Write operation)
Ask user for metadata:
Use Question tool or direct text:
需要添加文章元数据,请提供:
1. 标题 (title):
2. 标签 (tags, 逗号分隔):
3. 分类 (categories, 逗号分隔):
Create file with Write tool:
---
title: "<user-provided-title>"
date: <current-datetime-+08:00>
draft: false
tags: ["<tag1>", "<tag2>", "<tag3>"]
categories: ["<category1>", "<category2>"]
author: "wzh001create"
---
<original-file-content>
Important:
2026-01-22T19:30:00+08:00Show progress:
✓ 找到文件: <source-file>
✓ 已添加 front matter 元数据
✓ 文章已导入到 content/posts/<filename>.md
Detect images in source directory:
SOURCE_DIR=$(dirname "<source-file>")
ARTICLE_NAME=$(basename "<source-file>" .md | basename - .markdown)
# Check for image files
if ls "$SOURCE_DIR"/*.{png,jpg,jpeg,gif,svg,webp} 2>/dev/null | grep -q .; then
IMAGE_COUNT=$(ls "$SOURCE_DIR"/*.{png,jpg,jpeg,gif,svg,webp} 2>/dev/null | wc -l)
echo "检测到 $IMAGE_COUNT 张图片"
fi
If images found: Automatically copy them (as per user requirement)
# Create image directory
mkdir -p "static/images/${ARTICLE_NAME}"
# Copy all images
cp "$SOURCE_DIR"/*.{png,jpg,jpeg,gif,svg,webp} "static/images/${ARTICLE_NAME}/" 2>/dev/null
# Update image paths in the markdown
sed -i "s|\!\[\([^]]*\)\](\([^/)][^)]*\))|\|g" "content/posts/${ARTICLE_NAME}.md"
echo "✓ 已复制 $IMAGE_COUNT 张图片到 static/images/${ARTICLE_NAME}/"
echo "✓ 已更新图片路径引用"
If no images found:
ℹ️ 未检测到图片文件
DO NOT re-read the entire file - just verify it exists:
ls "content/posts/<article-name>.md" && echo "✓ 文件已成功创建"
Optional: If you used Step 3A (cp + sed), you can quickly verify front matter:
head -15 "content/posts/<article-name>.md" | grep -E "^(title|author|date|draft):"
Use the Question tool to ask:
是否立即发布到 GitHub?
- 是 - 立即提交并推送
- 否 - 稍后手动发布
If user chooses YES:
cd ~/wzh_blog/my-blog
git add -A
git commit -m "feat: 添加文章《<article-title>》"
git push
Then show:
✅ 导入并发布成功!
✓ 已提交更改
✓ 已推送到 GitHub
🚀 GitHub Actions 正在部署...
你的文章将在几分钟内上线:
https://wzh001create.github.io/posts/<article-slug>/
📄 文件:content/posts/<article-name>.md
🖼️ 图片:static/images/<article-name>/ (如果有图片)
If user chooses NO:
✅ 导入成功!
📄 文件位置: content/posts/<article-name>.md
🖼️ 图片目录: static/images/<article-name>/ (如果有图片)
需要发布时,请运行:
cd ~/wzh_blog/my-blog/scripts
./publish.sh
或者手动执行:
cd ~/wzh_blog/my-blog
git add -A
git commit -m "feat: 添加文章《<article-title>》"
git push
~/wzh_blog/my-blog/~/wzh_blog/my-blog/content/posts/~/wzh_blog/my-blog/static/images/~/wzh_blog/my-blog/scripts/import-post.shwzh001create (always use this)1. Read first 50 lines only (500 tokens)
2. Use cp + sed commands (50 tokens)
3. Handle images with bash (100 tokens)
4. Verify with ls (50 tokens)
Total: ~700 tokens ⚡ (70% savings)
1. Read first 50 lines (500 tokens)
2. Ask user for metadata (100 tokens)
3. Write entire file (2000 tokens)
4. Handle images with bash (100 tokens)
Total: ~2700 tokens (standard)
Key principle: Avoid reading or writing the full file content unless absolutely necessary.
❌ 错误: 文件不存在
检查路径: <provided-path>
请提供有效的 Markdown 文件路径。
❌ 错误: 文件不是 Markdown 格式
文件扩展名: <extension>
请提供 .md 或 .markdown 文件。
❌ 推送失败
文章已在本地导入,但未能推送到 GitHub。
错误信息: <error-output>
请检查网络连接和 Git 认证,然后手动推送:
cd ~/wzh_blog/my-blog
git push
import-post.sh script is available for manual usetitle fieldtitle exists, preserve all other fields (tags, categories, etc.)/images/<article-name>/...User input:
导入文章 ~/Downloads/Git常用命令速查手册.md
Your response (Path A - has front matter):
正在导入文章...
✓ 找到文件: ~/Downloads/Git常用命令速查手册.md
✓ 检测到完整的 front matter,保留原有元数据
- 标题: Git 常用命令速查手册
- 标签: Git, 版本控制, 命令速查
- 分类: 教程
正在复制文件和处理图片...
ℹ️ 未检测到图片文件
✓ 文章已导入到 content/posts/Git常用命令速查手册.md
📤 是否立即发布到 GitHub?(y/N)
User input:
y
Your response:
✅ 导入并发布成功!
✓ 已提交更改
✓ 已推送到 GitHub
🚀 GitHub Actions 正在部署...
你的文章将在几分钟内上线:
https://wzh001create.github.io/posts/git常用命令速查手册/
📄 文件:content/posts/Git常用命令速查手册.md
Remember: This skill is optimized for minimal token usage while maintaining full automation. Always choose the token-saving path (cp + sed) when possible.