agentleFS
PiotrGorczycaPiotrGorczyca/crosspost/skills/crosspost/SKILL.md

crosspost

Skill0 starsChanged 4 months agoMITView on GitHub

Publish and analyze Facebook Page and Instagram content via the `crosspost` CLI. Use when asked to post, publish, or schedule content to Facebook or Instagram, upload social media images/videos, delete posts, or fetch reach/engagement insights.

  • Reads credentials

11 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 11 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run crosspost doctor --json.

    line 14
  2. Very specific:

    After approval, re-run the identical commands without --dry-run.

    line 104

“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

crosspost — Facebook Page + Instagram publishing CLI

A local CLI over the Meta Graph API. Deterministic, agent-friendly: every command supports --json (exactly one JSON document on stdout, logs on stderr) and --dry-run (prints the would-be API calls without executing anything mutating).

Before anything else

Run crosspost doctor --json. It validates config, token liveness, the page-token exchange, IG reachability, the publish quota, and the media endpoint. If it exits non-zero, fix that first — do not retry publishing against a broken setup.

Exit codes

CodeMeaningTypical fix
0success—
1Graph API or media errorread error.message + hint in the JSON output
2usage error (bad flags/values, failed pre-flight validation)fix the invocation
3config/auth errorcrosspost doctor; set missing env/config keys

--json output shape: { "ok": true, "data": ... } on success (plus "dryRun": true, "plannedCalls": [...] under --dry-run), or { "ok": false, "error": { "message", "code", "subcode", "fbtrace_id" }, "hint" } on failure.

Command cheatsheet

crosspost doctor --json                                      # health check — run first
crosspost media upload ./pic.png --fit pad --json            # normalize → upload → public URL

crosspost fb post --text "Hello" --json                      # text post
crosspost fb post --link https://example.com --text "Look"   # link post
crosspost fb post --photo ./pic.png --text "Caption" --json  # photo (local file auto-uploads)
crosspost fb list --limit 10 --json
crosspost fb delete 111_222 --json
crosspost fb set-picture ./avatar.png --json                 # page profile picture (file or URL)
crosspost fb set-cover ./banner.png --json                   # page cover; silent by default (--feed-story to announce)
crosspost fb insights --since 30d --json
crosspost fb insights --post 111_222 --json

crosspost ig publish --media ./pic.png --caption "Hi" --json           # single image
crosspost ig publish --media a.jpg --media b.jpg --caption "…" --json  # carousel (max 10)
crosspost ig publish --media ./clip.mp4 --reel --caption "…" --json    # reel
crosspost ig publish --media ./pic.jpg --story --json                  # story
crosspost ig insights --since 30d --json                               # account metrics
crosspost ig insights --post <media-id> --json                         # per-post metrics

Global flags on every command: --json, --dry-run, --page-id, --ig-user-id, --token, --config <path>. Config resolution: flags > env (META_PAGE_ID, META_IG_USER_ID, META_ACCESS_TOKEN, MEDIA_UPLOAD_URL, CROSSPOST_MEDIA_UPLOAD_TOKEN)

~/.config/crosspost/config.toml.

How IG publishing works (why it can take a minute)

Instagram publishing is a three-step server-side flow: the CLI creates a media container (Meta downloads your media from its public URL), polls the container's status_code until it reaches FINISHED (videos can take tens of seconds), then calls media_publish. The CLI does all of this in one ig publish invocation with backoff and a 5-minute timeout. If it times out, the error names the container id — the container stays valid for ~24h and publishing can be retried.

Hard constraints (validated before any API call)

  • Images must be JPEG. Local PNG/WebP/HEIC files are converted automatically; remote URLs are not — a .png URL is rejected up front.
  • Local files mostly upload directly — FB photos go as multipart, videos/reels via resumable upload; neither needs any hosting. The one exception: IG images are only ingested from public HTTPS URLs, so publishing a local image to IG requires MEDIA_UPLOAD_URL (staged under a random key, auto-deleted after publish). Remote media URLs must always be public HTTPS — private/localhost URLs fail with a media-download error.
  • Aspect ratio 4:5 to 1.91:1 for feed images. Local files are fixed automatically (--fit pad adds white bars, --fit crop center-crops; pad is the default).
  • Carousels: 2–10 items. The caption lives on the carousel, not on children.
  • 100 API-published posts per rolling 24h per IG account — checked server-side before publishing; the CLI warns at 90 and refuses at 100.
  • Reels are videos (MP4/H.264/AAC). No transcoding in v1 — for fixes see references/ffmpeg.md.
  • Published IG media cannot be deleted via the API — only FB Page posts can. Draft with --dry-run and confirm with the user before publishing to IG.

Troubleshooting

SymptomMeaningFix
code: 190token expired/invalidregenerate the system-user token; crosspost doctor
"media download" / subcode 2207003Meta can't fetch the URLURL must be public HTTPS; check with curl -I
aspect ratio / format errorimage out of bounds or not JPEGpass a local file (auto-fixes) or --fit pad|crop
code: 4/17/32rate limitedwait; quota shows in crosspost doctor
exit 3 anywheremissing/broken configcrosspost doctor lists what's missing and its source
no page tokenpage not assigned to the system userassign in Business Manager (references/meta-setup.md)

Example workflows

Draft a week of posts, publish after approval. Draft each post as a full command with --dry-run --json, collect the planned calls, and show the user the drafts. After approval, re-run the identical commands without --dry-run. Nothing mutating ever runs under --dry-run, so drafting is always safe.

Publish a local screenshot to IG. crosspost ig publish --media ./shot.png --caption "..." --json — the PNG is converted to JPEG, aspect-padded, uploaded to the configured media host, and published; the final data.mediaId is the IG media id, usable with crosspost ig insights --post <id>.

Weekly analytics summary. crosspost fb insights --since 7d --json and crosspost ig insights --since 7d --json, then summarize the metric values. If Meta rejects a metric name (they deprecate them often), pick replacements from references/insights-metrics.md and pass --metrics.

References

  • references/meta-setup.md — one-time Meta app / token / page-link setup
  • references/ffmpeg.md — manual video conversion commands
  • references/insights-metrics.md — currently-valid metric names

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.