$npx -y skills add binance/binance-skills-hub --skill square-postUse when the user wants to publish new content to Binance Square — short text, multi-image posts (up to 4), long-form articles with an optional cover, or videos with an auto-generated cover frame. Trigger on direct phrasings like "post to Square", "publish to Binance Square", "发广
| 1 | # Square Post Skill |
| 2 | |
| 3 | ## Purpose |
| 4 | |
| 5 | Publish new content to Binance Square by running the local scripts in `scripts/`. |
| 6 | |
| 7 | Supported post types: |
| 8 | - Text-only short posts |
| 9 | - Image posts with up to 4 images |
| 10 | - Long articles with a title and optional cover image |
| 11 | - Video posts with an auto-generated cover image |
| 12 | |
| 13 | Do not hand-code API requests for normal posting. The scripts own upload, polling, cover generation, and publish behavior. |
| 14 | |
| 15 | ## Runtime Dependencies |
| 16 | |
| 17 | - Node.js 18 or newer. The scripts use native ES modules and the built-in `fetch` API. |
| 18 | - `ffmpeg` is required for video posts because `post-video.mjs` extracts the first frame as the cover image. |
| 19 | - `ffprobe` is required when a video duration is not provided by the user. |
| 20 | - Network access is required for Binance Square OpenAPI requests and presigned media uploads. |
| 21 | |
| 22 | ## Authentication |
| 23 | |
| 24 | Posting requires a Binance Square OpenAPI key. |
| 25 | |
| 26 | Before posting: |
| 27 | - Prefer `BINANCE_SQUARE_OPENAPI_KEY` from the user's environment if present. |
| 28 | - If it is not present, the scripts automatically check `~/.config/binance-square/openapi-key`. |
| 29 | - If no valid key is found, ask the user to provide an API key first. |
| 30 | - If the user wants to reuse the key in future requests, save it with `BINANCE_SQUARE_OPENAPI_KEY=<apiKey> node scripts/save-key.mjs`; otherwise use it only for the current command environment. |
| 31 | - Tell the user they can create an API key at: https://www.binance.com/square/creator-center/home |
| 32 | |
| 33 | Pass the key only via `BINANCE_SQUARE_OPENAPI_KEY` (env or saved file). Never write it into command arguments or print the full key — CLI args appear in `ps` output and shell history. When mentioning a key, show only the first 5 and last 4 characters, such as `abc12...xyz9`. |
| 34 | |
| 35 | ## Scripts |
| 36 | |
| 37 | All commands should be run from this skill directory. |
| 38 | |
| 39 | ### Text Or Article Post |
| 40 | |
| 41 | Use for text-only short posts or long articles without images. |
| 42 | |
| 43 | ```bash |
| 44 | node scripts/post-text.mjs --text "Hello #crypto $BTC" |
| 45 | ``` |
| 46 | |
| 47 | Long article with title and no cover: |
| 48 | |
| 49 | ```bash |
| 50 | node scripts/post-text.mjs --text "Full article body..." --title "Market Report" |
| 51 | ``` |
| 52 | |
| 53 | Flags: |
| 54 | - `--text` required, post text content |
| 55 | - `--title` optional, sets article-style content |
| 56 | |
| 57 | ### Image Post |
| 58 | |
| 59 | Use for short image posts or long articles with a cover image. |
| 60 | |
| 61 | ```bash |
| 62 | node scripts/post-image.mjs --text "Chart analysis" --images "./chart1.png,./chart2.png" |
| 63 | ``` |
| 64 | |
| 65 | Long article with title and cover: |
| 66 | |
| 67 | ```bash |
| 68 | node scripts/post-image.mjs --text "Full analysis..." --title "Market Report" --cover "./chart.png" |
| 69 | ``` |
| 70 | |
| 71 | Flags: |
| 72 | - `--text` required, post or article content |
| 73 | - `--images` required for short image posts only. Use comma-separated image paths with max 4. |
| 74 | - `--title` optional, sets article-style content. When present, do not pass `--images`. |
| 75 | - `--cover` required when `--title` is present for an article with media. Article mode supports exactly one cover image. |
| 76 | |
| 77 | The script uploads each image, waits for processing, and publishes with the processed image URL returned by the backend. If `--title` is provided, it publishes `contentType=2`, requires `--cover`, and sends that uploaded image URL as `cover` only. If no `--title` is provided, it publishes `contentType=1` and sends all `--images` as `imageList`. |
| 78 | |
| 79 | ### Video Post |
| 80 | |
| 81 | Use for video posts. |
| 82 | |
| 83 | ```bash |
| 84 | node scripts/post-video.mjs --video "./video.mp4" --duration 7.5 --text "My analysis" |
| 85 | ``` |
| 86 | |
| 87 | Flags: |
| 88 | - `--video` required, local video path |
| 89 | - `--duration` required, video duration in seconds |
| 90 | - `--text` optional, post text content |
| 91 | |
| 92 | The script uploads the video, waits for processing, extracts the first frame with `ffmpeg`, uploads that frame as the cover image, and publishes with `cover` included in the request. |
| 93 | |
| 94 | If the user does not provide a duration, use `ffprobe` to determine it before running the script. |
| 95 | |
| 96 | ## Agent Workflow |
| 97 | |
| 98 | 1. Resolve the API key (see Authentication). If unresolved, stop and ask the user before doing anything else. |
| 99 | |
| 100 | 2. Pick the script from user intent using the table below. Then validate against Constraints — if a constraint is violated, explain it and do |