Agent Skillsstagewise-io/stagewise › prompt-optimization

prompt-optimization

GitHub

指导构建、审查和优化LLM系统提示词,涵盖从零创建、现有提示词审计及Token压缩优化。遵循清晰性、安全性与结构化原则,提供标准架构与工作流参考。

.agents/skills/prompt-optimization/SKILL.md stagewise-io/stagewise

Trigger Scenarios

编写或优化系统提示词 减少提示词Token用量 审查提示词安全性与偏见

Install

npx skills add stagewise-io/stagewise --skill prompt-optimization -g -y
More Options

Non-standard path

npx skills add https://github.com/stagewise-io/stagewise/tree/main/.agents/skills/prompt-optimization -g -y

Use without installing

npx skills use stagewise-io/stagewise@prompt-optimization

指定 Agent (Claude Code)

npx skills add stagewise-io/stagewise --skill prompt-optimization -a claude-code -g -y

安装 repo 全部 skill

npx skills add stagewise-io/stagewise --all -g -y

预览 repo 内 skill

npx skills add stagewise-io/stagewise --list

SKILL.md

Frontmatter
{
    "name": "prompt-optimization",
    "description": "Guides building, reviewing, and optimizing system prompts and prompt templates for LLMs. Use when creating system prompts, writing prompt templates, optimizing prompt structure, reducing prompt token usage, compressing prompts, improving prompt clarity, reviewing prompts for safety and bias, or making prompts more token-efficient. Also use when the user says \"write a prompt,\" \"optimize this prompt,\" \"system prompt,\" \"prompt engineering,\" \"make this prompt better,\" \"reduce tokens,\" or \"compress this prompt.\""
}

Prompt Optimization

Build effective, safe, and token-efficient system prompts for LLMs.

How to Use This Skill

Pick the workflow that matches the task, then follow it end-to-end:

Task Workflow Reference
Write a new prompt from scratch Create workflow references/workflows.md → Workflow 1
Review/audit an existing prompt Review workflow references/workflows.md → Workflow 2
Reduce token count of a working prompt Optimize workflow references/workflows.md → Workflow 3

Each workflow references the specific detail pages below as needed. Do not read all references upfront — load them when the workflow step calls for them.

Core Principles

  1. Clarity over cleverness — Write prompts a new employee would follow without confusion
  2. Positive framing — Say what to do, not what to avoid
  3. Structure with delimiters — XML tags or consistent separators between content types
  4. Progressive specificity — Role → constraints → instructions → context → format → examples → input
  5. Token economy — Every token must earn its place; ≥1 constraint per 5–10 tokens
  6. Safety by default — Prevent injection, data leakage, and bias structurally

Prompt Architecture (ordering)

1. Identity / Role          — Who the model is (1–2 sentences)
2. Core behavior rules      — Non-negotiable constraints (safety, tone)
3. Task instructions        — What to do and how
4. Context / Knowledge      — Domain data, schemas, reference docs
5. Output format            — Structure, length, style requirements
6. Examples (few-shot)      — 2–3 input/output pairs in <example> tags
7. Dynamic input            — User content (always last, always delimited)

Key Rules

  • Delimit user input — Wrap in tags like <user_input>; never interpolate raw
  • Show, don't just tell — Few-shot examples beat format descriptions
  • Match prompt style to output style — Markdown in prompt → markdown out; prose → prose
  • Put long documents first — Reference data above instructions (30%+ quality gain)
  • Quantify, don't qualify — "≤100 words" not "keep it short"
  • Imperative voice — "Respond in JSON" not "You should format your response as JSON"
  • Test adversarially — Injection, edge cases, ambiguous inputs before shipping

Reference Index

Load these when a workflow step calls for them:

Reference Contents
references/workflows.md End-to-end workflows for create, review, and optimize tasks
references/clarity-and-structure.md XML tags, delimiters, role prompting, long-context patterns
references/output-control.md Format steering, verbosity control, few-shot examples
references/safety-and-security.md Injection prevention, bias mitigation, data leakage, red-teaming
references/compression-techniques.md High-density writing, token pruning, compression methods, density test
references/agentic-prompts.md Tool use, thinking/reasoning, state tracking, subagent orchestration
references/anti-patterns-and-checklist.md 8 anti-patterns, design checklist, evaluation metrics

Version History

  • 45a1544 Current 2026-07-24 21:12

Same Skill Collection

.agents/skills/add-llm-model/SKILL.md
.agents/skills/caveman/SKILL.md
.agents/skills/create-skill/SKILL.md
.agents/skills/history-compression/SKILL.md
.agents/skills/karton-best-practices/SKILL.md
.agents/skills/stage-ui-design-system/SKILL.md
.agents/skills/vercel-react-best-practices/SKILL.md
apps/browser/bundled/plugins/figma/SKILL.md
apps/browser/bundled/plugins/github/SKILL.md
apps/browser/bundled/plugins/javascript-sandbox/SKILL.md
apps/browser/bundled/plugins/mini-apps/SKILL.md
apps/browser/bundled/plugins/posthog/SKILL.md
apps/browser/bundled/plugins/remotion/SKILL.md
apps/browser/bundled/plugins/supabase/SKILL.md
apps/browser/bundled/plugins/vercel/SKILL.md
apps/browser/bundled/skills/debug/SKILL.md
apps/browser/bundled/skills/learn-skill/SKILL.md
apps/browser/bundled/skills/plan/SKILL.md
apps/browser/bundled/skills/preview/SKILL.md
apps/browser/bundled/skills/watch/SKILL.md
.agents/skills/copywriting/SKILL.md
apps/browser/bundled/skills/implement/SKILL.md

Metadata

Files
0
Version
18ac8a2
Hash
0070b32e
Indexed
2026-07-24 21:12

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 19:18
浙ICP备14020137号-1 $방문자$