prompt-optimizer
Skill15 starsChanged 7 months agoMITView on GitHub
Use when improving a Salesforce, Apex, or LWC prompt. Analyze intent and gaps, match SCC skills/agents, output a ready-to-paste optimized prompt. Advisory only.
72 other projects use a version of this, 21 of them edited.
Adopted by
Most recently taken up by
- Rojios/everything-claude-codeedited, first seen Nov 8, 2026
- ahmadvahidi/skill-atlasedited, first seen Nov 8, 2026
- Samuel-Shek/prompt-optimizertheir own version, first seen Nov 8, 2026
- EchoUser005/prompt-optimizertheir own version, first seen Nov 8, 2026
- dreamor/prompt-optimizer-skilltheir own version, first seen Nov 8, 2026
- rodeyseijkens/skillstheir own version, first seen Nov 6, 2026
Used with
Projects with it also use agent-architecture-audit, agent-harness-construction and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
ronmkrSkillagent-architecture-audit
Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature.
Also in 3 projects that use this
junimnjwSkillagent-harness-construction
Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates.
Also in 3 projects that use this
get-proofpilotSkillcontext-budget
Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat, redundant components, and produces prioritized token-savings recommendations.
Also in 5 projects that use this
LangChainSkilldocker-patterns
Best practices for Docker containerization and multi-stage builds
Also in 4 projects that use this
royaluniondesign-sysSkilldeployment-patterns
Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.
Also in 3 projects that use this
GSA-TTSSkillarchitecture-decision-records
Load when a user wants architecture decision records (ADRs) drafted from requirements or a design discussion, asks which decisions need an ADR, or wants an ADR draft reviewed for one-sided trade-offs, weak alternatives or missing requirement links. Not for setting up a project's whole documentation system (project-documentation-system).
Also in 3 projects that use this
Other versions72 projects use a version of this.
Word for word · 0
None found.
Edited · 21
- loulanyue/awesome-claude-notes★ 27243% same
- Fmarzochi/EGC★ 6142% same
- frankxai/agentic-creator-os★ 1043% same
- gongyijie85/dsh-ecc★ 843% same
- Ayiming12/skills★ 142% same
- get-proofpilot/claude-skills-catalog★ 143% same
- junimnjw/everything-claude-code★ 143% same
- NISTALTALSON/essential-claude-skills★ 142% same
- Rojios/everything-claude-code★ 143% same
- SamuelNDCE/claude-super-skill-library★ 142% same
11 more not listed
Wrote their own version · 51
- github/awesome-copilot★ 41ksame name
- daymade/claude-code-skills★ 1.5ksame name
- getsentry/skills★ 1.1ksame name
- chujianyun/skills★ 751same name
- Cranot/roam-code★ 517same name
- drvoss/everything-copilot-cli★ 48same name
- khalilbenaz/claude-skills-collection★ 28same name
- kunwl123456/zeroclaw-skills-collection★ 27same name
- ckanner/agent-skills★ 23same name
- Thomaszhou22/prompt-optimizer-skill★ 20same name
41 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- asideSkill
- checkpointSkill
- configure-sccSkill
- continuous-agent-loopSkill
- mcp-server-patternsSkill
- model-routeSkill
- refactor-cleanSkill
- resume-sessionSkill
- save-sessionSkill
- search-firstSkill
- security-scanSkill
- sessionsSkill
- sf-2gp-security-reviewSkill
- sf-agentforce-developmentSkill
- sf-agentforce-mcp-actionsSkill
- sf-apex-async-patternsSkill
- sf-apex-best-practicesSkill
- sf-apex-constraintsSkill
- sf-apex-cursorSkill
- sf-apex-enterprise-patternsSkill
- sf-apex-testingSkill
- sf-api-designSkill
- sf-approval-processesSkill
- sf-aura-developmentSkill
- sf-build-fixSkill
- sf-cli-referenceSkill
- sf-data-modelingSkill
- sf-debuggingSkill
- sf-deployment-constraintsSkill
- sf-deploymentSkill
- sf-devops-ci-cdSkill
- sf-docs-lookupSkill
- sf-e2e-testingSkill
- sf-experience-cloudSkill
- sf-flow-developmentSkill
- sf-governor-limitsSkill
- sf-harness-auditSkill
- sf-helpSkill
- sf-integrationSkill
- sf-lwc-constraintsSkill
- sf-lwc-developmentSkill
- sf-lwc-testingSkill
- sf-metadata-managementSkill
- sf-platform-events-cdcSkill
- sf-quickstartSkill
- sf-security-constraintsSkill
- sf-securitySkill
- sf-soql-constraintsSkill
- sf-soql-optimizationSkill
- sf-tdd-workflowSkill
- sf-testing-constraintsSkill
- sf-trigger-constraintsSkill
- sf-trigger-frameworksSkill
- sf-visualforce-developmentSkill
- strategic-compactSkill
- update-docsSkill
- update-platform-docsSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 9 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 58 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Do NOT write code, create files, run commands, or take any implementation action.
- Distinctive: line 37
If the user says "just do it" or "don't optimize, just execute", do not switch into implementation mode inside this skill.
- Distinctive: line 42
Run this 6-phase pipeline sequentially.
- Distinctive: line 48
Before analyzing the prompt, detect the current project context:
- Distinctive: line 50
Check if a CLAUDE.md exists in the working directory — read it for project conventions
- Distinctive: line 56
If no project files are found (e.g., the prompt is abstract or for a new project), skip detection and flag "tech stack unknown" in Phase 4.
- Distinctive: line 77
If Phase 0 detected a project, use codebase size as a signal.
- Distinctive: line 165
Use /save-session and /resume-session to preserve context between sessions
- Distinctive: line 185
If Phase 0 auto-detected the answer, state it instead of asking.
“Common” is measured: kept by at least 6 in 10 of the 58 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Prompt Optimizer
Analyze a draft prompt, critique it, match it to SCC ecosystem components, and output a complete optimized prompt the user can paste and run.
When to Use
- User says "optimize this prompt", "improve my prompt", "rewrite this prompt"
- User says "help me write a better prompt for..."
- User says "what's the best way to ask Claude Code to..."
- User pastes a draft prompt and asks for feedback or enhancement
- User says "I don't know how to prompt for this"
- User says "how should I use SCC for..."
- User explicitly invokes
/prompt-optimizer
Do Not Use When
- User wants the task done directly (just execute it)
- User says "optimize this code", "optimize performance" — these are refactoring tasks, not prompt optimization
- User is asking about SCC configuration (use
configure-sccinstead) - User wants a skill inventory (use
/sf-harness-auditskill instead) - User says "just do it"
How It Works
Advisory only — do not execute the user's task.
Do NOT write code, create files, run commands, or take any implementation action. Your ONLY output is an analysis plus an optimized prompt.
If the user says "just do it" or "don't optimize, just execute", do not switch into implementation mode inside this skill. Tell the user this skill only produces optimized prompts, and instruct them to make a normal task request if they want execution instead.
Run this 6-phase pipeline sequentially. Present results using the Output Format below.
Analysis Pipeline
Phase 0: Project Detection
Before analyzing the prompt, detect the current project context:
- Check if a
CLAUDE.mdexists in the working directory — read it for project conventions - Detect tech stack from project files:
sfdx-project.json→ Salesforce (Apex / LWC / SOQL / Flow / Agentforce)package.json→ Node.js / LWC tooling / Jest tests
- Note detected tech stack for use in Phase 3 and Phase 4
If no project files are found (e.g., the prompt is abstract or for a new project), skip detection and flag "tech stack unknown" in Phase 4.
Phase 1: Intent Detection
Classify the user's task into one or more categories:
| Category | Signal Words | Example |
| New Feature | build, create, add, implement | "Build a lead scoring trigger" |
| Bug Fix | fix, broken, not working, error | "Fix the trigger recursion" |
| Refactor | refactor, clean up, restructure | "Refactor to trigger framework" |
| Research | how to, what is, explore, investigate | "How to add Platform Events" |
| Testing | test, coverage, verify | "Add tests for AccountService" |
| Review | review, audit, check | "Review my Apex trigger" |
| Documentation | document, update docs | "Update the API docs" |
| Infrastructure | deploy, CI, scratch org, DevOps | "Set up CI/CD with scratch orgs" |
| Design | design, architecture, plan | "Design the data model" |
Phase 2: Scope Assessment
If Phase 0 detected a project, use codebase size as a signal. Otherwise, estimate from the prompt description alone and mark the estimate as uncertain.
| Scope | Heuristic | Orchestration |
| TRIVIAL | Single file, < 50 lines | Direct execution |
| LOW | Single component or module | Single command or skill |
| MEDIUM | Multiple components, same domain | Command chain + sf-review-agent agent |
| HIGH | Cross-domain, 5+ files | Use sf-architect agent first, then phased execution |
| EPIC | Multi-session, multi-PR, architectural shift | Use sf-architect agent for multi-session plan |
Phase 3: SCC Component Matching
Map intent + scope + tech stack (from Phase 0) to specific SCC components.
By Intent Type
| Intent | Invocable Skills | Skills | Agents |
| New Feature | sf-tdd-workflow, sf-apex-best-practices | sf-apex-best-practices, sf-apex-enterprise-patterns | sf-architect, sf-apex-agent, sf-review-agent |
| Bug Fix | sf-tdd-workflow, sf-build-fix | sf-apex-testing, sf-debugging | sf-bugfix-agent, sf-apex-agent |
| Refactor | /refactor-clean, sf-apex-best-practices | sf-trigger-frameworks, sf-apex-enterprise-patterns | refactor-cleaner, sf-review-agent |
| Testing | sf-tdd-workflow, sf-apex-testing, sf-e2e-testing | sf-apex-testing, sf-tdd-workflow | sf-apex-agent |
| Review | sf-apex-best-practices, sf-lwc-development, sf-security | sf-security | sf-review-agent, sf-review-agent |
| Documentation | /update-docs | — | doc-updater, deep-researcher |
| Infrastructure | sf-deployment | sf-devops-ci-cd, sf-deployment | sf-architect |
| Design (EPIC) | — | — | sf-architect, sf-architect |
By Tech Stack
| Tech Stack | Skills to Add | Agent |
| Apex | sf-apex-best-practices, sf-apex-testing, sf-security | sf-review-agent |
| LWC | sf-lwc-development, sf-lwc-testing | sf-lwc-agent |
| SOQL | sf-soql-optimization | sf-apex-agent |
| Flow | sf-flow-development | sf-flow-agent |
| Agentforce | sf-agentforce-development | sf-agentforce-agent |
| DevOps | sf-devops-ci-cd, sf-deployment | sf-architect |
| Security | sf-security | sf-review-agent |
| EPIC | — | sf-architect, sf-architect |
Phase 4: Missing Context Detection
Scan the prompt for missing critical information. Check each item and mark whether Phase 0 auto-detected it or the user must supply it:
- Tech stack — Detected in Phase 0, or must user specify?
- Target scope — Files, directories, or modules mentioned?
- Acceptance criteria — How to know the task is done?
- Error handling — Edge cases and failure modes addressed?
- Security requirements — Auth, input validation, secrets?
- Testing expectations — Unit, integration, E2E?
- Performance constraints — Governor limits, bulk patterns, SOQL selectivity?
- UI/UX requirements — Design specs, SLDS compliance, accessibility? (if LWC)
- Database changes — Schema, migrations, indexes? (if data layer)
- Existing patterns — Reference files or conventions to follow?
- Scope boundaries — What NOT to do?
If 3+ critical items are missing, ask the user up to 3 clarification questions before generating the optimized prompt. Then incorporate the answers into the optimized prompt.
Phase 5: Workflow & Model Recommendation
Determine where this prompt sits in the development lifecycle:
Research → Plan → Implement (TDD) → Review → Verify → CommitFor MEDIUM+ tasks, always start with the sf-architect agent. For EPIC tasks, use the sf-architect agent.
Model recommendation (include in output):
| Scope | Recommended Model | Rationale |
| TRIVIAL-LOW | Sonnet | Fast, cost-efficient for simple tasks |
| MEDIUM | Sonnet | Best coding model for standard work |
| HIGH | Sonnet (main) + Opus (planning) | Opus for architecture, Sonnet for implementation |
| EPIC | Opus (sf-architect) + Sonnet (execution) | Deep reasoning for multi-session planning |
Multi-prompt splitting (for HIGH/EPIC scope):
For tasks that exceed a single session, split into sequential prompts:
- Prompt 1: Research + Plan (use search-first skill, then sf-architect agent)
- Prompt 2-N: Implement one phase per prompt (each ends with sf-review-agent agent)
- Final Prompt: Integration test + sf-apex-best-practices across all phases
- Use /save-session and /resume-session to preserve context between sessions
Output Format
Present your analysis in this exact structure. Respond in the same language as the user's input.
Section 1: Prompt Diagnosis
Strengths: List what the original prompt does well.
Issues:
| Issue | Impact | Suggested Fix |
| (problem) | (consequence) | (how to fix) |
Needs Clarification: Numbered list of questions the user should answer. If Phase 0 auto-detected the answer, state it instead of asking.
Section 2: Recommended SCC Components
| Type | Component | Purpose |
| Command | sf-tdd-workflow | TDD workflow for Apex |
| Skill | sf-apex-best-practices | Apex coding standards |
| Agent | sf-review-agent | Post-implementation review |
| Model | Sonnet | Recommended for this scope |
Section 3: Optimized Prompt — Full Version
Present the complete optimized prompt inside a single fenced code block. The prompt must be self-contained and ready to copy-paste. Include:
- Clear task description with context
- Tech stack (detected or specified)
- /command invocations at the right workflow stages
- Acceptance criteria
- Verification steps
- Scope boundaries (what NOT to do)
For items that reference blueprint, write: "Use the sf-architect agent to..."
(not sf-architect agent, since sf-architect is an agent, not a command).
Section 4: Optimized Prompt — Quick Version
A compact version for experienced SCC users. Vary by intent type:
| Intent | Quick Pattern |
| New Feature | Use sf-architect agent for [feature]. sf-tdd-workflow to implement. sf-apex-best-practices. Use sf-review-agent agent. |
| Bug Fix | sf-tdd-workflow — write failing test for [bug]. Fix to green. Use sf-review-agent agent. |
| Refactor | /refactor-clean [scope]. sf-apex-best-practices. Use sf-review-agent agent. |
| Research | Use search-first skill for [topic]. Use sf-architect agent based on findings. |
| Testing | sf-tdd-workflow [class]. sf-e2e-testing for critical flows. sf-apex-testing. |
| Review | sf-apex-best-practices. Then use sf-review-agent agent. |
| Docs | /update-docs. Use deep-researcher agent. |
| EPIC | Use sf-architect agent for "[objective]". Execute phases with sf-review-agent agent gates. |
Section 5: Enhancement Rationale
| Enhancement | Reason |
| (what was added) | (why it matters) |
Footer
Not what you need? Tell me what to adjust, or make a normal task request if you want execution instead of prompt optimization.
Examples
Trigger Examples
- "Optimize this prompt for SCC"
- "Rewrite this prompt so Claude Code uses the right commands"
- "How should I prompt SCC for this task?"
Example 1: Vague Salesforce Prompt (Project Detected)
User input:
Help me write an Account triggerPhase 0 detects: sfdx-project.json → Salesforce project; package.json with Jest
Optimized Prompt (Full):
Implement an Account trigger using the project's existing Trigger Framework pattern.
Technical requirements:
- Follow the project's existing trigger handler architecture (check for TriggerHandler base class or similar framework)
- Implement bulkification — all SOQL queries and DML operations must be outside loops
- Add appropriate error handling and custom exception classes
- Follow Salesforce governor limits best practices
Workflow:
1. Use sf-architect agent to plan trigger handler structure and business logic
2. sf-tdd-workflow — write failing test class first (use @TestSetup and test data factory)
3. Implement AccountTrigger and AccountTriggerHandler
4. sf-apex-best-practices to review implementation
5. Use sf-review-agent agent to verify all tests pass and coverage reaches 75%+
Security requirements:
- Use WITH USER_MODE for SOQL queries
- Verify CRUD/FLS permissions
Acceptance criteria:
- Test coverage 85%+
- Zero governor limit violations
- Passes sf-security reviewExample 2: Moderate English Prompt
User input:
Add a REST API endpoint for account creation with validationPhase 0 detects: sfdx-project.json → Salesforce project
Optimized Prompt (Full):
Add a REST API endpoint for account creation (POST /api/accounts).
Tech stack: Salesforce Apex REST (detected from sfdx-project.json)
Requirements:
- @RestResource(urlMapping='/api/accounts')
- Input validation: Name (required), Industry, BillingCountry
- Auth: Connected App OAuth — caller must have Account create permission
- Return 201 with created Account Id on success
- Return 400 with validation errors on invalid input
- Return 403 for insufficient permissions
Workflow:
1. Use sf-architect agent for the endpoint structure, validation logic, and error response envelope
2. sf-tdd-workflow — write tests for success, validation failure, permission failure
3. Implement AccountAPI class following existing REST patterns
4. sf-security — verify CRUD/FLS enforcement
5. sf-apex-best-practices
6. Use sf-review-agent agent — run full test suite, confirm no regressions
Do not:
- Modify existing Account fields or validation rules
- Add new custom fields without a separate plan stepExample 3: EPIC Project
User input:
Migrate our legacy Apex triggers to a trigger frameworkOptimized Prompt (Full):
Use the sf-architect agent to plan: "Migrate all legacy Apex triggers to trigger framework"
Before executing, answer these questions in the blueprint:
1. Which trigger framework is preferred (custom TriggerHandler, Apex Commons, or other)?
2. How many triggers exist and which objects are highest priority?
3. Are there existing test classes that need to be preserved?
4. What is the deployment strategy (all at once vs object-by-object)?
The blueprint should produce phases like:
- Phase 1: Audit all existing triggers and document business logic
- Phase 2: Implement TriggerHandler base class and factory
- Phase 3: Migrate highest-priority object triggers with sf-tdd-workflow gates
- Phase 4: Migrate remaining triggers
- Phase N: Remove legacy trigger code, run full regression
Each phase = 1 deployment unit, with sf-review-agent agent gates between phases.
Use /save-session between phases. Use /resume-session to continue.
Recommended: Opus for blueprint planning, Sonnet for phase execution.Related Components
| Component | When to Reference |
configure-scc | User hasn't set up SCC yet |
/sf-harness-audit (skill) | Audit which components are installed (use instead of hardcoded catalog) |
search-first | Research phase in optimized prompts |
sf-architect (agent) | EPIC-scope optimized prompts |
strategic-compact | Long session context management |
strategic-compact (token tips) | Token optimization recommendations |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

