This skill is used to publish a locally generated weekly Markdown file to the Payload CMS weekly collection, and keep it as draft(status: draft)。
Prerequisites
- Environment variable
PAYLOAD_API_KEY: the API Key generated for a user from the Payloaduserscollection. - Environment variable
PAYLOAD_BASE_URL(recommended): the public address of the Payload/Next.js service (for examplehttp://localhost:3000)。 - Environment variable
BARK_PUSH_URL(optional): the full Bark push endpoint (for examplehttps://push.example.com/push/token/); if not configured, skip the notification.
Input
Obtained from the argument block of the /weekly command:
week_id: e.g.Y26W12(write toissueNumber)title: write totitlefilename: the weekly Markdown filename (read the file content from the working directory, write tocontent)current_date: write topublishDate(ISO date string)
Optional:
summary: weekly description/summary (write tosummary). If not provided, extract fromcontent.tags: tags (string array, e.g.["模型", "工具"]). Write to thetagsarray field.links: link list (object array, in the form[{ label, url }]), write tolinks。
Publish target
- Collection:
weekly - REST Endpoint:
- Query:
GET {BASE_URL}/api/weekly?where[issueNumber][equals]={week_id}&limit=1 - Create:
POST {BASE_URL}/api/weekly - Update:
PATCH {BASE_URL}/api/weekly/{id}
- Query:
Authentication method (HTTP Header)
Payload's API Key authentication header must be used:
Authorization: users API-Key {PAYLOAD_API_KEY}
Content-Type: application/json
Field mapping
When publishing/updating, write the following fields:
title(text, required):{title}summary(textarea, required):- If provided,
{summary}: use directly - Otherwise: extract 1-2 sentences from
content(no more than 200 characters); if the beginning of the article already contains a "summary/lead", reuse it first
- If provided,
content(textarea, required): read{filename}'s full Markdown contentissueNumber(text, required, unique):{week_id}status(select, required): always writedraftpublishDate(date, required):{current_date}(recommendedYYYY-MM-DD)
Optional fields (leave empty/omit if absent):
links(array):{links}, element structure is{ label: string, url: string }tags(array): convert{tags}(string array) to[{ value: string }]
Request Body example
{
"title": "Agili 的 AIGC 周刊(Y26W12)",
"issueNumber": "Y26W12",
"publishDate": "2026-03-25",
"status": "draft",
"summary": "本期聚焦推理模型的工程化落地,以及一批值得试用的生产力工具。",
"content": "# ...完整 Markdown...",
"links": [{ "label": "在线阅读", "url": "https://aigc-weekly.agi.li" }],
"tags": [{ "value": "模型" }, { "value": "工具" }]
}
Behavior constraints
- Idempotent: query first by
issueNumber == week_id:- If it already exists: update with
PATCH(overwritetitle/summary/content/publishDate/status/links/tags)。 - If it does not exist: create with
POST.
- If it already exists: update with
- Keep as draft: whether creating or updating, must write
status: "draft"。 - Artifact persistence: save the response JSON of a successful create/update as
published/{week_id}.json, for later recovery and auditing. - Diagnosable on failure: if the request fails, output: HTTP status code, response body (if any), request URL (do not leak
PAYLOAD_API_KEY)。 - Draft notification: only after Payload
POST/PATCHsucceeds and the response has been saved topublished/{week_id}.json, execute:- If not configured,
BARK_PUSH_URL, skip directly. - POST JSON to
BARK_PUSH_URL, 5-second timeout:titleis{week_id}|周刊草稿已生成,bodyis{title},urlis{PAYLOAD_BASE_URL 去掉末尾斜杠}/admin/collections/weekly/{CMS 响应中的文档 id}。 - The request body must be constructed using a JSON serialization tool; JSON must not be generated by string concatenation; at the same time, both HTTP success and the response JSON's
code === 200。 - On notification failure, output only diagnostics such as timeout, HTTP status, or response code; do not print
BARK_PUSH_URLor any credentials; a draft that has already been successfully written must not be judged as failed, and audit artifacts must not be deleted.
- If not configured,