Skip to main content
skill CX Codex

prompt-engineering · spencerpauly — Claude Code skill: install and use

This skill explains how to design prompts with examples, constraints, and fixed output formats. It fits code tasks, classification, and response parsing.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add spencerpauly/awesome-cursor-skills --skill prompt-engineering -a claude-code
Open on GitHub

What prompt-engineering does

The skill covers practical prompt design: state the task precisely, use examples, define the expected format, and refine prompts through testing. It includes sections on system prompts, few-shot examples, chain-of-thought, structured output, constraints, and guardrails.

For coding work, it provides patterns for generating TypeScript, transforming existing code, and fixing bugs. It also points out common failures such as vague requests, conflicting requirements, oversized prompts, missing examples, and prompt injection from undelimited user input.

A JSON schema is the better choice when another program must parse the result, because the skill shows how to declare fields and allowed values in advance. It can be used with Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode.

What it helps with

  • design a system prompt with a defined role and constraints
  • add few-shot examples to a model instruction
  • request JSON output for programmatic parsing
  • draft a TypeScript code-generation prompt
  • structure a bug-fixing request around an error message

Example prompts for the agent

  • Write a system prompt for reviewing TypeScript with severity levels and a fixed response format.
  • Turn this request into a few-shot prompt that converts natural language into SQL.
  • Create a JSON schema for message classification and restrict the answer to the supplied context.

How to install prompt-engineering

1Skills CLI (Vercel)

npx skills add spencerpauly/awesome-cursor-skills --skill prompt-engineering -a claude-code

2Manually: put the files in place

~/.claude/skills/prompt-engineering/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/prompt-engineering/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about prompt-engineering

How do I install prompt-engineering in Claude Code?

Run npx skills add spencerpauly/awesome-cursor-skills --skill prompt-engineering -a claude-code. The installed skill file is at ~/.claude/skills/prompt-engineering/SKILL.md.

What does prompt-engineering do?

It teaches prompt patterns for precise instructions, examples, constraints, and structured results. It also includes templates for code generation, code transformation, and bug fixing.

Which platforms support prompt-engineering?

The skill is available for Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, and OpenCode.

Source text

SKILL.md · CC0-1.0
---
name: prompt-engineering
description: Write effective prompts for LLMs — structure, few-shot examples, chain-of-thought, system prompts, and output parsing.
user-invocable: true
---

# Prompt Engineering

Write prompts that get reliable, high-quality output from LLMs.

## Core Principles

1. **Be specific** — vague prompts get vague results
2. **Show, don't tell** — examples beat instructions
3. **Structure the output** — tell the model exactly what format you want
4. **Iterate** — prompts are code; test and refine them

## Techniques

### System Prompts

Set the model's role and constraints:

```
You are a senior code reviewer. Review the provided code for:
1. Security vulnerabilities
2. Performance issues
3. Readability problems

For each issue found, provide:
- Severity (critical/warning/info)
- Line number
- Description
- Suggested fix

If no issues are found, respond with "No issues found."
```

### Few-Shot Examples

Provide 2-3 examples of input → output:

```
Convert the user's natural language query to a SQL query.

Example 1:
Input: "How many users signed up last month?"
Output: SELECT COUNT(*) FROM users WHERE created_at >= DATE_TRUNC('month', NOW() - INTERVAL '1 month') AND created_at < DATE_TRUNC('month', NOW());

Example 2:
Input: "Show me the top 5 products by revenue"
Output: SELECT p.name, SUM(o.amount) as revenue FROM products p JOIN orders o ON o.product_id = p.id GROUP BY p.name ORDER BY revenue DESC LIMIT 5;

Now convert this query:
Input: "{user_query}"
Output:
```

### Chain-of-Thought

Ask the model to reason step by step:

```
Analyze this error and suggest a fix. Think step by step:
1. What does the error message mean?
2. What could cause this error?
3. What is the most likely root cause given the code context?
4. What is the fix?
```

### Structured Output

Request JSON or a specific format:

```
Respond with a JSON object matching this schema:
{
  "summary": "string - one sentence summary",
  "sentiment": "positive | negative | neutral",
  "key_topics": ["string"],
  "confidence": 0.0-1.0
}
```

### Constraints and Guardrails

```
Rules:
- Only use information from the provided context
- If you don't know the answer, say "I don't know" — do not guess
- Keep responses under 200 words
- Do not include any PII in your response
```

## Patterns for Code

**Code generation:**
```
Write a TypeScript function that {description}.

Requirements:
- {requirement 1}
- {requirement 2}

Use these libraries: {libraries}
Follow this pattern from the codebase: {example}
```

**Code transformation:**
```
Refactor this code to {goal}. Keep the same behavior.
Do not change the public API (function signatures, exports).
```

**Bug fixing:**
```
This code has a bug: {description of bug}

Error: {error message}

Fix the bug. Explain what caused it in a comment.
```

## Anti-Patterns

- **Too vague**: "Make this better" → Be specific about what "better" means
- **Too long**: Giant prompts with everything → Split into focused prompts
- **Contradictory**: "Be concise but thorough" → Pick one or define the tradeoff
- **No examples**: Complex formatting without showing what you want → Add 1-2 examples
- **Prompt injection risk**: Including raw user input without delimiting → Use clear delimiters like `<user_input>...</user_input>`

## Tips

- Temperature 0 for deterministic tasks (code, classification), 0.7+ for creative tasks
- Test prompts with edge cases, not just the happy path
- Version control your prompts — they're as important as code
- Use structured output (JSON) when parsing the response programmatically
- Shorter prompts often outperform longer ones if they're precise enough

© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills

Similar skills

All skills for AI and ML →

prompt-engineering by other authors comes first.

prompt-engineering NeoLabHQ Guides prompt design for agents, subagents, and LLM integrations. Helpful when building production templates, chain-of-thought prompts, or agent hooks. CX Codex +1 1,400installs prompt-engineering giuseppe-trisciuoglio This skill helps write, debug, and test LLM prompts. Use it for few-shot examples, system prompts, reasoning workflows, and reusable templates. CX Codex +1 3,900installs skill-creator official anthropics Creates and refines skills, then tests them with prompts, evaluations, and performance checks. 414,180installs writing-for-agents Matt Pocock Guidance for writing skills and agent-facing documents. Use it when editing AGENTS.md, CLAUDE.md, or reference files reached from them. 466,719installs media-use heygen-com Finds or generates media for HyperFrames videos, including voiceovers, music, cutouts, and color grades. Stores files locally in assets. CX Codex +1 1,100,000installs mcp-builder official anthropics This skill walks through building an MCP server in TypeScript or Python, from reading the protocol spec to writing tests and evaluation questions. 130,949installs subagent-driven-development Jesse Vincent This skill runs an implementation plan through fresh subagents for independent tasks and reviews each result. Use it for multi-step work in one session. CX Codex 237,746installs orchestration stablyai Coordinates supervised Orca workers with task DAGs, decision gates, and threaded messages. Fits workflows that split work across multiple agents. CX Codex +1 349,800installs

From the same set64

best-of-n-solving Runs two or three approaches to a hard problem at once, each in its own git worktree, then helps you pick the winner. CX Codex +1 425installs converting-css-to-tailwind This skill walks a plain CSS file and rewrites its rules as Tailwind utility classes in your markup. Handy when a project moves off hand-written CSS. CX Codex +1 423installs detecting-port-conflicts Detects EADDRINUSE and port conflicts in terminal output, identifies blocking processes with lsof, and kills them or picks an open port for your dev server. CX Codex +1 418installs setting-up-ci A skill that writes a GitHub Actions pipeline with linting, tests, type-checking and a deploy step. Useful when the repo has no CI yet. CX Codex +1 415installs adding-api-docs This skill writes OpenAPI/Swagger documentation for an API: endpoint schemas, request and response types, and an interactive docs page. CX Codex +1 413installs parallel-test-fixing The skill runs your test suite and assigns each failing test file to a separate subagent for parallel fixes. It helps when multiple test files break simultaneously across a codebase. CX Codex +1 412installs profiling-performance This skill profiles web application CPU performance using browser MCP tools. It captures call stacks and pinpoints slow functions causing interface lag. CX Codex +1 410installs python-tdd-with-uv Runs your agent through red-green-refactor in Python and sets the project up on uv. Useful when tests come before the code. CX Codex +1 409installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor