Skip to content

jianshuo/claude-skills / wjs-publishing-wechat

wjs-publishing-wechat

Unverified

当用户想写或发布微信公众号文章时使用——他们给出零散思路、草稿或笔记,请你润色、生成题图和解释图,或准备上传到 mp.weixin.qq.com。触发词:"写一篇微信文章"、"公众号"、"润色"、"题图"、"发公众号"、"/wjs-publishing-wechat"。

FileKindSize
.gitignoreother65 B
.publish-manifest.jsonconfig13.2 KB
LICENSEother1.0 KB
README.mdmarkdown4.7 KB
SKILL.mdskill md14.2 KB
STYLE.mdmarkdown10.8 KB
prompts/cover-prompt.mdmarkdown20.6 KB
prompts/illustration-prompt.mdmarkdown2.8 KB
scripts/backfill-permalinks.pyexecutablescript9.3 KB
scripts/build-recent-articles.pyexecutablescript5.5 KB
scripts/fetch-comments-by-cookie.shexecutablescript12.2 KB
scripts/fetch-comments-via-gstack.shexecutablescript10.8 KB
scripts/fetch-comments.shexecutablescript5.4 KB
scripts/gen-cover-ai.shexecutablescript3.8 KB
scripts/gen-illustration.shexecutablescript3.0 KB
scripts/mass-send.shexecutablescript7.2 KB
scripts/open-draft-edit.shexecutablescript5.3 KB
scripts/pangu.pyscript2.9 KB
scripts/update-draft-via-api.pyexecutablescript3.9 KB
scripts/upload-draft.shexecutablescript19.4 KB

scripts/gen-illustration.sh

View on GitHub
#!/usr/bin/env bash
# Generate flat cartoon explanation illustration from article.md.
#
# Reads the article markdown, slots it into illustration-prompt.md as
# instructions, asks gpt-image-2 to visualize the article structure.
# No cropping — the model picks the aspect ratio that fits the content.
#
# Output:
#   <article-folder>/illustration.png   the AI-generated illustration as-is
#
# Usage:
#   gen-illustration.sh <article-folder>

set -euo pipefail

ARTICLE_DIR="${1:-}"
if [[ -z "$ARTICLE_DIR" || ! -d "$ARTICLE_DIR" ]]; then
  echo "usage: gen-illustration.sh <article-folder>" >&2
  exit 2
fi
ARTICLE_DIR="$(cd "$ARTICLE_DIR" && pwd)"

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"  # scripts/ → skill root
TEMPLATE="$SKILL_DIR/prompts/illustration-prompt.md"
WRAPPER="$HOME/.claude/skills/gpt-image-2-skill/scripts/gpt_image_2_skill.cjs"

[[ -f "$TEMPLATE" ]] || { echo "error: template missing: $TEMPLATE" >&2; exit 1; }
[[ -f "$WRAPPER" ]]  || { echo "error: gpt-image-2-skill wrapper not found at $WRAPPER" >&2; exit 1; }

ARTICLE_MD="$ARTICLE_DIR/article.md"
[[ -f "$ARTICLE_MD" ]] || { echo "error: missing $ARTICLE_MD" >&2; exit 1; }

# Build instructions: read template + slot in article body
INSTRUCTIONS=$(python3 -c "
import sys
template = open(sys.argv[1]).read()
article  = open(sys.argv[2]).read()
print(template.replace('[文章内容]', article))
" "$TEMPLATE" "$ARTICLE_MD")

GEN_PROMPT="根据 instructions 中的文章内容,生成一张扁平卡通风格的解释图。画幅比例由内容决定 (双行对照用 3:2 / 4:3, 单行流程用横长条, 层级深度用竖版), 选最易读的版本。把文章的核心层级 / 对比 / 递进结构可视化,让读者一眼看懂。中文标签必须准确无伪字。"

OUT="${ARTICLE_DIR}/illustration.png"
SIZE="${WECHAT_PUBLISH_IMAGE_SIZE:-1536x1024}"
QUALITY="${WECHAT_PUBLISH_IMAGE_QUALITY:-high}"

echo "calling gpt-image-2-skill (illustration, size: $SIZE, quality: $QUALITY)" >&2

cd "$HOME/.claude/skills/gpt-image-2-skill"
# Codex-only: --instructions is supported solely by the codex provider, and we
# do not allow OPENAI_API_KEY fallback. ~/.codex/auth.json must exist.
RESULT=$(node "$WRAPPER" --json --provider codex images generate \
  --instructions "$INSTRUCTIONS" \
  --prompt "$GEN_PROMPT" \
  --out "$OUT" \
  --size "$SIZE" \
  --format png \
  --quality "$QUALITY" 2>&1) || {
  echo "image generation failed:" >&2
  echo "$RESULT" | tail -20 >&2
  exit 1
}

if [[ ! -s "$OUT" ]]; then
  echo "error: no image written to $OUT" >&2
  echo "$RESULT" | tail -20 >&2
  exit 1
fi

# Resize to 1024 wide (proportional). NO cropping — the model picks the aspect
# ratio for the content; the old center-crop to 16:9 chopped labels off the
# top and bottom of every illustration.
sips --resampleWidth 1024 "$OUT" --out "$OUT" >/dev/null 2>&1

# Read actual dimensions for the report
DIMS=$(sips -g pixelWidth -g pixelHeight "$OUT" | grep -E "pixel" | awk '{print $2}' | paste -sd "x" -)
echo "illustration ready: $OUT ($DIMS)" >&2
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall