prompt-engineering — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited prompt-engineering (Agent Skill) and scored it 92/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 2 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 2 flagged
A bulleted imperative like {match} tells the agent to never reveal, disclose, or mention something to the user. Used adversarially it can instruct the agent to hide its tool calls or lie about what it did — stripping the transparency a user relies on to trust the agent.
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.
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability.
npx clawhub@latest install prompt-engineeringProvide examples that demonstrate the desired behavior:
For patterns and implementation: See references/few-shot-learning.md
Elicit step-by-step reasoning:
For patterns and implementation: See references/chain-of-thought.md
Enforce reliable, parseable responses:
Set model behavior, constraints, and expertise:
For patterns and templates: See references/system-prompts.md
Build reusable, composable prompts:
For a template library: See references/prompt-templates.md
from pydantic import BaseModel, Field
from typing import Literal
class SentimentAnalysis(BaseModel):
sentiment: Literal["positive", "negative", "neutral"]
confidence: float = Field(ge=0, le=1)
key_phrases: list[str]
reasoning: str
# Request JSON matching the schema, then validate:
# result = SentimentAnalysis(**json.loads(response))Solve this problem step by step.
Problem: {problem}
Instructions:
1. Break down the problem into clear steps
2. Work through each step showing your reasoning
3. State your final answer
4. Verify your answer by checking it against the original problemStart simple, add complexity only when needed:
PROMPT_LEVELS = {
# Level 1: Direct instruction
"simple": "Summarize this article: {text}",
# Level 2: Add constraints
"constrained": """Summarize in 3 bullet points:
- Key findings
- Main conclusions
- Practical implications
Article: {text}""",
# Level 3: Add reasoning
"reasoning": """Read this article carefully.
1. Identify the main topic and thesis
2. Extract the key supporting points
3. Summarize in 3 bullet points
Article: {text}""",
# Level 4: Add examples (few-shot)
"few_shot": """[examples...] Now summarize: {text}"""
}async def answer_with_fallback(context, question, llm):
"""Answer with structured output, fall back to simple on failure."""
try:
response = await llm.ainvoke(structured_prompt)
return ResponseSchema(**json.loads(response.content))
except (json.JSONDecodeError, ValidationError):
simple_response = await llm.ainvoke(simple_prompt)
return ResponseSchema(
answer=simple_response.content,
confidence=0.5,
sources=["fallback extraction"]
)SYSTEM_PROMPTS = {
"analyst": """You are a senior data analyst.
- Write efficient, documented queries
- Explain methodology
- Translate findings into business impact""",
"code_reviewer": """You are a senior software engineer.
Review for: correctness, security, performance, maintainability.
Output: summary, critical issues, suggestions, positive feedback."""
}You answer questions based on provided context.
Context (from knowledge base):
{context}
Rules:
1. Answer ONLY from the provided context
2. If the answer isn't in the context, say so
3. Cite passages using [1], [2] notation
4. Ask for clarification if the question is ambiguous
Question: {question}# Before: 150+ tokens
"I would like you to please take the following text and provide
me with a comprehensive summary of the main points..."
# After: 30 tokens
"Summarize the key points concisely:\n\n{text}\n\nSummary:"# Cache repeated system prompts for cost savings
response = client.messages.create(
model="claude-sonnet-4-5",
system=[{
"type": "text",
"text": LONG_SYSTEM_PROMPT,
"cache_control": {"type": "ephemeral"}
}],
messages=[{"role": "user", "content": query}]
)| Metric | What to Track |
|---|---|
| Accuracy | Correctness of outputs against ground truth |
| Consistency | Reproducibility across similar inputs |
| Latency | Response time at P50, P95, P99 |
| Token Usage | Average tokens per request (cost control) |
| Success Rate | Percentage of valid, parseable outputs |
| User Satisfaction | Ratings, feedback, task completion |
For optimization workflows: See references/prompt-optimization.md
references/chain-of-thought.md — CoT patterns and implementationreferences/few-shot-learning.md — example selection and few-shot strategiesreferences/prompt-optimization.md — iterative refinement workflowsreferences/prompt-templates.md — reusable template patternsreferences/system-prompts.md — system prompt design patternsassets/few-shot-examples.json — example few-shot datasetsassets/prompt-template-library.md — ready-to-use prompt templatesscripts/optimize-prompt.py — prompt optimization utility| Pitfall | Problem | Fix |
|---|---|---|
| Over-engineering | Complex prompt when simple works | Start simple, add complexity only when needed |
| Example pollution | Examples don't match target task | Curate examples that reflect actual inputs |
| Context overflow | Too many examples exceed token limit | Monitor token usage; prioritize quality over quantity |
| Ambiguous instructions | Multiple valid interpretations | Be specific; test with different interpreters |
| No error handling | Assuming outputs are always well-formed | Add validation, fallbacks, and retry logic |
| Hardcoded values | Prompts can't be reused | Parameterize with template variables |
| No versioning | Can't track what changed or roll back | Version control prompts like code |
Complete the following task: {task}
After generating your response, verify it meets ALL these criteria:
- Directly addresses the original request
- Contains no factual errors
- Is appropriately detailed
- Uses proper formatting
If verification fails, revise before responding.Include confidence in structured outputs so downstream systems can handle uncertainty:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.