Prompt optimizer
Skill claude-hangar/claude-hangar/core/skills/prompt-optimizer
Production-grade configuration management for Claude Code. Hooks, agents, skills, multi-project orchestration.
npx -y skills add claude-hangar/claude-hangar --skill prompt-optimizerAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Analyzes draft prompts, identifies gaps, matches available skills/agents, and recommends optimal workflows. Advisory only — never executes, only optimizes. Use when unsure which skills or approach to use for a task.
SKILL.md
5.8 KB, as published. Nobody here has run it
/prompt-optimizer — Prompt Analysis Pipeline
Six-phase advisory skill that takes a user's draft prompt or task description and produces an optimized version with the right skills, agents, and workflow.
Advisory only — this skill never executes the task. It produces an optimized prompt the user can then run.
Usage
/prompt-optimizer "Add authentication to my SvelteKit app"
/prompt-optimizer # Analyze the last user message
/prompt-optimizer --quick # Short version for experienced users
The Six Phases
Phase 1: Detect Project Context
Gather project metadata without reading the full codebase:
# Quick project detection
cat CLAUDE.md 2>/dev/null | head -30
cat package.json 2>/dev/null | node -e "const p=require('/dev/stdin'); console.log(p.name, Object.keys(p.dependencies||{}).slice(0,10))"
ls -d src/ app/ lib/ pages/ routes/ components/ 2>/dev/null
git remote -v 2>/dev/null | head -1
Output: Tech stack, framework, project type, repo context.
Phase 2: Detect User Intent
Parse the prompt to identify:
- Primary goal: What does the user want to achieve?
- Implicit requirements: What's assumed but not stated?
- Scope boundaries: What should NOT change?
- Success criteria: How will we know it's done?
Phase 3: Assess Scope
Classify the task:
| Size | Criteria | Recommended Approach |
|---|---|---|
| Small | Single file, < 30 min | Direct implementation |
| Medium | 2-5 files, clear scope | Plan then implement |
| Large | 6+ files, architectural | Full planning phase with planner agent |
| Ambiguous | Unclear scope or requirements | Brainstorming first |
Phase 4: Match Hangar Components
Scan available skills and agents for the best match:
# List available skills and their descriptions
for skill in core/skills/*/SKILL.md; do
head -5 "$skill" | grep "description:"
done
# List available agents
for agent in core/agents/*.md; do
head -5 "$agent" | grep "description:"
done
Match criteria:
- Skill trigger keywords vs. task keywords
- Agent capabilities vs. task requirements
- Stack-specific skills if applicable
- Context modes (dev/research/review) if applicable
Phase 5: Identify Missing Context
What information would improve the prompt?
| Gap Type | Example | Question to Ask |
|---|---|---|
| Requirements | No success criteria specified | "What should happen when auth fails?" |
| Constraints | No performance budget | "Any latency requirements?" |
| Existing code | Unknown current state | "Is there existing auth code to build on?" |
| Dependencies | Unclear external services | "Which auth provider (or custom)?" |
Phase 6: Generate Optimized Prompt
Produce two versions:
Full Version (Copy-Paste Ready)
Includes all context, constraints, skill references, and step-by-step approach. Ready to paste as a new prompt.
Quick Version (Experienced Users)
Key instructions only, assumes familiarity with Hangar tools.
Output Format
## Prompt Optimization Report
### Project Context
- **Framework:** SvelteKit 2 + Svelte 5
- **Stack:** Drizzle ORM + PostgreSQL
- **Context mode:** dev
### Intent Analysis
- **Goal:** Add user authentication
- **Implicit:** Session management, login/signup pages, protected routes
- **Scope:** Auth module only, don't touch existing routes
- **Success:** Users can register, login, access protected content
### Scope: LARGE (6+ files, architectural change)
**Recommended:** Use planner agent first, then TDD with tdd-guide
### Matched Components
| Component | Type | Relevance |
|-----------|------|-----------|
| Auth stack | Stack | High — has auth patterns for bcryptjs + sessions |
| security-scan | Skill | Medium — run after implementation |
| verification-loop | Skill | High — run before PR |
| tdd-guide | Agent | High — TDD for auth is critical |
| security-reviewer | Agent | High — auth needs security review |
### Missing Context (ask these first)
1. Custom auth or external provider (OAuth, Auth.js)?
2. Email verification required?
3. Role-based access control needed?
### Optimized Prompt (Full)
> I need to add custom authentication (bcryptjs + sessions) to my SvelteKit app.
>
> **Requirements:**
> - User registration with email + password
> - Login/logout with secure session cookies
> - Protected routes via server-side hooks
> - Password hashing with bcryptjs (12 rounds)
>
> **Approach:**
> 1. Use the Auth stack patterns from Hangar
> 2. Start with planner agent for implementation plan
> 3. Follow TDD (tdd-guide) for all auth logic
> 4. Run security-reviewer when done
> 5. Run /verify before PR
>
> **Constraints:**
> - No external auth providers
> - DSGVO-compliant (no tracking cookies)
> - Existing routes must not break
### Optimized Prompt (Quick)
> Add custom auth (bcryptjs + sessions) to SvelteKit.
> Use Auth stack patterns. TDD with tdd-guide. Security review after.
When to Use
- Unclear tasks — When you don't know which skills to use
- Large tasks — When the approach matters as much as the implementation
- New to Hangar — When learning which tools are available
- Complex prompts — When the task has many implicit requirements
What This Skill is NOT
- Not a prompt rewriter for AI conversations in general
- Not a prompt injection defense tool
- Not an auto-executor — it ONLY advises
Inspired by ECC's prompt-optimizer with Hangar's component-matching approach.
Gives 0 of the 12 instructions most prompt engineering skills give
Counted across 563 of the 626 authors here whose files we hold, read 2026-08-06
- ask at most three clarifying questionsin 22 of 563, across 15 files
- respond in the user input languagein 14 of 563, across 9 files
- preserve the original intentin 13 of 563, across 11 files
- Establish baseline metrics and collect representative examplesin 12 of 563, across 2 files
- Identify failure modes and prioritize high-impact fixesin 12 of 563, across 2 files
- Apply prompt and workflow improvements with measurable goalsin 12 of 563, across 2 files
- Roll back quickly if quality or safety metrics regressin 12 of 563, across 2 files
- validate changes with tests and roll out in controlled stagesin 12 of 563, across 2 files
- generate quantitative baseline performance reportsin 12 of 563, across 2 files
- create representative test scenariosin 12 of 563, across 2 files
- treat prompts as codein 12 of 563, across 5 files
- test prompts on diverse inputsin 12 of 563, across 8 files
Said here and by no other author read
- parse the prompt to identify primary goals
- identify implicit requirements and scope boundaries
- classify the task size and recommend an approach
- match task keywords to available skills and agents
- identify missing context and form clarifying questions
- generate a quick prompt for experienced users
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.