Skip to content

jianshuo/claude-skills / wjs-tweeting-from-articles

wjs-tweeting-from-articles

Unverified

Use when the user wants to post a daily X/Twitter tweet inspired by one of their recently-published 微信公众号 articles. Picks the newest article that hasn't been tweeted yet, drafts 3 tweet candidates from it (different angles — quote / metaphor / one-liner), posts the chosen one via xurl, records to history. Triggers — "每天发一个 tweet", "从文章里发推", "今天的 tweet", "/wjs-tweeting-from-articles".

FileKindSize
SKILL.mdskill md7.7 KB
com.jianshuo.wjs-tweeting-from-articles.plist.templateother1.0 KB
daily.shexecutablescript6.0 KB
scripts/mirror-articles.pyexecutablescript2.1 KB
scripts/pick-next-article.shexecutablescript2.7 KB
scripts/pick-next-article.sh.bak.1779689674executablescript1.7 KB
setup.shexecutablescript2.4 KB
state/.gitignoreother8 B
state/queue-2026-05-24.tsvother4.4 KB
uninstall.shexecutablescript510 B

scripts/pick-next-article.sh.bak.1779689674

View on GitHub
#!/usr/bin/env bash
# Find the most recent 微信公众号 article that hasn't been tweeted yet.
# Output: absolute path to the article folder (one line), or empty + exit 1
# if no unposted article in last 14 days.
#
# Rotation rule: newest article first; skip if its slug appears in
# history.jsonl with status="posted".

set -u
HERE="$(cd "$(dirname "$0")" && pwd)"
SKILL_DIR="$(cd "$HERE/.." && pwd)"
HISTORY="$SKILL_DIR/state/history.jsonl"
ARTICLES_DIR="$HOME/Library/Mobile Documents/com~apple~CloudDocs/my/我的项目/我的创作/wechat-publish/articles"
MAX_AGE_DAYS=14

[[ -d "$ARTICLES_DIR" ]] || { echo "error: $ARTICLES_DIR not found" >&2; exit 2; }
[[ -f "$HISTORY" ]] || touch "$HISTORY"

today_epoch=$(date +%s)

# Walk articles by article.md mtime (most-recently-touched first). Folder-name
# date is the publish date, but multiple articles can share a date; mtime is
# the true "freshness" signal.
SORTED=$(for d in "$ARTICLES_DIR"/[0-9]*-*/; do
  [[ -f "${d}article.md" ]] || continue
  printf '%s\t%s\n' "$(stat -f %m "${d}article.md")" "$d"
done | sort -rn | cut -f2)

while IFS= read -r folder; do
  [[ -n "$folder" ]] || continue
  slug=$(basename "$folder")
  date_part="${slug:0:10}"  # YYYY-MM-DD
  folder_epoch=$(date -j -f "%Y-%m-%d" "$date_part" +%s 2>/dev/null || echo 0)
  [[ "$folder_epoch" -gt 0 ]] || continue

  age_days=$(( (today_epoch - folder_epoch) / 86400 ))
  [[ "$age_days" -gt "$MAX_AGE_DAYS" ]] && continue

  [[ -f "${folder}article.md" ]] || continue

  # Skip if already posted
  if grep -F "\"slug\":\"${slug}\"" "$HISTORY" 2>/dev/null \
       | grep -qF "\"status\":\"posted\""; then
    continue
  fi

  echo "${folder%/}"
  exit 0
done <<< "$SORTED"

echo "no unposted article in last $MAX_AGE_DAYS days" >&2
exit 1
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: 196kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 196kUpdated 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: 196kUpdated Claude CodeCodexVerifiedInstall