prompt-engineering
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.
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 theRelated in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.