A conversational backend for a Hugo blog.I am the backend—no CMS, no /admin page, no PAT, no Cloudflare.
You say what to publish, and I edit according to the repository conventions, content/, place images, commit, push, and go live automatically through the repository's existing deployment flow.
Applies to: Hugo sites like maggiacito.com (content/posts/*.md + categories/tags taxonomy + GitHub Pages
Actions deployment). Other Hugo repositories can also use it; first align with the conventions per the "Preflight checks" below.
Preflight checks (do this first every time you start work)
- Confirm you are at the Hugo repository root: there is
hugo.toml(orconfig.toml) andcontent/. If not, ask the user for the path. - Read
hugo.toml: gettimeZone、[taxonomies](confirmcategories/tags)。 - Look at the front matter of an existing post (pick any one in
content/posts/), and confirm the fields match the "Authoritative format" below; if they do not match, go by therepository's current state, and do not apply this document's defaults.
Authoritative post format (maggiacito current state)
File:content/posts/<slug>.md. The front matter is strictly as follows, with the date using YYYY-MM-DD HH:MM:SS(Asia/Shanghai):
---
title: "标题"
date: 2026-06-04 21:30:00
lastmod: 2026-06-04 21:30:00
categories: ["知天命"]
tags: []
url: /知天命/标题/
---
正文 markdown……
urlexplicitly write/<主类目>/<标题或slug>/(following the link style migrated from WordPress; categories and titles may contain Chinese).categories/tagsis a string array, may be empty[]。- Do not hand-write front matter—use
scripts/new-post.pyto generate it, so the format will not drift.
Workflow
1. Add a post
Get the title + body (the user can provide a draft/link/scattered ideas; polish as needed), choose the category, then:
echo "<正文 markdown>" | python3 <SKILL_DIR>/scripts/new-post.py \
--repo <仓库根> --title "标题" --category "知天命" --slug 可选英文slug
The script generates content/posts/<slug>.md and prints the path. When --slug is not passed, derive the filename from the title (Chinese is fine too; readers do not see the filename).
When --url is not passed, default to /<首个类目>/<标题或slug>/. If another link is needed, use --url to override.
2. Edit a post
Directly edit the corresponding content/posts/*.md: change the body freely; if the content is changed, update lastmod to the current time, and leavedate unchanged.
3. Manage categories
- First list the existing categories for the user to choose from (to avoid creating duplicates):
bash <SKILL_DIR>/scripts/categories.sh <仓库根> - New category: just add it on the spot to the post's
categories[], and Hugo taxonomy will automatically create the/categories/<名>/page, with no other configuration needed. - Rename/merge categories: scan all
content/posts/*.md'scategories[]and replace in bulk (this is something a CMS cannot do but I can). After the change, remind the user that the old/categories/<旧名>/links will become invalid.
4. Upload images
Put new images in static/uploads/<年>/(served as /uploads/...); leave the old static/wp-content/uploads/ unchanged.
python3 <SKILL_DIR>/scripts/add-image.py <本地图片> --repo <仓库根> --alt "说明"
Print a one-line markdown image link and insert it into the body. Images wider than 2000px will be automatically resized using macOS sips .
5. Publish live
Local preview (optional):hugo server -D → view http://localhost:1313 .
After confirming, publish:
bash <SKILL_DIR>/scripts/publish.sh "post: <标题>" <仓库根>
A regular user's git push will trigger deploy.yml(on: push) to build and go live—Only the feedback bot's GITHUB_TOKEN
pushesget blocked by GitHub's anti-recursion protection; your own pushes are unaffected. After pushing, you can gh run watch check the deployment.
Scope (YAGNI)
Only do: create/edit posts, manage categories, upload images, publish.Don't docomments, user management, draft workflows, scheduled publishing.
Common mistakes
- ❌ Hand-writing front matter causes date format/field drift → ✅ Always go through
new-post.py。 - ❌ Stuffing images into
static/wp-content/uploads/(that's a legacy directory from migration) → ✅ Put new images intostatic/uploads/。 - ❌ Edited a post but forgot to update
lastmod→ ✅ Sync after editinglastmod。 - ❌ Created a category with the same name/similar meaning as an existing one → ✅ First
categories.shtake a look before deciding. - ❌ Think pushing won't auto-deploy (misled by that
GITHUB_TOKENlimitation in the feedback loop) → ✅ Your own push will triggerdeploy.yml。 - ❌ Set a colliding
url(duplicates an existing post) → ✅ Usecategories.sh/grep to check for duplicates, and if necessary--urlspecify a unique path.