返回顶部
c

character-count

Count string length deterministically for text with hard limits. Use this skill when a post, reply, caption, commit message, or other text must stay within a maximum character count.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.0
安全检测
已通过
81
下载量
2
收藏
概述
安装方式
版本历史

character-count

# Character Count Use this skill when text must fit within a strict character limit and guessing is not acceptable. This skill is portable and self-contained. The counting logic lives in the bundled script at `scripts/character_count.py`. ## Scope This skill measures exact string length as seen by Python `len(text)`. - It is suitable for generic hard-limit workflows. - It is not a platform-specific compliance engine. - If a platform applies custom weighting rules for URLs, Unicode, or special tokens, treat this skill as a deterministic local gate, not as a guarantee of platform acceptance. ## Rules - Never estimate character counts manually. - Always count the final text exactly as it will be posted or saved. - If the text is too long, rewrite it and count again. - Prefer the JSON output mode for deterministic downstream use. - Do not describe the result as platform-accurate unless the target platform uses plain string length. ## Recommended Usage The bundled script requires `python3`. For broad portability, assume Python 3.8 or newer. From the skill root, pass the exact final text over stdin so shell quoting does not alter the content: ```bash printf '%s' "$FINAL_TEXT" | python3 scripts/character_count.py --limit 280 --json ``` If you are calling it from another working directory, use the full path to the script inside the installed skill folder. If stdin is inconvenient, pass the text as an argument: ```bash python3 scripts/character_count.py --limit 280 --json --text "Hello world" ``` ## Output Contract `--json` returns a single JSON object: ```json {"chars":11,"limit":280,"remaining":269,"ok":true} ``` Field meanings: - `chars`: exact Python string length of the provided text - `limit`: the configured limit - `remaining`: `limit - chars` - `ok`: `true` when `chars <= limit` Without `--json`, the script prints plain text key-value lines: ```text chars=11 limit=280 remaining=269 ok=true ``` ## Twitter and X Workflow For tweets and replies: 1. Draft the final post text. 2. Count it with `--limit 280`. 3. If `ok` is `false`, shorten the text. 4. Count again. 5. Post only after the script reports `ok=true`. 6. If you need exact X enforcement, add a platform-specific validation step in addition to this skill. ## Notes - Count the exact final text, including spaces, punctuation, hashtags, and URLs. - Do not add or remove characters after counting unless you count again. - Use `printf '%s'` instead of `echo` to avoid introducing a trailing newline. - If the script receives no text, treat that as a calling error and fix the invocation before proceeding.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 character-count-1776032309 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 character-count-1776032309 技能

通过命令行安装

skillhub install character-count-1776032309

下载 Zip 包

⬇ 下载 character-count v0.1.0

文件大小: 3.21 KB | 发布时间: 2026-4-13 09:41

v0.1.0 最新 2026-4-13 09:41
Initial public release of a portable deterministic string-length counting skill with bundled Python helper and ClawHub metadata.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部