# Stable Diffusion Prompt Optimizer

> Analyzes and enhances Stable Diffusion prompts using the Automatic1111 WebUI API /sdapi/v1/txt2img endpoint. Applies prompt weighting, negative prompt generation, and A1111-specific syntax like (keyword:weight).

- Skill: `agentskillexchange/stable-diffusion-prompt-optimizer` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentskillexchange/stable-diffusion-prompt-optimizer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentskillexchange/stable-diffusion-prompt-optimizer/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: agentskillexchange (https://skillmd.com/u/agentskillexchange)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/agentskillexchange/stable-diffusion-prompt-optimizer

---


# Stable Diffusion Prompt Optimizer

Analyzes and enhances Stable Diffusion prompts using the Automatic1111 WebUI API /sdapi/v1/txt2img endpoint. Applies prompt weighting, negative prompt generation, and A1111-specific syntax like (keyword:weight).

## Installation

Use the upstream install or setup path that matches your environment:
- conda env create -f environment.yaml
- conda activate ldm
- conda install pytorch torchvision -c pytorch
- pip install transformers==4.19.2 diffusers invisible-watermark

Requirements and caveats from upstream:
- python scripts/txt2img.py --prompt "a photograph of an astronaut riding a horse" --plms
- and renders images of size 512x512 (which it was trained on) in 50 steps. All supported arguments are listed below (type python scripts/txt2img.py --help).

Basic usage or getting-started notes:
- A suitable [conda](https://conda.io/) environment named ldm can be created
- and activated with:
- You can also update an existing [latent diffusion](https://github.com/CompVis/latent-diffusion) environment by running

- Source: https://github.com/CompVis/stable-diffusion
- Extracted from upstream docs: https://raw.githubusercontent.com/CompVis/stable-diffusion/HEAD/README.md

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/stable-diffusion-prompt-optimizer/)

