Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

octocode-prompt-optimizer八码提示优化器

Agent Skill

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

总安装

1,270

周安装

54

GitHub Stars

801

下载量

445
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:octocode-prompt-optimizer(八码提示优化器)
来源仓库:https://github.com/bgauryy/octocode-mcp
仓库路径:skills/octocode-prompt-optimizer
安装命令:
npx skills add https://github.com/bgauryy/octocode-mcp --skill octocode-prompt-optimizer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/bgauryy/octocode-mcp --skill octocode-prompt-optimizer

简介

octocode-prompt-optimizer 用于优化提示词和工作流模板。

  • 适合规范任务边界、统一输出格式或拆分操作步骤。
  • 使用时需保留真实业务约束,避免将示例当作硬规则。
  • 涉及自动执行时应明确确认步骤和失败处理方式。octocode-prompt-optimizer 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 建议在安装前验证来源仓库的维护状态和权限边界。

SKILL.md

Prompt Optimizer Skill

<when_to_use>

  • Creating or improving prompts
  • Agents skip steps or ignore instructions
  • Instructions lack enforcement
  • Output format is inconsistent
  • Reviewing any instruction document or prompt
  • Strengthening agent-operational text without changing business/domain logic </when_to_use>

<global_forbidden priority="maximum"> CRITICAL - FORBIDDEN at ALL times:

  1. Changing good parts that already work
  2. Changing the existing logic/intent of prompts
  3. Making changes before understanding the prompt
  4. Leaving weak words in critical sections
  5. Outputting without validation
  6. Over-strengthening soft guidance
  7. Skipping gates or checkboxes
  8. Bloating prompts - target line count increase <10%; if >10%, MUST document a one-line justification in VALIDATE

Triple Lock:

  • STATE: You MUST preserve working logic AND follow all gates in order
  • FORBID: FORBIDDEN: Altering intent without user approval
  • FORBID: FORBIDDEN: Skipping steps or gates
  • REQUIRE: REQUIRED: Validate all changes before output AND complete all checkboxes

Violation invalidates optimization. Start over if violated. </global_forbidden>

<tool_control priority="high"> FORBIDDEN tools during optimization:

  • Direct file/system modification that bypasses quality gates
  • Any tool usage that executes code or commands unrelated to prompt optimization
  • Tools that skip the READ→UNDERSTAND→RATE→FIX→VALIDATE flow

ALLOWED tools:

  • Read-only file access (to read prompt files)
  • Safe file edit/write capability (ONLY after VALIDATE step passes)
  • Clarification question capability (for user clarification)
  • Text output (all phases)

Compatibility note (REQUIRED):

  • Map capability names to the active runtime's tool names.
  • Example aliases: read-only file access = Read/ReadFile/localGetFileContent; safe file edit/write = Write/StrReplace/ApplyPatch.
  • IF the runtime is read-only or lacks a safe write tool → THEN output the optimized text or delta without attempting file edits. </tool_control>

<write_policy priority="high"> Write policy (REQUIRED):

  • IF the user asked for review/advice only → THEN do not modify files; return the optimized content in chat.
  • IF the user asked to update a specific file and a safe write tool exists → THEN write only after VALIDATE passes.
  • IF the path is missing, not writable, or unsafe to edit → THEN return the optimized content or patch-style delta and state that no file changes were made. </write_policy>

Execution Flow

<execution_flow>

READ → UNDERSTAND → RATE → FIX → VALIDATE → OUTPUT
  ↓         ↓          ↓       ↓         ↓          ↓
 GATE      GATE       GATE    GATE      GATE       GATE
StepActionGate RequirementFORBIDDEN Until Gate Passes
1READ the prompt completelyAll checkboxes checkedAnalysis, changes
2UNDERSTAND what the prompt doesUnderstanding output producedRating, fixes
3RATE each part for issuesIssues table producedFixing issues
4FIX issues by severityAll Critical/High fixedValidation
5VALIDATE against checklistAll REQUIRED checks passOutput
6OUTPUT optimized documentFormat followed exactlyN/A

CRITICAL: You MUST complete each gate before proceeding. DO NOT skip steps.

Adaptive Mode Selector (REQUIRED)

ModeUse WhenAllowed CompressionNon-negotiables
Fast PathShort/single-purpose prompt, low ambiguity, <=3 logical parts, no unresolved unknownsREAD+UNDERSTAND may be combined; RATE+FIX may be compacted into one section if issues table is still producedVALIDATE and intent-preservation checks are ALWAYS required
Full PathMulti-section prompt, high ambiguity, >=4 logical parts, conflicting constraints, or Critical/High riskNo compression. Execute each gate separatelyAll gates and templates required

Mode selection rules (REQUIRED):

  • IF any unknown blocks progress, conflicting instructions exist, or Critical/High issues are likely → THEN use Full Path.
  • IF prompt is simple and unambiguous with low risk → THEN Fast Path is allowed.
  • IF uncertain which mode applies → THEN default to Full Path.

Minimum Execution Profile (Very Small Tasks)

  • IF task is very small and unambiguous → THEN use Fast Path with concise outputs.
  • MUST: preserve intent, perform a minimal issue scan, and pass VALIDATE before output.
  • MUST: follow selected output variant format.
  • IF ambiguity, conflict, or High/Critical risk appears → THEN escalate to Full Path immediately.

Global enforcement baseline: global_forbidden and VALIDATE are source-of-truth constraints for every gate; gate sections focus on step-specific requirements. </execution_flow>


Step 1: READ

<read_gate> STOP. DO NOT proceed to analysis.

Pre-Conditions

  • User provided prompt/file to optimize
  • Path is valid and readable

Actions (REQUIRED)

  1. MUST read the input file completely
  2. MUST note the document type and purpose
  3. MUST count approximate line count

Gate Check

Verify before proceeding:

  • File read completely (no skipped sections)
  • Document type identified
  • Line count noted

FORBIDDEN

  • Making ANY changes before reading
  • Skipping sections

ALLOWED

  • Read-only file access only
  • Text output to confirm reading

On Failure

  • IF file unreadable and inline content exists → THEN continue using the provided content
  • IF file unreadable and no content exists → THEN ask user for correct path
  • IF file empty → THEN ask user to provide content </read_gate>

Step 2: UNDERSTAND

<understand_gate> STOP. DO NOT proceed to rating. Understand what this prompt does first.

Pre-Conditions

  • Step 1 (READ) completed
  • File content in context

Actions (REQUIRED)

  1. MUST identify the goal - what is this prompt supposed to achieve?
  2. MUST identify logical parts - break down into sections/phases/steps
  3. MUST identify flow - how do the parts connect?
  4. MUST document understanding in output format below

Output Format (REQUIRED)

## Understanding

**Goal:** [What the prompt achieves]

**Logical Parts:**
1. [Part name] - [purpose]
2. [Part name] - [purpose]
...

**Flow:** [How parts connect]

Assumptions & Unknowns (REQUIRED if prompt is underspecified)

## Assumptions & Unknowns

**Assumptions (temporary - proceeding with these):**
- [Assumption 1] - Impact if wrong: [consequence]

**Unknowns (MUST ask before proceeding):**
- [Unknown 1] - Why critical: [reason]

**Clarification needed:** Yes/No

IF Unknowns exist → THEN STOP and ask user before proceeding to RATE.

Gate Check

Verify before proceeding:

  • Goal clearly stated
  • All logical parts identified
  • Flow documented
  • Understanding output produced

Reflection

  • Did I understand the intent correctly?
  • Did I identify all logical parts? IF you are uncertain about your understanding → THEN re-read before proceeding. DO NOT guess.

FORBIDDEN

  • Proceeding without understanding the goal
  • Making changes based on assumptions

ALLOWED

  • Text output (understanding summary)
  • Re-reading file if needed

On Failure

  • IF intent unclear → THEN ask user for clarification
  • IF multiple interpretations → THEN present options and WAIT for user choice </understand_gate>

Step 3: RATE

<rate_gate> STOP. DO NOT fix anything yet. Rate each logical part for issues first.

Pre-Conditions

  • Step 2 (UNDERSTAND) completed
  • Understanding output produced

Issue Categories (MUST check all)

CategoryWhat to Look ForSeverity
Weak Words"consider", "might", "could", "may", "should" in critical sectionsCritical
Missing EnforcementRules without FORBIDDEN/ALLOWEDHigh
Ambiguous Instructions"do some", "handle", "process" without specificsHigh
Referential Ambiguity"it", "this", "that", "above", "below" without clear antecedentHigh
Missing Output FormatExpected outputs without templatesMedium
Missing GatesPhase transitions without checkpointsMedium
DuplicationSame logic/rule repeated in multiple places (not just examples)Medium
Verbose/BloatSections >20 lines that could be tables; prose without constraintsMedium
Emoji as InstructionsEmojis used as commands instead of strong wordsMedium
RedundancySame example repeated, unnecessary variationsLow
Low DensityExplanations that don't constrain behaviorLow

Rating Output (REQUIRED)

## Issues Found

| Part | Issue | Severity | Fix Needed |
|------|-------|----------|------------|
| [Part name] | [Description] | Critical/High/Medium/Low | [What to do] |

Gate Check

Verify before proceeding:

  • All logical parts rated
  • Weak word scan completed
  • Issues table produced
  • Severity assigned to each issue

FORBIDDEN

  • Fixing issues before completing rating
  • Ignoring critical issues
  • Skipping weak word scan

ALLOWED

  • Text output (issues table)
  • Re-reading parts for rating

On Failure

  • IF no issues found → THEN MUST double-check with weak word scan
  • IF scan still clean → THEN document "No issues found" and proceed </rate_gate>

Weak Word Reference

Weak WordContextReplacement
consider, might, could, mayCritical sectionMUST, REQUIRED
consider, might, could, mayOptional guidanceRemove or keep with "optionally"
should, preferCritical sectionMUST
should, preferSoft guidanceKeep as-is
do some, handle, processAnySpecify exact action: "Run X", "Call Y"
as needed, if necessaryAnyIF [condition] → THEN [action]
feel free to, you canRequired actionRemove entirely, use MUST
feel free to, you canOptional action"Optionally, you may..."

CRITICAL: Weak words in FORBIDDEN/MUST/NEVER sections MUST be replaced.


Step 4: FIX

<fix_gate> STOP. Fix issues in priority order: Critical → High → Medium → Low.

Pre-Conditions

  • Step 3 (RATE) completed
  • Issues table produced

Fix Priority (MUST follow order)

  1. Critical first - Weak words in MUST/FORBIDDEN contexts
  2. High next - Missing enforcement, ambiguous instructions
  3. Medium - Missing output formats, missing gates
  4. Low last - Redundancy, density (only if value added)

Command Strength Hierarchy

StrengthKeywordsUse For
AbsoluteNEVER, ALWAYS, MUST, FORBIDDEN, CRITICALNon-negotiable rules
StopSTOP, HALT, DO NOT proceed, WAITGates/checkpoints
RequiredREQUIRED, MANDATORYEssential steps
Softshould, preferOptional guidance only

Triple Lock Pattern (REQUIRED for Critical Rules)

1. STATE: "You MUST X"
2. FORBID: "FORBIDDEN: Not doing X"
3. REQUIRE: "REQUIRED: Verify X complete"

Reasoning Block (CONDITIONAL REQUIRED Before Changes)

REQUIRED when:

  • Full Path is active, OR
  • Fast Path has any Critical/High issue.

Optional when:

  • Fast Path has only Medium/Low issues; include one-line rationale instead.

Before making changes (when required), produce a <reasoning> block:

<reasoning>
1. **Current state:** [What exists now]
2. **Goal:** [What we are trying to achieve]
3. **Approach:** [Why this specific change]
4. **Risk:** [What could go wrong]
</reasoning>

Gate Template (When Adding Gates)

<[name]_gate>
**STOP. DO NOT proceed. [What to verify]**

### Pre-Conditions
- [ ] [Previous step completed]

### Actions (REQUIRED)
1. [Action]

### Gate Check
**Verify before proceeding:**
- [ ] [Condition]

### FORBIDDEN
- [What not to do]

### ALLOWED
- [What is permitted]

### On Failure
- **IF** [condition] → **THEN** [recovery]
</[name]_gate>

Gate Check

Verify before proceeding:

  • All Critical issues fixed
  • All High issues fixed
  • Medium/Low addressed or documented as skipped
  • Reasoning requirement satisfied (block produced OR Fast Path low-risk rationale documented)

FORBIDDEN

  • Over-strengthening soft guidance (keep "should" for optional items)
  • Changing logic that already works
  • Adding unnecessary complexity
  • Skipping Critical/High issues
  • Bloating: >10% line increase without explicit justification in VALIDATE

ALLOWED

  • Text output (draft fixes)
  • Iterating on fixes

On Failure

  • IF over-strengthening detected → THEN revert and re-assess using RATE step criteria
  • IF unsure if logic changed → THEN compare before/after intent </fix_gate>

Step 5: VALIDATE

<validate_gate> STOP. DO NOT output yet. Validate all fixes against checklist.

Pre-Conditions

  • Step 4 (FIX) completed
  • All Critical/High issues addressed

Validation Checklist (MUST complete all)

REQUIRED checks:

  • No weak words in critical sections
  • Critical rules use MUST/NEVER/FORBIDDEN
  • No conversational filler
  • No conflicting instructions
  • Logical flow preserved
  • Original intent preserved
  • Triple Lock applied to critical rules
  • Line count target met (<10%) OR justified exception documented
  • Any >10% increase includes one-line reason linked to required gate/clarity fixes

Additional checks (if applicable):

  • Gates have Pre-Conditions, Gate Check, FORBIDDEN, ALLOWED, On Failure
  • Outputs have format specifications
  • IF/THEN rules for decision points

Referential Clarity (MUST check):

  • No ambiguous pronouns or positional references without explicit antecedent
  • All entities have stable names (same term throughout)
  • Steps/outputs referenced by name, not position
  • All cross-references are unambiguous
  • No implicit "the" references without clear antecedent
  • XML tags are optional; use only for attention-control needs (Markdown remains default)

Reflection (REQUIRED)

MUST answer these questions:

  1. Would I trust this prompt to execute reliably?
  2. What's the weakest remaining section?
  3. Did I change any original intent? (MUST be NO)

IF weakness identified → THEN fix or document as limitation IF intent changed → THEN STOP and revert. Return to UNDERSTAND step.

Definition of Done (DoD) - Fast Final Gate

ALL must be true before OUTPUT:

  • Single execution path (no ambiguous branches)
  • All inputs/outputs explicitly defined
  • All decision points use IF/THEN
  • No orphan references (every "it/this" resolved)

Gate Check

Verify before proceeding:

  • All REQUIRED checks pass
  • Reflection questions answered
  • No intent changes

FORBIDDEN

  • Outputting without completing validation
  • Skipping checklist items
  • Proceeding with failed checks
  • Using XML tags outside attention-control needs (Markdown remains default)

ALLOWED

  • Text output (validation results)
  • Returning to FIX step

On Failure

  • IF validation fails → THEN return to FIX step
  • IF intent changed → THEN return to UNDERSTAND step </validate_gate>

Step 6: OUTPUT

<output_gate> STOP. Verify VALIDATE step passed before outputting.

Pre-Conditions

  • Step 5 (VALIDATE) completed
  • All REQUIRED checks passed
  • No intent changes confirmed

Output Format (REQUIRED - select variant by user intent)

Selection rule (REQUIRED):

  • IF user requests complete rewritten document → THEN use Variant A.
  • IF user requests minimal edits/delta only → THEN use Variant B.
  • IF user requests review-only or the runtime cannot write safely → THEN use Variant B unless the user explicitly asks for a full rewrite.
  • IF user does not specify → THEN default to Variant A.

Common report header (REQUIRED for both variants):

# Optimization Complete

## Summary
- **Issues Found:** [N]
- **Fixes Applied:** [N]
- **Intent Preserved:** Yes

## Changes Made
| Category | Count | Examples |
|----------|-------|----------|
| Command Strengthening | [N] | [Brief example] |
| Gates Added/Fixed | [N] | [Brief example] |
| Redundancy Removed | [N] | [Brief example] |

Variant A - Full Document (default):

## Optimized Document
[Full optimized content]

Variant B - Patch-Style Delta (minimal edits):

## Patch-Style Delta
| Section | Before | After | Why |
|---------|--------|-------|-----|
| [Section name] | [Old text] | [New text] | [Reason] |

FORBIDDEN

  • Deviating from selected output variant
  • Outputting without validation pass
  • Omitting required deliverable (full document for Variant A, patch-style delta for Variant B)
  • Claiming a file was updated when the write policy prevented edits

ALLOWED

  • Safe file edit/write capability to save optimized content
  • Text output (summary + document)

On Failure

  • IF format deviates → THEN regenerate output
  • IF user requests changes → THEN return to FIX step </output_gate>

Reference: Instruction Precedence

<precedence_table> When rules conflict, follow this precedence (highest wins):

PriorityCategoryExamplesNotes
1 (highest)Safety/Tool RestrictionsFORBIDDEN tools, NEVER actionsAlways wins
2User explicit request"I want X", "Do Y"Overrides defaults
3FORBIDDEN/MUST rules"FORBIDDEN: changing logic"Overrides preferences
4Skill defaultsDefault behaviors, templatesBaseline
5 (lowest)Soft guidance"prefer", "consider"Yields to all above

Resolution rule: When two rules conflict, the higher priority wins. Document the conflict and resolution. </precedence_table>


Reference: Conflict Resolution Micro-Protocol

<conflict_protocol> Use this protocol when instructions conflict:

  1. Detect - Name the two conflicting instructions explicitly.
  2. Resolve - Apply precedence table (highest priority wins).
  3. Document - Add one-line note: "Conflict: [A] vs [B] -> Resolved by [priority N rule]".
  4. Continue - Proceed using the resolved instruction only.

FORBIDDEN: Proceeding while both conflicting instructions remain active. </conflict_protocol>


Reference: Context Patterns

<reasoning_patterns>

State Summaries (Context Retention)

Use concise summaries only when needed to preserve context:

  • Goal
  • Progress
  • Next step
  • Blockers (if any)

Conditional requirement:

  • Full Path: produce a state summary at each phase transition or context shift.
  • Fast Path: produce a state summary only when context shifts materially. </reasoning_patterns>

Reference: High-Value vs Low-Value Content

<content_guide>

Keep (High Value)Remove/Reduce (Low Value)
Tables with explicit actionsExplanatory prose without constraints
Imperative verbs (STOP, VERIFY, EXECUTE)Repeated examples (keep 1-2)
FORBIDDEN/ALLOWED listsLong paragraphs that can be tables
IF/THEN decision rulesHedging language in critical rules
Markdown default + optional XML for attention controlEmoji used as instructions (unless required by output)
</content_guide>

Quick Reference

Use this only as a mnemonic; gate sections are source of truth.

NeedPattern
Stop/Checkpoint**STOP. DO NOT proceed.** + ### Gate Check
Mandatory action**REQUIRED:** You MUST [action]
Prohibited action**FORBIDDEN:** [action]
Decision logic**IF** [condition] → **THEN** [action]
Critical rule hardeningTriple Lock: STATE + FORBID + REQUIRE

Common Mistakes

<common_mistakes>

MistakeWhy It FailsFix
Over-strengthening soft guidance"prefer" → "MUST" breaks optional flexibilityKeep "should/prefer" for truly optional items
Using "it/this/that"Agent loses context, applies fix to wrong elementName every entity explicitly
Changing working logicUser trusted original behaviorFORBIDDEN: If the logic works, don't touch it
Overusing XML tagsNoise and style drift without reliability gainKeep Markdown default; use XML only for attention control
</common_mistakes>

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.2%
按下载量换算143

Claude

30.17%
按下载量换算134

Cursor

19.09%
按下载量换算85

Gemini CLI

9.59%
按下载量换算43

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills