提示词 Token 精简优化
prompt-token-efficiency
重写提示词,使其 token 用量最少、清晰度最高、歧义最低,供 LLM 使用。
- License 许可
- MIT
- 所属仓库
- github/gh-aw
- 最近更新
- 2026-11-15
- Stars
- ★ 5.6k
- Forks
- 626
01 前言 Front Matter
- name
- prompt-token-efficiency
- description
- Rewrite prompts for minimal tokens, maximal clarity, and low ambiguity for LLM consumption.
03 SKILL.md 正文
Prompt Token Efficiency
Use when writing or revising prompts, instructions, skills, or their generators. Optimize agent comprehension and useful information per byte without changing intent, safety, output contracts, or failure behavior.
Prefix contract
Copilot CLI prompt-file queries may return only the first 8,000 UTF-8 bytes. Count bytes from the start of the file, including frontmatter, whitespace, links, and multibyte characters; line and character counts are not substitutes.
- Fit a complete execution contract within 7,500 bytes, leaving 500 bytes of headroom.
- Order it: objective/activation, mandatory constraints, task-to-reference routes, procedure, verification/output contract, failure/stop conditions.
- Keep safety gates and required completion steps before examples. Put only optional explanations, extended examples, and specialized detail afterward.
- Link required detail before the cutoff with an explicit condition for loading it. Never rely on a later table of contents or on instructions to read a tail that the agent cannot discover.
- Prefer a file under 7,500 bytes. If longer, mark the end of its self-contained
contract with
<!-- instruction-prefix-end -->on a separate line by byte 7,500. Close frontmatter, fences, lists and tables before that marker. - Run
python3 scripts/check-instruction-prefixes.py PATH...in this repository. The checker measures structure/bytes, not semantic completeness. Read the exact first 8,000 bytes separately and verify every required decision is actionable, or routes to a named reference. Report unavailable checks.
For comparison, evaluate the same task against full guidance and its exact 8,000-byte prefix. Record missing rules, routes, outputs and stop conditions; never accept lower cost or fewer bytes as proof of equivalent behavior.
Goals
- Minimize token count
- Maximize clarity
- Minimize ambiguity
- Optimize for LLM execution, not human prose style
Core Rules
- Keep task-critical information; move optional detail behind explicit routes.
- Remove pleasantries, repetition, and narrative framing.
- Prefer short, concrete instructions over descriptive paragraphs.
- Use explicit constraints and output format requirements.
- Use stable terminology (one term per concept).
- Use short grammatical imperatives, not cryptic fragments or undefined shorthand.
- State actor, condition and action; keep negation and exceptions next to the rule.
- Preserve exact field names, commands, thresholds, compatibility and auth boundaries.
- Replace vague words (
appropriate,some,better) with measurable criteria. - Put required context before optional context.
- Avoid conflicting instructions.
Prose Compression Pattern
Rewrite prose to be direct and compact:
- Start with the objective in one short sentence.
- Keep only facts needed to complete the task.
- Replace long qualifiers with concrete limits.
- Remove filler words that do not change behavior.
- End with explicit success criteria.
LLM-Optimized Writing Style
- Use imperative statements.
- Prefer bullets over long prose.
- Keep each instruction atomic.
- Avoid examples unless needed to prevent failure.
- If examples are required, include one minimal example.
Ambiguity Checks
Before finalizing a prompt, verify:
- Any undefined noun is resolved.
- Any pronoun has a clear antecedent.
- Scope limits are explicit (time range, file range, quantity limits).
- Success criteria are testable.
- Output format is unambiguous.
Prose Rewrite Checks
When rewriting, ensure the final prompt:
- Uses fewer words than the original.
- Packs more actionable guidance into the first 8,000 bytes; record before/after total bytes, contract-end byte, and any required detail moved behind a link.
- Preserves all required constraints.
- Uses concrete nouns instead of pronouns where possible.
- Avoids optional wording unless options are actually allowed.
- States required output and any length bound in plain language.
04 同仓库更多 Skills
cracktro
Edit, preview, and verify the standalone interactive talk deck in docs/public/cracktro (slides, SVG diagrams, transitions, WebAudio sound).
create-connector
Create or extend a declaration-only third-party connector, with narrow reads, separate safe outputs, optional protected triggers, and offline conformance evidence.
GitHub 智能体工作流
GitHub Agentic Workflows
GitHub Agentic Workflows(`gh-aw`)是一个 GitHub CLI 扩展,用于以 Markdown 编写 Agentic Workflows(智能体工作流)并将其编译为 GitHub Actions。
Windows 跨平台兼容处理
windows-compatibility
跨平台路径处理和命令模式。
Squad SDK 语义化版本规范
versioning-policy
Squad SDK 和 CLI 的 Semver(语义化版本)版本规则——防止预发布版本事故。
智能体分层记忆管理
tiered-memory
三层智能体记忆模型(热/冷/维基),用于减少每次生成(spawn)时的上下文。