prompt-engineering — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited prompt-engineering (Agent Skill) and scored it 91/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 1 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} is the classic direct prompt-injection phrasing. Placed in a skill body that the agent reads as trusted instructions, it tries to make the agent abandon its prior rules and follow whatever comes next — a full system-prompt override.
ignore/disregard/forget … previous instructions sentence.Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
This skill audits and rewrites a prompt that will be sent to an LLM. It is read-only by default — it never auto-applies the rewrite, it produces a proposal. It is language-aware (PT and EN as primary; other inputs are translated to EN with a side-by-side preservation list). It is lifecycle-driven: capture → translate → clarity → anti-hallucination → structure → token economy → output.
The skill exists because LLM-facing prompts written by hand drift toward the same failure modes: missing success criteria, undefined output format, no examples, no refusal hooks, no "never invent" floor, and silent assumptions about role. Each of those gaps is a known driver of hallucinated, off-format, or unsafe output. Every guardrail in the Constraints section is there to push the rewrite toward a contract the model can fulfil deterministically — and to keep the skill itself from making the same mistakes.
This skill is built for four primary classes of prompt — see references/USE_CASES.md for the per-class strategy subset, canonical skeleton, and findings catalog.
@skill-creator (which scaffolds the file; this skill audits the prompt content inside it).description fields on functions / tools that drive when and how a model calls them. Emphasis on disambiguation, side-effect declaration, and "do not use when" antipatterns.Also handles generic system, user, and few-shot prompts as a secondary use case.
Trigger scenarios:
SKILL.md draft and wants it audited before publishing.description reviewed before two tools collide on activation.'review prompt', 'improve prompt', 'audit SKILL.md', 'harden RAG prompt', 'review tool description', 'revisar prompt', 'auditar prompt', 'auditar SKILL.md', 'engenharia de prompt', or invokes /valarmindskills:prompt-engineering.@code-review.@code-debugger for the orchestration layer; this skill only fixes the prompt itself.@context-optimization, not prompt rewriting.@caveman."summarize this PDF") — the audit overhead exceeds the value; tell the user and stop.Collect before starting. Each missing input degrades a specific phase rather than blocking the whole audit, but missing inputs are reported in the output.
| Input | Required | How to obtain |
|---|---|---|
| Prompt verbatim | Yes | Ask the user to paste the exact prompt, including delimiters and variables |
| Prompt role | Yes | Ask: system / user / agent / few-shot / RAG template |
| Target model family | No | Helps tune token budgets and instruction-following style |
| Target output format | No | If the user already has a schema, the audit grades the prompt against it |
| Known failure modes | No | "Hallucinated paths", "ignored format", "refused valid input" — these focus the audit |
| Tooling / skill map | No | If the prompt is for an agent with tools or skills, list them so the rewrite includes a tool map |
The skill never sends the prompt to another model for evaluation. Every finding is derived from reading the prompt itself against the catalog in references/STRATEGIES.md.
Read the prompt verbatim. Do not paraphrase, summarize, or reformat at this point — the original text is the evidence base for every later phase.
ORIGINAL PROMPT (verbatim, fenced):
"""
<paste user-provided prompt here exactly, including any leading whitespace,
markdown markers, variables, and delimiters>
"""If the prompt arrives without delimiters, mark the boundary and ask the user to confirm before proceeding. A misread boundary contaminates every later phase.
Determine three axes:
| Axis | Values | Why it matters | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Role | system, user, agent-base, few-shot, RAG, skill (SKILL.md), tool-description | Drives which strategies are relevant (persona stability + tool map + plan-act-verify for agent-base, schema for user, prompt-injection guard for RAG, trigger phrases for skill, "do not use when" for tool-description) | ||||||||||
| Language | en, pt, es, other | Triggers Phase 1 if not en | ||||||||||
| Use case | skill \ | rag \ | agent-tool \ | agent-base \ | factual \ | generation \ | classification \ | extraction \ | planning \ | code \ | conversation | The first four map to the USE_CASES.md canonical skeletons; the rest map to generic strategy subsets in STRATEGIES.md |
State each axis explicitly in one line before moving on. Example:
role: system
language: pt
use case: extraction (parse PR diff → JSON findings)For the four primary classes, the use case is named explicitly:
role: skill # SKILL.md being authored or revised
language: en
use case: skill # → load USE_CASES.md §1
role: rag # RAG system template
language: en
use case: rag # → load USE_CASES.md §2
role: tool-description # Function description in JSON Schema
language: en
use case: agent-tool # → load USE_CASES.md §3
role: agent-base # Agent system prompt (long-running session)
language: en
use case: agent-base # → load USE_CASES.md §4Count the prompt size. Long prompts (> 2000 tokens estimated, ~1500 words) usually contain duplicated instructions and are the highest-yield targets for Phase 5. Short prompts (< 50 tokens) usually need more content — additions in Phase 4 will outweigh subtractions in Phase 5.
Five-rule pledge — cite verbatim · read use-case baseline first · different wording ≠ missing strategy · stop on LGTM · heuristic findings start Medium. Full rationale + reproducibility rule in CHECKLIST §Skill self-audit. Padded reports erode trust faster than missed findings.
Drop the audit when all three hold:
skill, rag, agent-tool, agent-base}never, must not, do not, refuse if) detected in source→ emit Block 1 (verbatim) + Block 2 row (out of scope: trivial prompt — audit overhead exceeds value) + stop. Do not produce Block 3 / Block 4.
Otherwise, proceed to Phase 1.
Run only if Phase 0 detected a non-English source. EN is the working language for the rewrite because most public model evaluations and prompt-engineering literature are EN-first; preserving the same prompt in EN is also easier to compare across reviewers.
Produce the EN translation side-by-side with the original:
| Source (pt) | EN translation |
| --------------------------------------------------- | --------------------------------------------- |
| Você é um revisor de PR rigoroso. | You are a rigorous PR reviewer. |
| Nunca invente caminhos de arquivo. | Never invent file paths. |
| Se não souber, diga "não sei". | If you do not know, say "I don't know". |List every term that must not be translated, with the reason:
Preserved verbatim:
- "PR" — common acronym, untranslated in both languages
- "OWASP" — proper noun
- "{repo_path}" — variable placeholder
- "context.Context" — Go type nameIf translation requires changing a safety rule, stop and surface it. Safety-relevant rules (never, must not, do not, refuse if) keep their original force in EN; weakening them is a finding, not an edit.
A prompt is clear when an indifferent reader can answer four questions without inference:
Walk the prompt and grade each axis explicitly.
| # | Axis | Pass criterion |
|---|---|---|
| 1 | Role defined | Prompt names the persona/expertise (e.g., "You are a senior security reviewer") |
| 2 | Task stated | One sentence describes the task in imperative mood |
| 3 | Input boundary marked | The prompt names where the input begins/ends (delimiters, variables, sections) |
| 4 | Success criterion explicit | Prompt states what "correct" looks like (e.g., "Output is valid JSON matching the schema below") |
| 5 | Output format pinned | JSON, Markdown, fenced block, or other — and the schema is shown |
| 6 | Edge cases named | Prompt covers empty input, missing fields, ambiguous input |
| 7 | Examples present | At least one worked example for non-trivial tasks |
| 8 | Refusal path named | Prompt states when to refuse or escalate (out of scope, unsafe, ambiguous) |
Each missed axis is a finding. Severity follows references/SEVERITY_RUBRIC.md: a missing success criterion is Critical; a missing example is usually Minor unless the task is non-trivial.
Each finding cites the passage by line or quote and proposes the smallest possible fix:
P-2-001 — Missing success criterion
Quote:
| "Revise meu PR e me diga o que tá errado."
Issue:
"What is wrong" is unbounded. The model cannot know whether
style nits, security flaws, or perf regressions are in scope.
Fix (REVIEW):
Add a success criterion: "Return findings only if they are
Critical, High, or Medium per the SEVERITY_RUBRIC. Stop after 10."Apply the catalog in references/STRATEGIES.md. Every entry the prompt does not satisfy is a finding.
Walk §1–§13 of STRATEGIES.md, but only the subset required by the declared use case — see STRATEGIES §How the skill uses this catalog for the per-use-case row.
Calibrate findings: heuristic findings (regex, simple absence) start at Medium severity. Promotion to High or Critical requires manual confirmation that the gap is exploitable for hallucination in the prompt's actual use case.
Quick-detection table relocated to STRATEGIES §Common hallucination smells. Each smell row is a finding with quote + fix + risk tag.
Once gaps are documented, propose what to add, not just what to remove. Each recommendation is a section the rewrite will include.
For the four primary use cases (skill / rag / agent-tool / agent-base), use the canonical skeleton from USE_CASES.md §1 / §2 / §3 / §4 — those skeletons encode required section ordering + fields for the class.
For all other use cases, the generic canonical order is: Role → Task + success criterion → Inputs (labeled) → Constraints (must/must not/never, one bullet each) → Output schema → Examples → Refusal/escalation hooks → Tool/skill map (agent prompts only).
The rewrite renders these sections explicitly. If a section is intentionally omitted, the rewrite says so (Examples: not applicable for this prompt because …). Silent omission is a finding.
If the prompt is for an agent that has access to tools or sub-skills, the rewrite must include a table mapping each tool to a one-line "use when" rule. Example:
| Tool | Use when |
| ----------------------- | --------------------------------------------------- |
| `search_codebase` | The user names a file/symbol that may have moved |
| `run_tests` | The fix is candidate-ready and needs verification |
| `web_search` | A library version, CVE, or RFC is referenced |A skill map without use when rules is itself a finding — agents over-call tools without one.
If the audited prompt has a version field in its frontmatter (Skills, GPTs, agent base prompts often do), Block 3 includes a SemVer bump suggestion:
Hint only — soft-spec, not enforced. Skips when frontmatter has no version.
Compress without losing substance. Substance = role, success criterion, constraints, refusal hooks, schema. Filler = pleasantries, hedging, redundant restatements, instructions repeated under different headings.
never, must not, or do not rule. Re-word for brevity, but keep the negation form. Before:
"It's really important that you always make sure to provide
citations for any factual claim, otherwise the user can't trust
the answer."
After:
"Cite every factual claim (path:line or URL). Uncited claims are rejected."Estimate token count before and after. Report as:
Token delta:
before: 412 tokens (est., model tokenizer agnostic)
after: 287 tokens
delta: −125 tokens (−30.3%)
invariant: every "never"/"must not" rule preserved
every example pair preserved
role and success criterion preservedIf the rewrite is longer than the original (common when the original is a one-liner), report the same delta with a positive sign and a one-line rationale (+47 tokens — added role, schema, refusal hook).
The rewrite respects a per-use-case ceiling. Excess → finding T-001 Token budget exceeded with REVIEW risk tag and a fix proposing what to cut.
| Use case | Ceiling (rewrite) | Why |
|---|---|---|
skill | ≤ 800 tokens | SKILL.md frontmatter ≤ 250 + lifecycle map should fit ~5 phases tersely |
rag | ≤ 400 tokens | Stable system prompt; retrieved chunks consume bulk of remaining budget |
agent-tool | ≤ 200 tokens | Tool description loaded per agent decision; over-budget = over-call risk |
agent-base | ≤ 1500 tokens | Long-running session identity; persona + tool map + workflow justify size |
factual / extraction | ≤ 600 tokens | One-shot tasks; rule density beats persona ornament |
| Other | ≤ 2× original | Generic cap; keeps rewrites from runaway expansion |
User can override with explicit rationale (e.g., "agent-base needs 2200 tokens because tool map has 18 entries"). Without override, T-001 is a finding.
For multi-turn agents and RAG, position stable parts (system prompt, schema, refusal hooks, tool map) before dynamic parts (user input, retrieved chunks, conversation history). Anthropic prompt caching reuses prefix tokens with a 5-minute TTL — reordering the rewrite to put invariants up front converts repeated tokens into cache hits, lowering both cost and latency on every subsequent call. This is a real-world token-economy win that does not show up in a single-prompt token count.
If the audited prompt interleaves stable and dynamic content, propose the reordering as a SAFE finding (semantics unchanged; only structure shifted).
Emit the deliverable in four numbered blocks. The user can adopt all, some, or none.
The exact prompt as captured in Phase 0, fenced. No edits, no annotations.
Severity-ranked table, then one detail block per finding. Each finding has: id, severity, confidence, risk tag, quote, issue, fix.
The proposed rewrite, fenced, complete enough to copy-paste. EN by default. Includes the canonical sections from Phase 4.
| Metric | Value |
| ----------------------- | ------------------------------------- |
| role classified | system / user / agent / few-shot / RAG |
| language (in / out) | pt → en |
| clarity score | 4 / 8 axes pass (was 1 / 8) |
| anti-hallucination cov. | 9 / 12 strategies (was 0 / 12) |
| token delta | −125 tokens (−30.3%) |
| risk tag (overall) | REVIEW |
| confidence | High |Required when overall Risk tag is `REVIEW` or `BREAKING`. Optional when overall Risk tag is `SAFE` (since SAFE rewrites preserve semantics; verification adds noise without changing behavior). For non-trivial rewrites, propose how the user can validate the change:
| Rule | Why |
|---|---|
| Never edit the prompt automatically | Reviewer not editor — Block 3 = proposal |
| Never invent user intent | Confident rewrite of unread prompt = highest-risk failure; ambiguous → stop and ask |
| Never strip a safety rule | never/must not/do not/refuse if survive verbatim into EN with same force |
| Never claim translation fidelity without preservation list | Phase 1.2 list mandatory; empty list ⇒ translation not approved |
| Never inflate severity to look thorough | Heuristic findings start Medium per SEVERITY_RUBRIC |
| Never invent findings to appear thorough | Zero-findings = LGTM, valid outcome — not failure |
| Never promote Minor → Major to fill the report | Severity bound to impact × likelihood, not report length |
| Never quote paraphrased | Quotes byte-for-byte; summaries labeled summary: not quote: |
| Never recommend a strategy without catalog citation | Every Phase 3 finding links STRATEGIES §N |
| Never omit Block 1 | Original verbatim = audit contract; second auditor must reach same verdict |
| Never auto-translate when user asked only for audit | Phase 1 runs only on user request or when rewrite needs EN landing |
Never compress never rule into positive instruction | never X ≠ always not-X to a model; keep negation |
| Always emit Blocks 1–4 verbatim | Even on zero findings |
| Always cap rewrite ≤ use-case budget | Per Phase 5.3; 2× original generic; user override allowed with rationale |
| Always cross-link sibling skill | When finding belongs to its domain (@context-optimization, @clean-code, @code-review, @caveman, @superpowers) |
Print verbatim after every successful run. The four-block report is the deliverable.
prompt-engineering: <one-line description provided by user, or auto-derived>
role: <system | user | agent-base | few-shot | rag | skill | tool-description>
language: <in> → <out>
use case: <skill | rag | agent-tool | agent-base | factual | generation | classification | extraction | planning | code | conversation>
size: <est. tokens before> → <est. tokens after> (Δ <signed delta>)
---
Block 1 — Original (verbatim)
---
"""
<original prompt, byte-for-byte>
"""
---
Block 2 — Findings
---
| ID | Sev | Conf | Risk | Phase | Title |
| ----- | -------- | ------ | -------- | ----- | ---------------------------------- |
| P-001 | Critical | High | REVIEW | 2 | Success criterion missing |
| P-002 | Major | High | REVIEW | 3 | No never-invent floor |
| P-003 | Major | Medium | SAFE | 3 | No citation requirement |
| P-004 | Minor | High | SAFE | 5 | Redundant pleasantries (3×) |
P-001 — Success criterion missing
Phase: 2 — Clarity Audit
Quote: "Revise meu PR e me diga o que tá errado."
Issue: "Wrong" is unbounded. The model has to invent the rubric.
Fix (REVIEW):
Add: "Return only Critical/High/Medium findings per OWASP API Top 10
and code-review SEVERITY_RUBRIC. Stop after 10 findings."
Strategy: [STRATEGIES §1, §2](references/STRATEGIES.md)
... (one block per finding) ...
---
Block 3 — Rewritten prompt
---
"""
<full rewritten prompt, EN by default, ready to copy-paste>
"""
Preserved terms (from Phase 1.2): PR, OWASP, {repo_path}, context.Context
Preserved safety rules (from Phase 5):
- "never invent file paths"
- "if unsure, say 'I don't know' and ask one clarifying question"
---
Block 4 — Summary
---
| Metric | Before | After |
| ---------------------------- | ------ | ----- |
| Clarity axes passing | 1 / 8 | 8 / 8 |
| Anti-hallucination strategies| 0 / 12 | 9 / 12|
| Token count (est.) | 12 | 95 |
| Risk tag | — | REVIEW |
| Confidence | — | High |
Suggested next step:
1. Adopt Block 3 as the new prompt.
2. Run Block 5 verification suggestions.
3. Re-run /valarmindskills:prompt-engineering after one production cycle.
Skill version: prompt-engineering @ <git rev of SKILL.md>When Phases 2 + 3 yield no Critical, Major, or Minor findings for the declared use case:
(no findings — prompt passes audit for use case <N>). No fabricated Minors. No "could be improved" observations.no rewrite needed — prompt already passes the audit.Risk tag: SAFE, LGTM — no clarity, hallucination, or token-economy gaps in scope in suggested next step.A second auditor reading only Block 1 should be able to reach the same conclusion. If they could not, the gap is real and the result is not LGTM.
@skill-creator — primary sibling. Scaffolds new skills (file layout, frontmatter, references); this skill audits the prompt content inside the scaffolded SKILL.md. Run @skill-creator first to scaffold; then /valarmindskills:prompt-engineering to harden.@context-optimization — for whole-context compression (KV-cache reuse, observation masking, partitioning). Runs after this skill if the prompt-revised conversation still exceeds the context budget.@clean-code — for naming conventions inside prompt templates with embedded code or pseudocode.@code-review — when the audit target is code-review prompts and the user wants the meta-review of the methodology used.@caveman — sibling discipline that compresses the response, not the prompt.@superpowers — engineering posture (TDD, evidence-first) for the human iterating on the prompt.~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.