Receber por email
← Voltar para o catálogo

prompt-engineering

Utilize esta skill para criar prompts de LLM, implementar raciocínio chain-of-thought, projetar exemplos few-shot, construir pipelines RAG e otimizar o desempenho de prompts. Ela é acionada por design de prompts, aprendizado few-shot, RAG e qualquer tarefa que exija padrões eficazes de interação com LLMs.

185estrelas
Atualizado há 4 meses

Ver no GitHub ↗ Licença: MIT

Como adicionar

/plugin marketplace add AbsolutelySkilled/AbsolutelySkilled

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/prompt-engineering-absolutelyskilled/svg)](https://www.skillteca.com.br/skills/prompt-engineering-absolutelyskilled)

Alerta por categoria

Receba novas skills de Design e Frontend toda segunda

1 email curto, só com as skills novas de Design e Frontend. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

When this skill is activated, always start your first response with the 🧢 emoji.

Prompt Engineering

Prompt engineering is the practice of designing inputs to language models to reliably elicit high-quality, accurate, and appropriately formatted outputs. It covers everything from writing system instructions to multi-step reasoning pipelines and retrieval-augmented generation. Effective prompting reduces hallucinations, improves consistency, and unlocks capabilities the model already has but needs guidance to apply. The techniques here apply across providers (OpenAI, Anthropic, Google) with minor syntactic differences.

When to use this skill

Trigger this skill when the task involves:

  • Writing or refining a system prompt for an agent or chatbot
  • Implementing chain-of-thought reasoning to improve accuracy on hard tasks
  • Designing few-shot examples to steer model behavior
  • Building a RAG pipeline (retrieval + context injection + generation)
  • Getting structured JSON/schema output from a model reliably
  • Chaining multiple LLM calls (decomposition, routing, verification)
  • Evaluating or benchmarking prompt quality across dimensions
  • Choosing between zero-shot, few-shot, fine-tuning, or RAG approaches
  • Debugging inconsistent or hallucinated model outputs

Do NOT trigger this skill for:

  • Model training, fine-tuning infrastructure, or RLHF pipelines (those are ML engineering)
  • Framework-specific agent wiring (use the mastra or relevant framework skill instead)

Key principles

  1. Be specific and explicit - Vague instructions produce vague outputs. State the

audience, format, length, tone, and constraints in every prompt.

  1. Provide context before instruction - Background and examples before the task

reduces ambiguity. The model reads top-to-bottom; front-load what matters.

  1. Use structured output - Request JSON, markdown tables, or a fixed schema when

downstream code will consume the response. Pair with schema validation and retries.

  1. Iterate and evaluate - Treat prompts as code. Version them, test against a

golden eval set, and measure regressions before deploying changes.

  1. Decompose complex tasks - A single prompt asking the model to research, reason,

and format simultaneously degrades quality. Break into sequential or parallel calls.

Core concepts

System / user / assistant roles

| Role | Purpose | Notes | |---|---|---| | system | Persistent instructions, persona, constraints | Set once; applies to full conversation | | user | The human turn - questions, tasks, data | Can include injected context (RAG, tool output) | | assistant | Model response (or prefill to steer format) | Prefilling forces a specific start token |

Temperature and sampling

  • temperature: 0 - Deterministic, best for factual extraction and structured output
  • temperature: 0.3-0.7 - Balanced creativity and coherence; good for most tasks
  • temperature: 1.0+ - High diversity; useful for brainstorming, risky for factual tasks
  • top_p (nucleus sampling) - Alternative to temperature; values 0.9-0.95 are common
  • Never set both temperature and top_p to non-default at the same time

Token economics

  • Input tokens cost less than output tokens on most providers - keep outputs focused
  • Longer context = slower TTFT (time to first token) and higher cost
  • Few-shot examples consume significant tokens; choose examples carefully
  • Use max_tokens to cap runaway responses

Context window management

  • Modern models: 128K-1M token windows, but quality degrades near limits ("lost in the middle")
  • Place critical instructions at the start and end of long prompts
  • For RAG: inject only top-K retrieved chunks, not entire documents
  • Summarize long conversation history rather than passing raw transcripts

Prompt vs fine-tuning decision

| Scenario | Approach | |---|---| | New behavior, few examples | Zero-shot or few-shot prompting | | Consistent style/format needed | Few-shot or system prompt | | Thousands of labeled examples + consistent task | Fine-tuning | | Domain knowledge too large for context | RAG | | Latency-critical, repeated same task | Fine-tune for smaller/faster model |

Common tasks

Write effective system prompts

Template:

You are [PERSONA] helping [AUDIENCE] with [DOMAIN].

Your responsibilities:
- [CORE TASK 1]
- [CORE TASK 2]

Constraints:
- [HARD RULE 1 - what to never do]
- [HARD RULE 2]

Output format: [FORMAT DESCRIPTION]

Concrete example:

You are a senior code reviewer helping software engineers improve TypeScript code quality.

Your responsibilities:
- Identify bugs, logic errors, and type safety issues
- Suggest idiomatic improvements with brief reasoning
- Flag security vulnerabilities explicitly

Constraints:
- Never rewrite the entire file unprompted; focus on the diff
- Do not praise code unless it exemplifies a non-obvious pattern worth reinforcing

Output format: Return a markdown list of findings. Each item: [SEVERITY] - description.

Anti-patterns:

  • "Be helpful, harmless, and honest" (too generic - the model already knows this)
  • Contradictory constraints ("be concise" and "explain everything in detail")
  • No output format specification when downstream parsing is required

Implement chain-of-thought

Zero-shot CoT - append "Let's think step by step." to trigger reasoning:

User: A store has 3 boxes of apples, each containing 12 apples. They sell 15 apples.
      How many remain? Let's think step by step.

Structured CoT - define explicit reasoning steps:

System: When solving math or logic problems, follow this structure:
  1. UNDERSTAND: Restate what is being asked
  2. PLAN: List the operations needed
  3. EXECUTE: Work through each step
  4. ANSWER: State the final answer clearly

User: [problem]

Self-consistency (sample multiple reasoning paths, majority-vote the answer):

answers = []
for _ in range(5):
    response = llm.complete(cot_prompt, temperature=0.7)
    answers.append(extract_answer(response))
final_answer = Counter(answers).most_common(1)[0][0]
Use CoT for arithmetic, logic, multi-step planning, and ambiguous classification.
Skip CoT for simple lookup tasks - it adds tokens without benefit.

Design few-shot examples

Selection criteria:

  • Cover the most common input patterns (not edge cases for initial shot selection)
  • Include at least one negative/refusal example if the model should decline certain inputs
  • Keep formatting identical across all examples - models learn from structural patterns

Ordering:

  • Most representative examples first; most recent (closest to the query) last
  • For classification: interleave classes rather than grouping them

Formatting template:

System: Classify the sentiment of customer reviews as POSITIVE, NEGATIVE, or NEUTRAL.

User: Review: "The product arrived on time but the packaging was damaged."
Assistant: NEGATIVE

User: Review: "Exactly as described, fast shipping. Very happy!"
Assistant: POSITIVE

User: Review: "It works."
Assistant: NEUTRAL

User: Review: "{actual_review}"
3-8 examples typically saturate few-shot gains. More examples rarely help and
consume context budget that could be used for the actual input.

Build a RAG prompt pipeline

Step 1 - Retrieval: embed the query and fetch top-K chunks from a vector store.

Step 2 - Context injection:

System: You are a documentation assistant. Answer questions using ONLY the provided
        context. If the answer is not in the context, say "I don't have that information."

Context:
---
{retrieved_chunk_1}
---
{retrieved_chunk_2}
---

User: {user_question}

Step 3 - Generation with citation:

System: [...as above...]
        After your answer, list sources as: Sources: [chunk title or ID]

User: How do I configure authentication?

Key decisions:

  • Chunk size: 256-512 tokens for precisio
Compartilhar X LinkedIn