大语言模型

llm

by BytesAgain

Build and evaluate LLM prompts. Use when crafting system prompts, comparing variants, estimating tokens, or managing prompt templates.

4.5kAI 与智能体未扫描2026年3月23日

安装

claude skill add --url github.com/openclaw/skills/tree/main/skills/bytesagain/llm

文档

llm

LLM Prompt Engineering Toolkit. Build structured prompts from role/context/task components, compare prompt variations side by side, estimate token counts, manage reusable prompt templates, chain multi-step prompts, and evaluate prompt quality with a scored breakdown. All commands run locally in bash with no API keys or network access required.

Commands

prompt — Build a Structured Prompt

Assembles a prompt from modular components: role, context, task, constraints, and output format. The --task flag is required; all others are optional.

Flags:

  • --role <text> — Define the AI's persona (e.g., "senior developer")
  • --context <text> — Provide background information
  • --task <text>(required) The main instruction
  • --constraints <text> — Rules or limitations
  • --format <text> — Desired output format
bash
bash scripts/script.sh prompt --role "senior developer" --context "Python Flask app" --task "write unit tests"
bash scripts/script.sh prompt --task "summarize this article" --constraints "max 3 sentences" --json

compare — Compare Prompt Variations

Compare two or more prompt files side by side. Shows each variant with word/line/char/token stats, then a diff --side-by-side of the first two variants, plus a summary table.

Flags:

  • --prompts <file1> <file2> [file3...] — Two or more prompt text files to compare
bash
bash scripts/script.sh compare --prompts prompt_a.txt prompt_b.txt
bash scripts/script.sh compare --prompts v1.txt v2.txt v3.txt

tokenize — Estimate Token Count

Estimate the token count for a given text using a cl100k_base-compatible heuristic. Reports characters, words, lines, and estimated tokens.

Input methods:

  • --input <text> — Inline text string
  • --file <path> — Read from a file
  • Pipe via stdin
bash
bash scripts/script.sh tokenize --input "Your prompt text here"
bash scripts/script.sh tokenize --file prompt.txt
echo "some text" | bash scripts/script.sh tokenize
bash scripts/script.sh tokenize --file prompt.txt --json

template — Manage Prompt Templates

Save, list, load, and delete reusable prompt templates. Templates are stored as .txt files in ~/.llm-skill/templates/.

Actions:

  • --save <name> --file <path> — Save a template from a file (or pipe via stdin)
  • --list — List all saved templates with sizes
  • --load <name> — Output the contents of a saved template
  • --delete <name> — Remove a saved template
bash
bash scripts/script.sh template --save my_template --file prompt.txt
bash scripts/script.sh template --list
bash scripts/script.sh template --list --json
bash scripts/script.sh template --load my_template
bash scripts/script.sh template --delete my_template
echo "Write a haiku about {{topic}}" | bash scripts/script.sh template --save haiku

chain — Multi-Step Prompt Chains

Run a sequence of prompt steps where each step's output feeds into the next via the {{previous_output}} placeholder. Steps can be specified as individual files or loaded from a JSON config.

Flags:

  • --steps <file1> <file2> [...] — Ordered list of step files
  • --from <config.json> — Load steps from a JSON configuration file
bash
bash scripts/script.sh chain --steps step1.txt step2.txt step3.txt
bash scripts/script.sh chain --from chain_config.json
bash scripts/script.sh chain --steps brainstorm.txt refine.txt format.txt --json

evaluate — Score Prompt Quality

Score a prompt on four dimensions (0–100 each): Clarity, Specificity, Structure, and Completeness. Returns an overall score (0–100) and letter grade (A–F) with actionable suggestions.

Scoring heuristics:

  • Clarity — Penalizes vague words ("something", "stuff"), rewards action verbs ("write", "create", "analyze") and structural markers
  • Specificity — Rewards concrete numbers, quoted examples, and sufficient length
  • Structure — Rewards headers, bullet lists, numbered steps, and paragraph breaks
  • Completeness — Checks for role definition, output format spec, constraints, and examples
bash
bash scripts/script.sh evaluate --input "Explain quantum computing"
bash scripts/script.sh evaluate --file my_prompt.txt
bash scripts/script.sh evaluate --file my_prompt.txt --json

help — Show Help

bash
bash scripts/script.sh help

Global Flags

  • --json — Output in JSON format (supported by prompt, tokenize, template --list, chain, and evaluate)

Data Storage

  • Templates: ~/.llm-skill/templates/*.txt
  • No other persistent state. All commands are stateless except template which manages saved files.

Requirements

  • Bash 4+ (uses arrays, [[ ]], process substitution)
  • Standard Unix utilities: wc, grep, diff, cat, basename, tr, sed, rm, mkdir
  • No external dependencies, API keys, or network access required

When to Use

  1. Crafting system prompts — Use prompt to build well-structured prompts from role/context/task components instead of writing them freehand.
  2. A/B testing prompt variants — Use compare to see side-by-side diffs and token counts for two or more prompt versions before committing to one.
  3. Estimating API costs — Use tokenize to get token estimates before sending prompts to paid LLM APIs, helping you stay within budget.
  4. Building reusable prompt libraries — Use template to save, organize, and reuse your best prompts across projects.
  5. Quality-checking prompts before use — Use evaluate to score your prompts on clarity, specificity, structure, and completeness, with actionable improvement suggestions.

Examples

bash
# Build a structured prompt for code review
bash scripts/script.sh prompt \
  --role "senior code reviewer" \
  --context "React TypeScript project" \
  --task "review this pull request for bugs and performance issues" \
  --constraints "focus on security vulnerabilities" \
  --format "numbered list of findings"

# Estimate tokens for a long prompt
bash scripts/script.sh tokenize --file system_prompt.txt

# Save a template and reuse it
echo "You are a {{role}}. Your task: {{task}}" | bash scripts/script.sh template --save generic
bash scripts/script.sh template --load generic

# Evaluate prompt quality
bash scripts/script.sh evaluate --input "You are an expert Python developer. Write a function that sorts a list of dictionaries by a given key. Include type hints, docstring, and 3 unit tests."

Powered by BytesAgain | bytesagain.com | hello@bytesagain.com

相关 Skills

Claude接口

by anthropics

Universal
热门

面向接入 Claude API、Anthropic SDK 或 Agent SDK 的开发场景,自动识别项目语言并给出对应示例与默认配置,快速搭建 LLM 应用。

想把Claude能力接进应用或智能体,用claude-api上手快、兼容Anthropic与Agent SDK,集成路径清晰又省心

AI 与智能体
未扫描139.0k

RAG架构师

by alirezarezvani

Universal
热门

聚焦生产级RAG系统设计与优化,覆盖文档切块、检索链路、索引构建、召回评估等关键环节,适合搭建可扩展、高准确率的知识库问答与检索增强应用。

面向RAG落地,把知识库、向量检索和生成链路系统串联起来,做架构设计时更清晰,也更少踩坑。

AI 与智能体
未扫描15.8k

多智能体架构

by alirezarezvani

Universal
热门

聚焦多智能体系统架构设计,梳理 Supervisor、Swarm、分层和 Pipeline 等模式,覆盖角色定义、通信协作与性能评估,适合规划稳健可扩展的 AI agent 编排方案。

帮你系统解决多智能体应用的架构设计与协同编排难题,适合构建复杂 AI 工作流,成熟度高、社区认可也很亮眼。

AI 与智能体
未扫描15.8k

相关 MCP 服务

知识图谱记忆

编辑精选

by Anthropic

热门

Memory 是一个基于本地知识图谱的持久化记忆系统,让 AI 记住长期上下文。

帮 AI 和智能体补上“记不住”的短板,用本地知识图谱沉淀长期上下文,连续对话更聪明,数据也更可控。

AI 与智能体
86.1k

顺序思维

编辑精选

by Anthropic

热门

Sequential Thinking 是让 AI 通过动态思维链解决复杂问题的参考服务器。

这个服务器展示了如何让 Claude 像人类一样逐步推理,适合开发者学习 MCP 的思维链实现。但注意它只是个参考示例,别指望直接用在生产环境里。

AI 与智能体
86.1k

PraisonAI

编辑精选

by mervinpraison

热门

PraisonAI 是一个支持自反思和多 LLM 的低代码 AI 智能体框架。

如果你需要快速搭建一个能 24/7 运行的 AI 智能体团队来处理复杂任务(比如自动研究或代码生成),PraisonAI 的低代码设计和多平台集成(如 Telegram)让它上手极快。但作为非官方项目,它的生态成熟度可能不如 LangChain 等主流框架,适合愿意尝鲜的开发者。

AI 与智能体
7.9k

相关资讯

本文发现RLVR训练的权重轨迹是低秩且可预测的,秩一近似即可捕获大部分性能增益。基于此提出RELEX方法,通过短窗口观测估计秩一子空间,并用线性回归外推未来检查点,仅需15%的训练步数即可匹配或超越完整RLVR性能。该方法能外推到观测窗口的10-20倍以上,且无需学习模型,归功于秩一投影的降噪效应。

深度·5月23日·25 分钟

ThoughtTrace是首个大规模数据集,记录了用户与AI对话中的自述想法(发送提示的原因及对回复的反应),包含1,058名用户、2,155次对话及10,174条想法标注。分析表明,想法与消息语义不同,大模型难以从上下文推断,并能提升用户行为预测和个性化助手训练质量。该数据集为理解人机交互中的认知动态提供了新模态。

深度·5月22日·21 分钟

本文提出HASP框架,将智能体技能升级为可执行程序函数,在推理时或训练后主动干预智能体循环。在网页搜索、数学推理和编程任务上,HASP相比现有方法提升25%-30%性能,揭示了技能内化与稳定演化的机制。

深度·5月22日·20 分钟

评论