octocode-prompt-optimizer
Activate when user provides a prompt, SKILL.md, or agent instruction and requests optimization. Transforms weak instructions into reliable, enforceable agent protocols.
Install
mkdir -p .claude/skills/octocode-prompt-optimizer && curl -L -o skill.zip "https://mcp.directory/api/skills/download/7659" && unzip -o skill.zip -d .claude/skills/octocode-prompt-optimizer && rm skill.zipInstalls to .claude/skills/octocode-prompt-optimizer
About this skill
Prompt Optimizer Skill
<what> Analyzes and improves instructional prompts, documentation, and agent instructions using prompt engineering best practices while preserving original intent. </what><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:
- Changing good parts that already work
- Changing the existing logic/intent of prompts
- Making changes before understanding the prompt
- Leaving weak words in critical sections
- Outputting without validation
- Over-strengthening soft guidance
- Skipping gates or checkboxes
- 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
| Step | Action | Gate Requirement | FORBIDDEN Until Gate Passes |
|---|---|---|---|
| 1 | READ the prompt completely | All checkboxes checked | Analysis, changes |
| 2 | UNDERSTAND what the prompt does | Understanding output produced | Rating, fixes |
| 3 | RATE each part for issues | Issues table produced | Fixing issues |
| 4 | FIX issues by severity | All Critical/High fixed | Validation |
| 5 | VALIDATE against checklist | All REQUIRED checks pass | Output |
| 6 | OUTPUT optimized document | Format followed exactly | N/A |
CRITICAL: You MUST complete each gate before proceeding. DO NOT skip steps.
Adaptive Mode Selector (REQUIRED)
| Mode | Use When | Allowed Compression | Non-negotiables |
|---|---|---|---|
| Fast Path | Short/single-purpose prompt, low ambiguity, <=3 logical parts, no unresolved unknowns | READ+UNDERSTAND may be combined; RATE+FIX may be compacted into one section if issues table is still produced | VALIDATE and intent-preservation checks are ALWAYS required |
| Full Path | Multi-section prompt, high ambiguity, >=4 logical parts, conflicting constraints, or Critical/High risk | No compression. Execute each gate separately | All 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)
- MUST read the input file completely
- MUST note the document type and purpose
- 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)
- MUST identify the goal - what is this prompt supposed to achieve?
- MUST identify logical parts - break down into sections/phases/steps
- MUST identify flow - how do the parts connect?
- 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)
| Category | What to Look For | Severity |
|---|---|---|
| Weak Words | "consider", "might", "could", "may", "should" in critical sections | Critical |
| Missing Enforcement | Rules without FORBIDDEN/ALLOWED | High |
| Ambiguous Instructions | "do some", "handle", "process" without specifics | High |
| Referential Ambiguity | "it", "this", "that", "above", "below" without clear antecedent | High |
| Missing Output Format | Expected outputs without templates | Medium |
| Missing Gates | Phase transitions without checkpoints | Medium |
| Duplication | Same logic/rule repeated in multiple places (not just examples) | Medium |
| Verbose/Bloat | Sections >20 lines that could be tables; prose without constraints | Medium |
| Emoji as Instructions | Emojis used as commands instead of strong words | Medium |
| Redundancy | Same example repeated, unnecessary variations | Low |
| Low Density | Explanations that don't constrain behavior | Low |
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 Word | Context | Replacement |
|---|---|---|
| consider, might, could, may |
Content truncated.
More by bgauryy
View all skills by bgauryy →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversAccess Intercom data securely via a remote MCP server with authenticated connections for AI tools and live updates.
Enhance software testing with Playwright MCP: Fast, reliable browser automation, an innovative alternative to Selenium s
Arize Phoenix — unified interface for managing prompts, exploring datasets, and running LLM experiments across providers
Guide your software projects with structured prompts from requirements to code using the waterfall development model and
Reddit Buddy offers powerful Reddit API tools for browsing, searching, and data annotation with secure access, rate limi
Reddit Buddy offers clean access to Reddit API, advanced reddit tools, and seamless data annotation reddit with smart ca
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.