Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Prompt Engineering

ASecurity

Design effective prompts for LLMs: role framing, structured output, chain-of-thought, few-shot, and evaluation. Use to get reliable model behavior.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentspythonrustgobashapisecurity

Works with

cliapi

Security Analysis

A96/100
mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 2 files and shows the line behind each finding

Scanned 9/29/2026

$npx -y skills add ssrjkk/claude-skills --skill prompt-engineering --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Prompt Engineering?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Prompt Engineering
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ssrjkk-prompt-engineering/badge)](https://www.skillsdirectory.com/skills/ssrjkk-prompt-engineering)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: prompt-engineering
description: "Design effective prompts for LLMs: role framing, structured output, chain-of-thought, few-shot, and evaluation. Use to get reliable model behavior."
category: ai
tags: [prompt-engineering, llm, prompting, chain-of-thought, structured-output]
models: [sonnet, opus, gpt-5, gemini-2.5, glm-4.6]
version: 1.0.0
created: 2026-09-20
updated: 2026-09-28
author: ssrjkk
---
# Prompt Engineering

> Designing prompts that reliably steer LLM behavior.

## Quick Start
```text
You are a senior Python code reviewer.
Review the code below for bugs, security issues, and style.
Output a markdown report with sections: Issues, Severity, Fix.
```

## When to Use
- Getting consistent structured output from LLMs
- Reducing hallucinations in critical workflows
- Making prompts robust across models and versions
- Building prompts for agents and tools

## Best Practices

### Framing
- Give the model a clear role and task
- State constraints explicitly (format, length, tone)
- Provide context before asking the question
- Ask for one thing per prompt when possible

### Structured Output
- Ask for JSON/YAML with a schema
- Use few-shot examples of the desired format
- Request self-checking: "validate your JSON before responding"
- Prefer `response_format`/tools when the API supports them

### Reasoning
- Use chain-of-thought for multi-step problems
- Ask for step-by-step reasoning before the final answer
- Keep reasoning separate from the final deliverable
- Avoid leaking internal reasoning into user-facing output

## Dependencies
```bash
pip install openai   # or anthropic, google-generativeai
```

## Examples
```text
# Structured JSON extraction
Extract entities from the text below as JSON.
Schema: {"name": string, "org": string|null, "confidence": float 0-1}
Return only valid JSON, no commentary.

Text: "Alice works at Acme and handles billing."
```

```text
# Chain-of-thought
Solve the math problem step by step, then give the final answer.
Show each calculation. End with: "Answer: <number>".

Problem: A train travels 240 km in 3 hours. What is the average speed?
```

```python
import openai

client = openai.OpenAI()
resp = client.chat.completions.create(
    model="gpt-5",
    messages=[
        {"role": "system", "content": "You extract entities to JSON."},
        {"role": "user", "content": '{"text": "Alice works at Acme"}'],
    ],
    response_format={"type": "json_object"},
)
print(resp.choices[0].message.content)
```

```python
# Evaluate prompt quality on a test set
def score_prompt(prompt: str, cases: list[tuple[str, str]]) -> float:
    correct = 0
    for inp, expected in cases:
        out = run_model(prompt, inp)
        if normalize(out) == normalize(expected):
            correct += 1
    return correct / len(cases)
```

## Step-by-Step
1. Define the task, expected output, and failure modes.
2. Write a role + constraints prompt; include an output schema.
3. Add 2-3 few-shot examples of the exact format.
4. For reasoning tasks, request step-by-step with separated final answer.
5. Test against a held-out set; measure accuracy and format compliance.
6. Iterate: add failing cases, tighten constraints, trim noise.
7. Version prompts; pin model and temperature.
8. Monitor drift and re-evaluate on schedule.

## Validation
1. Output parses as valid JSON/YAML when structured
2. Accuracy on the eval set meets the target
3. Prompt works across the target models
4. No prompt injection from user content (sandbox untrusted input)
5. Latency and cost within budget

## Troubleshooting
- Output not JSON: tighten schema, add few-shot, use response_format.
- Hallucinations: add grounding context and ask for citations.
- Verbose answers: constrain length and format in the prompt.

Attribution

ssrjkkssrjkk
View sourceSee grades on GitHubMore from ssrjkk →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698461 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →