Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

prompt-engineering

БесплатноБез исполняемых скриптовНе проверен

Write effective prompts for AI coding agents. Use when crafting system prompts, implementing chain-of-thought reasoning, building few-shot examples, adding…

diegosouzapwот diegosouzapw★ 68 звёзд на GitHub

Об этом скилле

Prompt Engineering

Purpose: Write effective prompts for AI coding agents and workflows.
Scope: System prompts, reasoning patterns, guardrails, tool use, agentic workflows.


When to Use This Skill

  • Crafting system prompts for AI agents
  • Implementing chain-of-thought reasoning
  • Building few-shot prompt examples
  • Adding content guardrails and safety filters
  • Configuring tool/function calling patterns

Prerequisites

  • Understanding of LLM capabilities and limitations
  • Access to an AI model endpoint

Decision Tree

Writing a prompt?
├─ Simple, well-known task?
│   └─ Zero-shot (just instructions)
├─ Need specific output format?
│   └─ Few-shot (2-3 examples of input → output)
├─ Complex reasoning required?
│   ├─ Step-by-step? → Chain-of-thought ("think step by step")
│   └─ Multi-perspective? → Self-consistency (sample multiple paths)
├─ Agent / tool-use scenario?
│   ├─ Define tool schemas clearly
│   ├─ Add guardrails (what NOT to do)
│   └─ Include error recovery instructions
├─ System prompt for coding agent?
│   ├─ Role + constraints + format + examples
│   └─ Keep under 4K tokens for efficiency
└─ Prompt too long?
    └─ Progressive disclosure: load details on demand

Quick Reference

Pattern When to Use Token Cost
Zero-Shot Simple tasks, well-known domains Low
Few-Shot Consistent output format needed Medium
Chain-of-Thought Multi-step reasoning, debugging Medium
ReAct Tool use, agentic workflows High
Reflection Self-correction, quality improvement High

System Prompts

Structure

Every system prompt should have four parts:

1. ROLE       → Who the AI is
2. CONTEXT    → What it knows about the situation
3. TASK       → What it should do
4. CONSTRAINTS → What it must NOT do

Good Example

You are a senior Python engineer reviewing pull requests.

CONTEXT:
- Project uses FastAPI + SQLAlchemy + pytest
- Code follows PEP 8 and uses type hints
- Test coverage target: 80%+

TASK:
Review the code changes and provide:
1. Security issues (critical)
2. Bug risks (high)
3. Style improvements (low)

CONSTRAINTS:
- Do NOT rewrite code, only point out issues
- Do NOT suggest changes outside the diff
- Rate each issue: critical / high / medium / low

Anti-Patterns

Don't Do Instead
"Be helpful" "You are a Python code reviewer"
"Do your best" "List exactly 3 issues per file"
"Be careful" "NEVER execute DELETE queries"
Long paragraphs Bullet points and numbered lists
Vague instructions Specific output format with examples
Inline prompt strings in code Load from prompts/{agent}.md file
Inline output templates in code Load from templates/{name}.md file

File-Based Prompt Management

RULE: ALWAYS store prompts in separate files. NEVER embed multi-line prompts or output templates as string literals in code.

Directory Convention

project/
  prompts/                    # System & agent prompts
    assistant.md              # One file per agent/role
    code-reviewer.md
    researcher.md
  templates/                  # Output format templates
    review-report.md          # Structured output templates
    analysis-summary.md
  config/
    models.yaml               # Model configuration

Prompt File Format

<!-- prompts/code-reviewer.md -->
<!-- Purpose: System prompt for code review agent -->
<!-- Model: gpt-5.1 | Max tokens: ~1500 -->

You are a senior Python engineer reviewing pull requests.

## Context
- Project uses FastAPI + SQLAlchemy + pytest
- Code follows PEP 8 and uses type hints
- Test coverage target: 80%+

## Task
Review the code changes and provide:
1. Security issues (critical)
2. Bug risks (high)
3. Style improvements (low)

## Constraints
- Do NOT rewrite code, only point out issues
- Do NOT suggest changes outside the diff
- Rate each issue: critical / high / medium / low

Loading Pattern

from pathlib import Path

# Load prompt from file
prompt = Path("prompts/code-reviewer.md").read_text(encoding="utf-8")

# Load output template and combine
template = Path("templates/review-report.md").read_text(encoding="utf-8")
full_prompt = f"{prompt}\n\n## Output Format\n{template}"

Rules

  • MUST store all prompts ≥2 lines in prompts/ as .md files
  • MUST store output format templates in templates/ as .md files
  • MUST NOT embed prompt text as multi-line strings in Python/C#/TS code
  • SHOULD use Markdown format (readable, supports headers/lists)
  • SHOULD name files after the agent role: prompts/{role}.md
  • SHOULD include a comment header: purpose, target model, token estimate
  • MAY use {variable} placeholders for runtime injection

Why Separate Files?

Benefit Explanation
Version control Git diffs show exa
Полный SKILL.md на GitHub

Установить prompt-engineering в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

metadata.json

FAQ

Что делает скилл prompt-engineering?

Write effective prompts for AI coding agents. Use when crafting system prompts, implementing chain-of-thought reasoning, building few-shot examples, adding guardrails, configuring tool use, or designing agentic prompt patterns. Covers CoT, few-shot, guardrails, and function calling.

Как установить скилл prompt-engineering?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл prompt-engineering запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить prompt-engineering с