Turning AI Outfit Swapping into a Reusable Skill and HTML Tool for E-commerce Product Images
This article explains how to package an AI outfit swapping workflow for e-commerce visuals into an installable Skill, with an HTML page for uploading materials and configuring tasks. It covers the role of each reference image, the six-stage workflow, prompt design, quality checks, variable-level retries, file structure, and usage boundaries.
Changing the outfit on the same model is a frequent requirement in e-commerce visual production. Traditional workflows involve photography, cutout, retouching, and repeated adjustments. They take a long time and often produce problems such as changes to the model’s identity, lost garment details, deformed hands and feet, and inconsistent lighting.
As image generation matures, this task can be abstracted into a standardized workflow. The inputs are a model reference image, a garment product image, and optional pose and scene images. The workflow then runs material analysis, visual planning, prompt generation, image generation, and quality checks, and outputs images suitable for e-commerce display.
However, if every request is described again in a temporary chat, several problems appear. First, the steps are not fixed, so key constraints are easily missed. Second, past parameters are hard to reuse, so switching to another model or project means debugging from scratch. Third, when generation fails, the whole task is often redone, with no way to fix a single variable. Fourth, team members lack a shared standard, so final image quality is unstable.
The proposed solution is to package this workflow as an installable Skill and provide a more intuitive HTML page for uploading materials and configuring tasks. The Skill handles task understanding, prompt construction, and quality checks. The HTML page handles interaction. Together, they turn one-off, conversational creation into a reusable, task-based production tool.
1. Define the Role of Each Reference Image
The most important design principle for outfit swapping is that no material should take on responsibilities outside its purpose. Each reference image should constrain only what it does best. This prevents the model from making incorrect associations when inputs conflict.
1. Model reference image: lock the person’s identity only
The model image mainly constrains facial features, hairstyle, skin tone, apparent age, body proportions, and overall presence. It should not decide the final garment, and it should not force a particular background or pose.
The prompt should specify that:
- The person’s identity and facial features remain stable.
- The apparent age, hairstyle, and basic body shape do not change.
- The original garment in the model image is not copied unless the user explicitly asks for it.
- No accessories or extra people are invented based on the model image.
2. Garment product image: lock the garment attributes only
The garment image provides the style, color, fit, fabric, collar, sleeve type, buttons, zippers, prints, and structural details. For e-commerce, garment accuracy usually matters more than background complexity.
The following should be constrained specifically:
- The main color and fabric appearance of the garment stay consistent.
- The garment length, shoulder line, cuffs, neckline, and placket structure are preserved.
- No extra patterns, text, brand marks, or decorations are added.
- The garment must follow the logic of how clothing sits on a body, with no floating parts, clipping through the body, or misaligned structure.
3. Pose image: control only movement and composition
The pose image can specify standing or sitting position, body orientation, arm and leg positions, and framing. It should not change the model’s identity or the garment attributes.
For example, the pose constraint can be written as:
Reference the body orientation, arm position, and camera composition of the pose image, but keep the target model’s identity and the target garment. Do not copy the person, clothing, or background from the pose image.
4. Scene image: control only the environment and lighting
The scene image describes the indoor space, street, studio, outdoor natural setting, ground material, background layers, and light direction. When using it, avoid letting people or garments from the scene image carry over into the result.
If no scene image is provided, a neutral background can be generated based on the task type, such as a plain studio backdrop, a simple home interior, or a low-distraction outdoor setting. However, the model and garment images are required. If either is missing, the workflow must not fill it in on its own.
2. Design the Skill Workflow
A complete outfit swapping Skill should be organized into the following six stages.
Stage 1: Material intake and completeness check
When the Skill starts, it first checks whether the user has provided a model image and a garment image. If either is missing, it should prompt the user to upload it and must not generate with a default model or default garment.
Pose and scene images are optional. If they are missing, text descriptions can replace them. The result should indicate which content came from user materials and which came from default strategies.
The following input structure is recommended:
Task type: E-commerce main image / Product detail page / Lookbook / Lifestyle seeding image / Batch shotsModel image: requiredGarment image: requiredPose image: optionalScene image: optionalAspect ratio: optionalNumber of outputs: optionalStyle requirements: optional
Stage 2: Visual information extraction
The Skill should first analyze the materials in a structured way. It should not simply combine all image descriptions into one long prompt.
The analysis results can be split into the following fields:
{"model": {"identity": "Person identity and facial features","appearance": "Hairstyle, skin tone, body shape, and apparent age","restrictions": ["Do not change facial features", "Do not add people"]},"garment": {"category": "Garment category","color": "Primary and secondary colors","cut": "Fit, length, and structure","material": "Fabric texture","details": "Buttons, zippers, prints, and other details"},"pose": {"body_direction": "Body orientation","gesture": "Arm and leg movement","composition": "Shot size and composition"},"scene": {"environment": "Scene type","lighting": "Light direction and color temperature","background": "Background layers"}}
This structure has two benefits. First, individual variables can be retried later. Second, quality checks can compare each item one by one, instead of making a vague judgment about whether the result “looks right.”
Stage 3: Visual planning and shot design
Different use cases need different shot strategies.
E-commerce main images should highlight the garment itself, using a clean background, stable composition, and a clear front view with no excessive decoration. Product detail pages can add side views, back views, close-ups of materials, and details. Lookbooks place more emphasis on mood, posing, and scene variation. Lifestyle seeding images can include more everyday settings, but the garment must remain clearly visible.
For batch tasks, a shot plan table is recommended first:
| Shot | Angle | Pose | Framing | Scene | Purpose |
|---|---|---|---|---|---|
| 01 | Front | Natural standing | Half body | Simple background | Show the overall fit |
| 02 | Three-quarter side | One hand lightly holding the hem | Full body | Indoor space | Show the silhouette and drape |
| 03 | Back | Natural standing | Full body | Neutral background | Show the back structure |
| 04 | Detail | Hand adjusting the collar | Close-up | Soft lighting | Show the fabric and craftsmanship |
After the plan is complete, each shot can reuse the same model and garment information. Only the pose, framing, or scene variable needs to change.
3. Positive and Negative Prompts
The Skill should automatically generate two types of prompts.
Positive prompt
The positive prompt should be organized in the order of subject, garment, pose, scene, photography, and quality:
Generate a commercial e-commerce garment display image.Keep the person's identity, facial features, hairstyle, skin tone, and body proportions from the model reference image.Have the model wear the target garment from the garment reference image accurately. Preserve the garment's color, fit, length, material, neckline, cuffs, placket, and decorative details.Reference the body orientation, limb movement, and composition from the pose image, but do not copy the people or clothing in it.Use the environment mood, background structure, and light direction from the scene reference image.The composition should be clear, the full garment should be visible, human proportions should look natural, hands and feet should be anatomically correct, and fabric wrinkles should follow realistic wearing logic.The overall style should suit commercial display, with a clean image, unified lighting, and clear details.
Negative prompt
The negative prompt reduces common errors:
Do not change the person's identity, do not swap faces, do not generate extra people,do not deform the garment, change the fabric, shift the color, alter the fit, or show clipping or floating garment parts,do not add extra fingers or limbs, broken hands or feet, twisted joints, or abnormal body proportions,do not use incorrect poses, incorrect angles, background people, or cluttered objects,do not add text, logos, watermarks, garbled characters, borders, or platform marks,do not show shadows that conflict with the light direction,do not over-smooth the skin, make it look like plastic, or produce low resolution, heavy noise, or local blur.
Prompts should not be stacked without limit. A better approach is to select the core constraints for each task type and insert the material analysis results dynamically.
4. Quality Check After Generation
After image generation, the Skill should not deliver the result directly to the user. It should run a structured check first.
At least the following eight items should be checked:
- Face consistency: Is the person still the target model, with no obvious changes to facial features?
- Garment accuracy: Are the color, fit, length, fabric, and details close to the product image?
- Wearing logic: Does the garment cover the body correctly, and do the neckline, cuffs, waistband, and other areas look natural?
- Limb naturalness: Are the fingers, toes, joints, and body proportions normal?
- Pose match: Does the image match the specified pose and composition?
- Scene consistency: Does the background match the scene requirements, with no unrelated people or objects?
- Lighting consistency: Are the shadow direction and color temperature of the person, garment, and environment coordinated?
- Commercial cleanliness: Are there any text, logos, watermarks, garbled characters, or flaws that affect the display?
Each check can return one of three statuses:
- Pass: The item meets the current delivery requirement.
- Manual review recommended: The result is basically usable, but there are detail risks.
- Fail: The item must go through a targeted retry.
5. Targeted Retries Instead of Starting Over
If only the sleeve cuff of the garment has a problem, the person and scene should not be changed. The retry mechanism must keep the variables that already passed and modify only the failed parts.
For example:
Passed:- Person identity- Scene lighting- Pose and compositionNeeds correction:- Structure of the left sleeve cuff- Garment hem lengthRetry requirements:Keep the person's identity, pose, scene, and lighting unchanged.Correct only the left sleeve cuff and the garment hem.Preserve the original garment color, fabric, and overall fit.
This variable-level retry approach reduces result drift. For batch tasks, the system can also record the reason for each retry, the changes made, and the final status, creating a traceable task record.
6. Recommended Skill File Structure
A general project directory can be organized as follows:
ai-fashion-tryon/├── SKILL.md├── references/│ ├── shot-plans.md│ └── api-reference.md├── templates/│ ├── prompt-template.md│ └── quality-check.json└── web/├── index.html├── style.css└── app.js
SKILL.md defines the role, input requirements, workflow, safety rules, and output format. shot-plans.md records shot templates for different business scenarios. api-reference.md can describe internal data structures and calling conventions, but it should not invent interface names or parameters that do not exist.
If the user only wants to generate images directly, the Skill should prioritize existing image generation capabilities. There is no need to create a separate backend service. Mock data, an API adapter layer, environment variable management, a backend proxy, and error handling are needed only when the user explicitly asks for a web application or integration with a third-party API.
7. Minimal HTML Page Design
The HTML page can provide the following functions:
- Upload a model image.
- Upload a garment image.
- Select a pose image and a scene image.
- Select a task type.
- Set the aspect ratio and number of outputs.
- Display the automatically generated prompts.
- Display generated results and quality check status.
- Regenerate specific failed items.
The browser should not hard-code all business logic. In a real project, local mock data can first verify the interaction flow. After that, the page can connect to a backend task service, depending on the deployment method. The backend handles file validation, task queuing, generation calls, result storage, and logging. The frontend only submits parameters and displays status.
8. Safety and Compliance Boundaries
An outfit swapping tool must define its scope of use clearly. It must not sexualize, expose, or exploit minors. It must not use outfit swapping to create misleading identity content. It must not process other people’s portraits without authorization. For commercial use of images of real people, image rights and the scope of use should be confirmed in advance.
The system also should not promise “100% accurate restoration.” Results are affected by reference image quality, occlusion, pose complexity, garment structure, and the capability of the generation model. A more accurate product description is that multiple reference constraints and quality checks help improve person consistency, garment accuracy, and commercial usability as much as possible.
After configuration, the directory can be validated to confirm that required files exist, that prompts contain no unfilled placeholders, and that the workflow is correctly blocked when key materials are missing. The project can then be packaged as:
ai-fashion-tryon.zip
In the end, the value of this approach is not only generating one outfit-swapped image. It unifies repeated communication, material management, prompt writing, quality judgment, and failure retries into a reusable production workflow. For individual creators, it reduces repeated debugging. For e-commerce teams, it establishes a shared standard. For developers, it provides a foundation that can be extended to batch tasks, asset management, and automated review.
