Claude
Skills
Sign in
Back

prompt-engineering

Included with Lifetime
$97 forever

Structured prompt construction and quality validation for Jerry Framework. Invoke when building structured prompts, generating NPT-009/NPT-013 constraints, or scoring prompt quality. Guides users through the 5-element prompt anatomy, generates formatted constraints with XML wrapping, and scores prompts against the 7-criterion rubric.

AI Agents

What this skill does


# Prompt Engineering Skill

> **Version:** 1.0.0
> **Framework:** Jerry Framework v0.9.0
> **Constitutional Compliance:** Jerry Constitution v1.0
> **SSOT Reference:** `.context/rules/prompt-quality.md`, `.context/rules/prompt-templates.md`

---

## Document Sections

| Section | Purpose |
|---------|---------|
| [Overview](#overview) | What this skill does and why |
| [When to Use This Skill](#when-to-use-this-skill) | Triggers and use cases |
| [Available Agents](#available-agents) | Agent registry with routing guide |
| [Invoking an Agent](#invoking-an-agent) | Three invocation options (natural language, explicit, Task tool) |
| [Quick Reference](#quick-reference) | Copy-paste examples for common tasks |
| [Routing Disambiguation](#routing-disambiguation) | When this skill is the wrong choice |
| [Constitutional Compliance](#constitutional-compliance) | Principle mapping with consequences |
| [Architecture Notes](#architecture-notes) | Design rationale and references |

---

## Document Audience (Triple-Lens)

This SKILL.md serves multiple audiences:

| Level | Audience | Sections to Focus On |
|-------|----------|---------------------|
| **L0 (ELI5)** | Users new to prompt engineering | [Overview](#overview), [When to Use](#when-to-use-this-skill), [Quick Reference](#quick-reference) |
| **L1 (Engineer)** | Developers building prompts and constraints | [Available Agents](#available-agents), [Quick Reference](#quick-reference), [Architecture Notes](#architecture-notes) |
| **L2 (Architect)** | Framework maintainers and skill designers | [Routing Disambiguation](#routing-disambiguation), [Constitutional Compliance](#constitutional-compliance), [Architecture Notes](#architecture-notes) |

---

## Overview

The Prompt Engineering skill operationalizes PROJ-014 negative prompting research findings into a reusable tool for constructing high-quality structured prompts within the Jerry Framework. PROJ-014 validated that NPT-013 structured negation (NEVER + consequence + alternative) achieves 100% compliance vs 92.2% for positive-only framing (p=0.016, CONDITIONAL GO via PG-003).

### Core Capabilities

- **Interactive Prompt Builder:** Walks users through the 5-element prompt anatomy (routing, scope, data source, quality gate, output path) producing XML-wrapped structured prompts.
- **NPT Constraint Generator:** Converts intent descriptions into NPT-009/NPT-013 formatted constraints with `<forbidden_actions>` and `<constraint>` XML wrapping.
- **Prompt Quality Scorer:** Evaluates prompts against the 7-criterion rubric (C1 Task Specificity through C7 Positive Framing) and returns dimension scores with improvement suggestions.

### NPT Format Reference

| Format | Structure | Use Case |
|--------|-----------|----------|
| NPT-009 | `{PRINCIPLE} VIOLATION: NEVER {action} -- Consequence: {impact}` | Agent forbidden actions, constitutional guardrails |
| NPT-013 | `NEVER {action} -- Consequence: {impact}. Instead: {alternative}` | Behavioral constraints, routing rules, methodology guardrails |

---

## When to Use This Skill

Invoke `/prompt-engineering` when you need to:

- Build a structured Jerry prompt from scratch using the 5-element anatomy.
- Generate NPT-009 or NPT-013 formatted constraints for agent definitions, rule files, or skill documentation.
- Score an existing prompt against the 7-criterion rubric to identify quality gaps.
- Convert positive-only instructions to structured negation format per PROJ-014 findings.
- Produce XML-wrapped constraint blocks (`<forbidden_actions>`, `<constraint>`) for agent governance YAML.

NEVER invoke this skill when:
- Task requires adversarial quality review of a deliverable -- Consequence: prompt engineering generates constraints and scores prompts, not deliverables; quality assessment of artifacts requires `/adversary` with S-014 rubric scoring
- Task requires research, analysis, or root cause investigation -- Consequence: prompt engineering is a construction tool, not an analytical methodology; no research capability, no causal investigation; use `/problem-solving` instead
- Task is executing an existing prompt template from `.context/rules/prompt-templates.md` -- Consequence: template execution does not require prompt construction; the 5 templates are self-contained and ready to use with placeholder substitution
- Task is modifying agent definition YAML frontmatter or governance files -- Consequence: agent definition structure follows `agent-development-standards.md` schema, not prompt anatomy; use direct file editing with schema validation per H-34

See [Routing Disambiguation](#routing-disambiguation) for full exclusion conditions with consequences.

---

## Available Agents

| Agent | File | Model | Cognitive Mode | Purpose |
|-------|------|-------|----------------|---------|
| `pe-builder` | `skills/prompt-engineering/agents/pe-builder.md` | opus | integrative | Interactive prompt assembly -- walks user through 5 elements, generates XML-wrapped structured prompt |
| `pe-constraint-gen` | `skills/prompt-engineering/agents/pe-constraint-gen.md` | sonnet | systematic | NPT pattern selector and constraint formatter -- takes intent, outputs NPT-009/NPT-013 XML blocks |
| `pe-scorer` | `skills/prompt-engineering/agents/pe-scorer.md` | haiku | convergent | Prompt quality scorer -- evaluates against 7-criterion rubric, returns dimension scores + improvement suggestions |

### Agent Routing Guide

| Keywords in Request | Likely Agent | Rationale |
|---------------------|--------------|-----------|
| build, create, construct, assemble, walk me through, 5 elements | pe-builder | Interactive prompt construction with element-by-element guidance |
| constraint, NPT, forbidden, NEVER, consequence, XML, guardrail | pe-constraint-gen | Systematic constraint formatting using NPT pattern catalog |
| score, evaluate, rate, quality, rubric, dimensions, improve | pe-scorer | Convergent evaluation against 7-criterion rubric |

### P-003 Compliance

All prompt engineering agents are **workers**, NOT orchestrators. The MAIN CONTEXT (Claude session) orchestrates the workflow.

```
P-003 AGENT HIERARCHY:
======================

  +-------------------+
  | MAIN CONTEXT      |  <-- Orchestrator (Claude session)
  | (orchestrator)    |
  +-------------------+
     |        |        |
     v        v        v
  +------+ +------+ +------+
  | pe-  | | pe-  | | pe-  |   <-- Workers (max 1 level)
  |build | |const | |score |
  +------+ +------+ +------+

  Agents CANNOT invoke other agents.
  Agents CANNOT spawn subagents.
  Only MAIN CONTEXT orchestrates the sequence.
```

---

## Invoking an Agent

### Option 1: Natural Language Request

Simply describe what you need:

```
"Build a prompt for researching authentication patterns for a .NET microservice"
"Generate NPT-013 constraints for a research agent that must not hallucinate sources"
"Score this prompt against the quality rubric"
"Convert these positive instructions to NPT-009 format for agent governance"
```

The orchestrator selects the appropriate agent based on keywords and context.

### Option 2: Explicit Agent Request

Request a specific agent:

```
"Use pe-builder to walk me through constructing a C3 orchestration prompt"
"Have pe-constraint-gen produce NPT-009 forbidden actions for a T4 research agent"
"I need pe-scorer to evaluate this prompt and tell me what to fix"
```

### Option 3: Task Tool Invocation

For programmatic invocation within workflows:

```python
Task(
    description="pe-constraint-gen: Generate NPT-013 constraints",
    subagent_type="general-purpose",
    prompt="""
You are the pe-constraint-gen agent (v1.0.0).

## INPUT
- **Intent:** Prevent hallucinated source citations in a research agent
- **Target Context:** Agent governance YAML forbidden_actions
- **NPT Format:** NPT-009 (governance YAML context)

## REFERENCE
Load pattern reference: skills/prompt-engineering/rules/npt-pattern-reference.md

## TASK
Generate NPT-009 formatted constraints for the
Files: 8
Size: 71.9 KB
Complexity: 49/100
Category: AI Agents

Related in AI Agents