用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/bipinks/ghost-office --skill prompt-design命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
基于 SOC 职业分类
| name | prompt-design |
| description | Prompt engineering patterns, system prompt design, and prompt optimization techniques |
| user-invocable | true |
| allowed-tools | ["Read","Write","Edit","Bash","Grep","Glob"] |
Patterns for designing, structuring, and optimizing prompts for LLMs.
Every prompt follows this layered structure:
R — Role: Who the model should act as
C — Context: Background information
I — Instructions: The task
C — Constraints: Boundaries and rules
O — Output: Desired format
F — Few-shot: Input/output examples
E — Edge cases: How to handle unusual inputs
PROMPT_TEMPLATE = """
You are {role}.
## Context
{context}
## Task
{instructions}
## Constraints
{constraints}
## Output Format
{output_format}
""".strip()
Cover different scenarios, edge cases, and output variations.
FEW_SHOT_CLASSIFICATION = """
Classify the support ticket into exactly one category.
Categories: billing, technical, account, feature_request, other
## Examples
Ticket: "I was charged twice for my subscription this month"
Category: billing
Reasoning: Duplicate charge is a billing issue
Ticket: "The export button throws a 500 error"
Category: technical
Reasoning: Application error is a technical issue
Ticket: "I was charged twice AND the receipt page shows a 404"
Category: billing
Reasoning: When multiple categories apply, choose the primary user concern
## Now classify:
Ticket: "{ticket_text}"
Category:
"""
Show both good and bad outputs with explanations of why.
Use embedding similarity to select the most relevant examples for each input. Ensure category diversity in selection to avoid bias.
Guide the model through numbered reasoning steps before the final answer. Define each step (identify pattern, check indexes, analyze volume, identify bottlenecks, propose fixes, write optimized version).
Append "Think through this step by step, considering:" followed by a checklist of dimensions to evaluate.
Run the same prompt N times at temperature 0.7, then majority-vote the answers. Return the winner with confidence = count/N.
SYSTEM_PROMPT = """
# Identity
You are FinanceBot for a multi-branch ERP system.
# Capabilities
- Answer accounting procedure questions
- Help with journal entries
- Explain financial reports
- Cannot: approve transactions, modify data, access other branches
# Behavior Rules
1. Verify branch context before answering
2. Format currency as {currency_symbol}#,###.##
3. Amounts over {approval_threshold} trigger approval reminder
4. Never display full bank account numbers
# Error Handling
- Unsure about policy: say so, suggest contacting finance manager
- Cross-branch request: explain data isolation policy
"""
Define the role/expertise in one block, safety guardrails in another. Combine at runtime. Guardrails cover: no secrets in examples, no disabling security, always include health checks, warn before destructive ops.
Build prompts from composable sections (role, capabilities, restrictions, tools, style rules) with runtime variable injection per user context.
Key features for a production prompt template system:
{variable} placeholdersclass PromptTemplate:
def __init__(self, template: str):
self.template = template
self.required_vars = re.findall(r'\{(\w+)\}', template)
def render(self, **kwargs) -> str:
missing = [v for v in self.required_vars if v not in kwargs]
if missing:
raise ValueError(f"Missing: {missing}")
result = self.template
for key, value in kwargs.items():
result = result.replace(f"{{{key}}}", self._sanitize(str(value)))
return result
def _sanitize(self, value: str) -> str:
injection_patterns = ["ignore previous instructions", "new instructions:", "system prompt:"]
if any(p in value.lower() for p in injection_patterns):
raise ValueError("Potential prompt injection detected")
return value
get_for_request(name, request_id)| Technique | Before | After |
|---|---|---|
| Trim redundancy | "I would like you to please analyze..." | "Summarize the key points:" |
| Structured shorthand | Long paragraph of format rules | Bullet list of format rules |
| Output budgeting | Open-ended response | "VERDICT: [word] / REASON: [sentence] / CONFIDENCE: [H/M/L]" |
| Context compression | Full documents | Key sentences (first + last per paragraph) |
| Anti-Pattern | Problem | Fix |
|---|---|---|
| Vague instructions | "Help me with this code" | Specify: review for correctness, performance, readability |
| Contradictory constraints | "Be thorough" + "Under 50 words" | Align scope with length |
| Over-prompting | 40 rigid procedural steps | Clear goal with flexible execution |
| Missing context | "Fix this SQL query" | Include schema, constraints, multi-tenant rules |
| Injection vulnerability | f"Translate: {user_input}" | Delimit user content with XML tags |
prompts/
├── system/ # Persistent behavior prompts
├── tasks/ # Task-specific (classification, extraction, generation, analysis)
├── templates/ # Reusable components (output formats, guardrails, few-shot banks)
├── tests/ # Prompt test cases
├── registry.py # Version registry
└── config.py
Use composable enums for output format (JSON, Markdown, CSV) and guardrails (NO_PII, NO_HALLUCINATION, BRANCH_ISOLATION). Compose prompts from these building blocks.