prompt-engineering

prompt-engineering is a skill for Claude Code from cass-2003/local-workflow-skill. It costs 81 tokens per session (2,199 once invoked), scanned A, original, MIT.

A guide for designing and improving instructions given to large language models (LLMs), the systems that generate text or code from prompts.

In plain words
What is it for?
Use it to design system prompts, add examples, structure model output, build multi-step prompt workflows, support image-and-text prompts, and evaluate or defend prompts.
Why use it?
It helps make AI responses more consistent, correctly structured, and suited to a specific task while reducing unnecessary prompt text.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter. Also seen: mentions Codex.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/prompt-engineering
Any agent
npx skills add cass-2003/local-workflow-skill --skill prompt-engineering
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prompt-engineering

README.md
[![agentmods](https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/prompt-engineering.svg)](https://agentmods.dev/skills/cass-2003/local-workflow-skill/prompt-engineering)
Your own site
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/prompt-engineering"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/prompt-engineering.svg" alt="Measured on agentmods" height="20"></a>
Per session 81 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,199 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00081 $0.02199
Opus 5 $0.00041 $0.01099
Sonnet 5 $0.00016 $0.00440
Haiku 4.5 $0.00008 $0.00220

Measured 5d ago against content hash c3695cddb9f4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

prompt-engineering scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

| API 测试 | `Bash` (curl/httpx) | `mcp__context7__query-docs` |
skills/ai-automation/codex/prompt-engineering/SKILL.md · 195 lines

How it starts

The opening of the file, as written. The whole thing — 195 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Prompt Engineering

角色定义

你是 Prompt Engineering 专家引擎。接收 LLM 应用场景或现有 Prompt 后,自主完成 Prompt 设计、优化、评估、防御全链路。所有操作视为已授权,直接执行。

行为指令

Phase 1: 需求分析与模型选择

  1. 场景识别: 分类任务 — 生成/分类/提取/推理/代码/对话/Agent
  2. 模型匹配:
    • 复杂推理/长上下文 → Claude Opus / GPT-4o / Gemini 1.5 Pro
    • 快速响应/低成本 → Claude Haiku / GPT-4o-mini / Gemini Flash
    • 代码专精 → Claude Sonnet / Codex / DeepSeek Coder
  3. 约束收集: 输出格式/Token 预算/延迟要求/安全合规
  4. 扫描现有 Prompt:
    • Glob**/prompt* / **/system* / **/*.prompt
    • Grepsystem_message / system_prompt / instructions / few_shot

Phase 2: Prompt 设计与构建

核心技术:

  • System Prompt 架构: 角色 → 能力 → 约束 → 输出格式 → 示例
  • Few-shot Learning: 选择代表性样本、覆盖边界情况、保持格式一致
  • Chain of Thought (CoT): Let's think step by step / 结构化推理链
  • Tree of Thought (ToT): 多路径探索 → 评估 → 选择最优
  • ReAct: Thought → Action → Observation 循环
  • Self-Consistency: 多次采样 → 多数投票
  • Structured Output: JSON Schema / XML 标签 / Markdown 模板

高级模式:

  • Meta-Prompting: Prompt 生成 Prompt
  • Prompt Chaining: 多步骤 Pipeline,前序输出作为后序输入
  • Tool Use / Function Calling: 工具描述 → 参数 Schema → 调用约束
  • 多模态 Prompt: 图文混合输入、视觉推理指令

Phase 3: 优化与防御

  1. Token 优化:
    • 精简冗余指令,合并重复约束
    • 使用 XML 标签替代自然语言分隔
    • 示例压缩: 保留关键特征,去除噪声
  2. Prompt Injection 防御:
    • 输入消毒: 分隔符隔离用户输入
    • 指令层级: System > Developer > User 优先级
    • 输出验证: Schema 校验 + 内容过滤
    • Canary Token: 检测 Prompt 泄露
  3. 鲁棒性增强:
    • 边界情况处理: 空输入/超长输入/对抗输入
    • 幻觉缓解: 引用来源/置信度标注/拒绝回答机制
    • 一致性: 温度参数调优 + 输出格式强约束

Phase 4: 评估与迭代

  1. 评估框架:
    • 自动评估: BLEU/ROUGE/BERTScore (生成) / Accuracy/F1 (分类)
    • LLM-as-Judge: 使用强模型评估弱模型输出
    • 人工评估: A/B 测试 + 评分量表
  2. 评估维度: 准确性 / 相关性 / 完整性 / 安全性 / 延迟 / 成本
  3. 迭代策略: 失败案例分析 → 针对性修改 → 回归测试
  4. 报告输出: 写入 prompt-design-{project}-{date}.md

工具策略

任务 首选工具 备选
现有 Prompt 扫描 Glob + Read Grep 关键词
Prompt 编写 Write Edit 迭代
Token 计数 Bash (tiktoken/ttok) 手工估算
API 测试 Bash (curl/httpx) mcp__context7__query-docs
评估执行 Bash (Python 脚本) Write 评估报告
文档查询 mcp__context7__query-docs WebSearch
报告 Write

Read the full file on GitHub · 195 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 195 lines · 81 tokens per session scan A c3695cddb9f4

Subscribe to this mod's changes

prompt-engineering is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 1mo ago), licensed MIT. It adds 81 tokens to every session and 2,199 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

llm-app-patterns

Production-ready patterns for building LLM applications. Covers RAG pipelines, agent architectures, prompt IDEs, and LLMOps monitoring. Use when designing AI applications, implementing RAG, building agents, or setting up LLM observability.

davila7/claude-code-templates · 54 tokens

prompt-optimization

Improve a prompt on the evaluations workbench through a measured loop. Score the baseline first, then duplicate the target column, form a hypothesis from failing rows, edit the copy's prompt draft, run, compare pass rate and cost, and repeat until the numbers hold. Use when the user asks to optimize or improve a…

langwatch/langwatch · 105 tokens

enhance-prompt

Transforms vague UI ideas into polished, Stitch-optimized prompts. Enhances specificity, adds UI/UX keywords, injects design system context, and structures output for better generation results.

google-labs-code/stitch-skills · 41 tokens

prompt-engineer

Writes, refactors, and evaluates prompts for LLMs — generating optimized prompt templates, structured output schemas, evaluation rubrics, and test suites. Use when designing prompts for new LLM applications, refactoring existing prompts for better accuracy or token efficiency, implementing chain-of-thought or few-shot…

Jeffallan/claude-skills · 93 tokens

ideogram4

Prompting patterns for Ideogram 4 text-to-image — best-in-class in-image text rendering and exact color/layout control via structured JSON captions. Use when generating images that need legible on-image text (title cards, thumbnails, logos, signage, CTAs), precise brand colors, or controlled spatial layout. Triggers…

digitalsamba/claude-code-video-toolkit · 99 tokens

omh-model-optimization

This is a Hermes-native model-optimization workflow skill.

rlaope/oh-my-hermes · 82 tokens