Token导航 LogoToken导航TokenDH.com
运维和基础设施只读github未标认证来源可访问许可证需确认审计通过

prompt-engineering及时工程

Agent Skill

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

总安装

18,046

周安装

723

GitHub Stars

229

下载量

5,842
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:prompt-engineering(及时工程)
来源仓库:https://github.com/giuseppe-trisciuoglio/developer-kit
仓库路径:skills/prompt-engineering
安装命令:
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill prompt-engineering
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill prompt-engineering

简介

用于少量学习、思维链推理、优化、模板和系统提示设计的高级提示模式。

  • 涵盖五个核心模式类别:具有语义多样性的少样本示例选择、思维链推理轨迹、具有 A/B 测试的迭代优化工作流程、具有变量插值的模块化模板系统以及全面的系统提示架构
  • 包括用于创建新提示、优化现有提示以及通过版本控制和监控将系统扩展到生产环境的结构化实施工作流程
  • 提供具有验证要求(10 多个测试场景、边缘案例、一致性检查)和性能标准(>90% 任务完成率,<5% 方差)的质量保证框架
  • 参考五个详细的模式指南,涵盖少样本策略、CoT 框架、优化方法、模板设计和系统提示最佳实践

SKILL.md

Prompt Engineering

Overview

Use this skill to design prompt systems that are clear, testable, and reusable. It covers prompt drafting, optimization, evaluation, and production-oriented patterns for few-shot prompting, reasoning workflows, templates, and system prompts.

Keep the main workflow in this file and load the targeted reference files only for the pattern you are applying.

When to Use

Use this skill when:

  • A user asks to write, rewrite, or improve a prompt
  • A prompt needs better structure, reliability, or output formatting
  • Few-shot examples or reasoning scaffolds are needed
  • A system prompt or reusable prompt template must be created
  • An existing prompt needs measurable optimization and testing

Read the relevant files in references/ when you need deeper guidance on a specific pattern.

Core Patterns

1. Few-Shot Learning

Example Selection Strategy

  • Use references/few-shot-patterns.md for comprehensive selection frameworks
  • Balance example count (3-5 optimal) with context window limitations
  • Include edge cases and boundary conditions in example sets
  • Prioritize diverse examples that cover problem space variations
  • Order examples from simple to complex for progressive learning

Few-Shot Example (Sentiment Classification)

Classify the sentiment as Positive, Negative, or Neutral.

Text: "I love this product! It exceeded my expectations."
Sentiment: Positive
Reasoning: Enthusiastic language, positive adjectives, satisfaction

Text: "The app keeps crashing when I upload large files."
Sentiment: Negative
Reasoning: Complaint about functionality, frustration indicator

Text: "It arrived on time, as described."
Sentiment: Neutral
Reasoning: Factual statement, no strong emotion either way

Text: "{user_input}"
Sentiment:
Reasoning:

2. Chain-of-Thought Reasoning

Implementation Patterns

  • Reference references/cot-patterns.md for detailed reasoning frameworks
  • Use "Let's think step by step" for zero-shot CoT initiation
  • Provide complete reasoning traces for few-shot CoT demonstrations
  • Implement self-consistency by sampling multiple reasoning paths
  • Include verification and validation steps in reasoning chains

CoT Template Structure

Let's approach this step-by-step:

Step 1: {break_down_the_problem}
Analysis: {detailed_reasoning}

Step 2: {identify_key_components}
Analysis: {component_analysis}

Step 3: {synthesize_solution}
Analysis: {solution_justification}

Final Answer: {conclusion_with_confidence}

3. Prompt Optimization

Optimization Process

  • Use references/optimization-frameworks.md for comprehensive optimization strategies
  • Measure baseline performance before optimization attempts
  • Implement single-variable changes for accurate attribution
  • Track metrics: accuracy, consistency, latency, token efficiency
  • Use statistical significance testing for A/B validation
  • Document optimization iterations and their impacts

Track these metrics: accuracy, consistency, token efficiency, robustness, safety. See references/optimization-frameworks.md for measurement utilities.

4. Template Systems

Template Design Principles

  • Reference references/template-systems.md for modular template frameworks
  • Use clear variable naming conventions (e.g., {user_input}, {context})
  • Implement conditional sections for different scenario handling
  • Design role-based templates for specific use cases
  • Create hierarchical template composition patterns

Template Structure Example

# System Context
You are a {role} with {expertise_level} expertise in {domain}.

# Task Context
{if background_information}
Background: {background_information}
{endif}

# Instructions
{task_instructions}

# Examples
{example_count}

# Output Format
{output_specification}

# Input
{user_query}

5. System Prompt Design

System Prompt Components

  • Use references/system-prompt-design.md for detailed design guidelines
  • Define clear role specification and expertise boundaries
  • Establish output format requirements and structural constraints
  • Include safety guidelines and content policy adherence
  • Set context for background information and domain knowledge

System Prompt Framework

You are an expert {role} specializing in {domain} with {experience_level} of experience.

## Core Capabilities
- List specific capabilities and expertise areas
- Define scope of knowledge and limitations

## Behavioral Guidelines
- Specify interaction style and communication approach
- Define error handling and uncertainty protocols
- Establish quality standards and verification requirements

## Output Requirements
- Specify format expectations and structural requirements
- Define content inclusion and exclusion criteria
- Establish consistency and validation requirements

## Safety and Ethics
- Include content policy adherence
- Specify bias mitigation requirements
- Define harm prevention protocols

Implementation Workflows

Workflow 1: Create New Prompt from Requirements

  1. Analyze Requirements

- Identify task complexity and reasoning requirements - Determine target model capabilities and limitations - Define success criteria and evaluation metrics - Assess need for few-shot learning or CoT reasoning

  1. Select Pattern Strategy

- Use few-shot learning for classification or transformation tasks - Apply CoT for complex reasoning or multi-step problems - Implement template systems for reusable prompt architecture - Design system prompts for consistent behavior requirements

  1. Draft Initial Prompt

- Structure prompt with clear sections and logical flow - Include relevant examples or reasoning demonstrations - Specify output format and quality requirements - Incorporate safety guidelines and constraints

  1. Validate and Test

- Test with at least 3 inputs: one happy path, one edge case, one adversarial - Measure accuracy and token usage against defined success criteria - Change one variable at a time, re-test, keep only what improves metrics - Document optimization decisions and their rationale

Workflow 2: Optimize Existing Prompt

  1. Performance Analysis

- Measure current prompt performance metrics - Identify failure modes and error patterns - Analyze token efficiency and response latency - Assess consistency across multiple runs

  1. Optimization Strategy

- Apply systematic A/B testing with single-variable changes - Use few-shot learning to improve task adherence - Implement CoT reasoning for complex task components - Refine template structure for better clarity

  1. Implementation and Testing

- Re-run the same test cases from step 1 against the optimized prompt - If accuracy < baseline, revert the change and try a different hypothesis - If accuracy >= baseline but < 90%, return to step 2 with a new strategy - Document the winning change and its measured impact

Workflow 3: Scale Prompt Systems

  1. Modular Architecture Design

- Decompose complex prompts into reusable components - Create template inheritance hierarchies - Implement dynamic example selection systems - Build automated quality assurance frameworks

  1. Production Integration

- Implement prompt versioning and rollback capabilities - Create performance monitoring and alerting systems - Build automated testing frameworks for prompt validation - Establish update and deployment workflows

Quality Gates

  • Accuracy >90% on 10+ diverse test cases before shipping
  • <5% variance across 3+ repeated runs
  • All edge cases and adversarial inputs handled gracefully
  • Output format matches spec on every test case

Best Practices

  • Optimize one variable at a time so results stay attributable
  • Keep prompts explicit about task, context, constraints, and output format
  • Prefer a small number of strong examples over many repetitive ones
  • Test prompts against happy-path, edge-case, and adversarial inputs
  • Move long pattern details to references/ instead of bloating SKILL.md

Constraints and Warnings

  • Do not assume longer prompts are better; extra detail often adds ambiguity
  • Avoid exposing hidden reasoning requirements when a concise rationale is enough
  • Validate prompts on representative inputs before claiming improvement
  • Keep model-specific assumptions explicit because behavior varies across models

Integration with Other Skills

This skill integrates seamlessly with:

  • langchain4j-ai-services-patterns: Interface-based prompt design
  • langchain4j-rag-implementation-patterns: Context-enhanced prompting
  • langchain4j-testing-strategies: Prompt validation frameworks
  • unit-test-parameterized: Systematic prompt testing approaches

Resources and References

  • references/few-shot-patterns.md: Comprehensive few-shot learning frameworks
  • references/cot-patterns.md: Chain-of-thought reasoning patterns and examples
  • references/optimization-frameworks.md: Systematic prompt optimization methodologies
  • references/template-systems.md: Modular template design and implementation
  • references/system-prompt-design.md: System prompt architecture and best practices

Common Pitfalls and Solutions

PitfallFix
Wrong output formatAdd a concrete output example at the end of the prompt
Inconsistent answersAdd 2-3 few-shot examples showing expected reasoning
HallucinationAdd "If unsure, say 'I don't know'" + constrain the answer domain
Too verboseAdd explicit word/sentence limit + "Be concise" instruction
Missed edge casesAdd an edge-case few-shot example

Constraints

  • Test across target models — capabilities and token limits vary
  • Keep few-shot examples to 3-5 to manage context usage
  • Validate with domain-specific test cases before production

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.35%
按下载量换算2,065

Claude

28.69%
按下载量换算1,676

Cursor

18.69%
按下载量换算1,092

Gemini CLI

8.15%
按下载量换算476

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills