大语言模型

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 与智能体
未扫描158.9k

RAG架构师

by alirezarezvani

Universal
热门

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

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

AI 与智能体
未扫描21.3k

多智能体架构

by alirezarezvani

Universal
热门

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

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

AI 与智能体
未扫描21.3k

相关 MCP 服务

知识图谱记忆

编辑精选

by Anthropic

热门

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

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

AI 与智能体
88.1k

顺序思维

编辑精选

by Anthropic

热门

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

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

AI 与智能体
88.1k

by deusdata

热门

持久化的代码库知识图谱,可跨会话保留上下文,在 session 重启或上下文压缩后仍能继续使用。

专治 AI 编程助手“会话失忆”,把代码库沉淀为持久知识图谱,重启或压缩上下文后也能无缝续上开发状态。

AI 与智能体
26.9k

相关资讯

作者基于 LLM 库构建了一个简单的编码 Agent,实现了文件编辑、命令执行、文件搜索等工具,并通过 CLI 和 Python API 提供交互。实验展示了 Agent 自动生成代码的能力。

教程Simon Willison·7月2日·4 分钟

本文分析了传统 CI/CD 对 LLM 管线的不足,并介绍了基线评估、漂移检测、影子验证和成本延迟检查四个发布关卡。通过实际代码示例,展示了如何将这些关卡集成到现有 CI/CD 流水线中,以在部署前捕捉模型漂移和回归。

指南The New Stack·7月2日·7 分钟

本文回顾了 autofz 的设计动机、核心挑战和实际效果,强调其“控制平面”思想在 LLM 时代的复用价值。文章指出,面对多 worker 系统(如今可以是模糊器、静态分析器、代码智能体等),关键在于运行时动态调度而非静态组合。通过实验数据展示了 autofz 如何通过准备阶段和聚焦阶段交替进行资源分配,以及在决策可靠性上的深入分析。

深度·7月2日·12 分钟

评论