by moskoo
`xxg-portrait-rebuild-light` is an image-edit skill for existing portrait photos. It reconstructs the key light, fill, shadows, and background atmosphere with a director-led lighting workflow while restoring clean, healthy, low-contrast photographic skin microtexture.
# Add to your Claude Code skills
git clone https://github.com/moskoo/xxg-portrait-rebuild-lightGuides for using ai agents skills like xxg-portrait-rebuild-light.
Last scanned: 8/18/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-08-18T04:34:30.917Z",
"npmAuditRan": true,
"pipAuditRan": false,
"promptInjectionRan": true
}xxg-portrait-rebuild-light is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by moskoo. `xxg-portrait-rebuild-light` is an image-edit skill for existing portrait photos. It reconstructs the key light, fill, shadows, and background atmosphere with a director-led lighting workflow while restoring clean, healthy, low-contrast photographic skin microtexture. It has 176 GitHub stars.
Yes. xxg-portrait-rebuild-light passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/moskoo/xxg-portrait-rebuild-light" and add it to your Claude Code skills directory (see the Installation section above). xxg-portrait-rebuild-light ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
xxg-portrait-rebuild-light is primarily written in Python. It is open-source under moskoo on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh xxg-portrait-rebuild-light against similar tools.
No comments yet. Be the first to share your thoughts!
⚠️ Third-Party Software Notice
This skill is third-party open-source software developed and hosted independently on GitHub. SkillsLLM is an informational directory and does not control or maintain the underlying repository.
Any security checks, ratings, or warnings displayed by SkillsLLM are automated and limited in scope. They do not constitute a security certification or guarantee that the software is safe, error-free, or free from malicious code, vulnerabilities, compromised dependencies, or prompt-injection risks.
Review the source code, permissions, dependencies, and configuration before installing or running any third-party skill. Use is at your own risk. To the maximum extent permitted by applicable law, SkillsLLM is not liable for losses arising from third-party software.
Treat the input as the same photograph, never as a reference for a replacement portrait. Improve illumination, exposure, color rendering, capture character, and skin response while retaining identity, facial geometry and natural asymmetry, expression, pose, camera view, framing, and subject scale. Preserve source optics unless the user explicitly requests an optical restyle.
Build realism from three separable signals:
Do not manufacture realism with dirt, darkness, coarse pores, uniform grain, random color patches, or exaggerated facial lines. The result must first read as a clean photograph at normal size.
texture-only: when the user asks only to remove plastic/AI skin or recover detail, force L0 + E0 + T0 + G0 + D0 + A0. Preserve the source lighting, highlight placement, exposure, white balance, focal plane, depth of field, and background.tone-and-exposure: when the user asks for brightness, highlight/shadow recovery, white balance, palette, or grading without new lighting, preserve the source light direction and edit only E/T/G.relight-and-skin: when the user requests a lighting change or selects L/T/A, authorize the requested light response while preserving source focal plane and depth of field unless explicitly changed.capture-style: when the user requests a camera, film, phone, CCD, or era look, edit G/D and only the exposure behavior logically required by that capture; preserve viewpoint, crop, focal plane, and depth of field.optical-restyle: only when the user explicitly requests a different focal-length perspective, camera angle, aperture behavior, or depth of field. State that axis once and permit only the minimum framing/background reconstruction it requires.Never let texture repair become relighting, tone correction become a new light source, or device emulation become a new pose/viewpoint.
ALL_TOOLS and prefer the exact discovered name image_gen__imagegen.const result = await tools.image_gen__imagegen({
referenced_image_paths: ["/absolute/path/source.png"],
prompt: "compact four-line English image-edit prompt"
});
generatedImage(result);
Never guess tools.image_gen or input_image. Correct wrong members, arguments, or TypeError from the registered signature and retry. In Claude, OpenClaw, or another host, use the equivalent native image-edit action explicitly exposed by that host.
| Observed state | Required action |
|---|---|
| Compatible image tool discovered | Invoke it. A small face, dense text, complex props, or edge contact lowers detail ambition but never blocks generation. |
| Correct image tool returns a real error | Report the actual error, enter prompt-only, and return a complete compact prompt. |
| Discovery completes with no compatible callable | Enter invocation-handoff and return a complete compact prompt. |
| Result is nearly unchanged, changes identity, creates artificial skin, or misses the light | State that the result did not achieve the requested improvement, enter prompt-handoff, and recompile from the source. |
Reading a skill, inspecting an image, creating a task, or announcing generation is not an image-tool invocation.
Do not use Pillow, NumPy, OpenCV, ImageMagick, FFmpeg, sips, or custom raster scripts to relight, grade, retouch, sharpen, add texture, resize, crop, extend, composite, repair, or produce the delivered image. Use them only for read-only aspect-ratio, mask, and result audits. See requirements.txt.
Read the V2.1 prompt compiler, the lighting and skin recipes, and the tone/exposure/style/device recipes. Decide internally as:
Scope → Key L → Exposure E → Fill/Shadow → Skin scale S → Skin finish P → Light color T → Look G → Capture D → Background/Atmosphere A
Select exactly:
one L + one E + one S + one P + one T + one G + one D + zero or one A
Use one key-light system. Atmosphere and skin reflections must inherit its direction, size, falloff, and color. E controls exposure, G controls palette/curve, and D controls capture response; none may invent another light. A6 is the sole override: force E6 silhouette exposure, remove all subject fill/catchlights/internal illumination, use L/T only for the rear source and background, and suppress S/P.
Send four core lines, adding RENDER only for a requested grade or device response:
EDIT: scope, identity/structure lock, and source-optics lock.
LIGHT: one L, one E, physical shadow/background response, T, and optional A.
RENDER: one G plus one D, only when either differs from source.
SKIN: one scale-aware S behavior plus one source-consistent P finish.
AVOID: only the two or three failures most likely for this source.
G0 + D0; add RENDER only for a requested grade/device. Target 55–110 English words, with an absolute ceiling of 135 for combined relight and capture-style edits.cinematic, editorial, HDR, film, DSLR, medium format, or smartphone into visible exposure, palette, tonal, microcontrast, sharpening, and dynamic-range behavior.E0 + G0 + D0. Never mix multiple device profiles or color looks. Never claim exact manufacturer color science.deep, near-black, or hard contrast only when the user explicitly selects backlight, hard light, low-key, neon, or silhouette behavior.Every handoff must use this structure with no placeholders.
Keep six source-defined groups stable: face outline/proportions; feature spacing, shape, and size; hairline, parting, and hair mass; source-identifying skin anchors; makeup/accessories; and apparent age/expression. Do not describe these groups in detail to the image model unless a real failure requires a shorter identity retry. Detailed identity checks belong in validation, not the generation prompt.
Under A6, internal features are intentionally hidden. Judge identity from hair/head/body outline, head-to-body ratio, pose, position, and framing.
fair, whiter, or beauty-grade language unless the user explicitly requests a complexion change.optical-restyle is explicit. If optics change, state the visible consequence rather than lens numbers alone.Retain orientation, aspect ratio, composition, focal plane, depth of field, and subject-to-frame scale. A backend may downscale uniformly; exact pixel dimensions are not required. If a local result exists, run the read-only check:
python3 "$XXG_SKILL_DIR/scripts/check_aspect_ratio.py" SOURCE_IMAGE EDITED_IMAGE
Accept relative aspect-ratio drift of ≤5%. Never resize, crop, pad, or extend locally to force a pass.
After generation, read the V2.1 identity and detail audit. At normal size first, verify:
If a result is nearly unchanged, strengthen one observable target. If skin becomes artificial, replace SKIN with clean continuous source skin tone; bounded source-shaped highlights; faint region-specific microdetail only where focus and light resolve it. Never present a failed image as final.
references/prompt-recipes.md and references/lighting-skin-color-temperature-recipes.mdreferences/tone-exposure-style-device-recipes.mdreferences/backend-and-clean-realism.mdreferences/identity-and-detail-audit.mdreferences/edit-plan-and-protection.mdxxg-portrait-rebuild-light is an image-edit skill for existing portraits. V2.1 separately controls physical light, exposure placement, color/style grade, capture-device response, broad skin tone, bounded reflection, and scale/focus-aware microdetail.
The skill changes the lighting without redrawing the person. It preserves identity, facial structure and proportions, natural slight asymmetry, expression, pose, camera view, and composition. It avoids plastic skin, grainy skin, dirty color variation, and fake depth made by exaggerating wrinkles.
texture-only fidelity recovery without changing source lighting, color, focus, depth of field, or scene content.P0–P6) for source-matched, satin-matte, soft-daylight, editorial, direct-flash, beauty, and available-light response.E0–E7 exposure recipes that explicitly place highlight headroom, facial midtones, directional shadows, and black point.G0–G8 color/style grades and D0–D8 capture profiles for full-frame digital, medium format, 35mm negative, CCD compact, point-and-shoot flash, smartphone, instant film, and disposable-camera response.

The skill first makes a director-style lighting decision internally:
Scope → Key L → Exposure E → Fill/Shadow → Skin S/P → Light color T → Look G → Capture D → Atmosphere A
The prompt sent to the image model uses four compact lines, adding RENDER only for a requested grade or device response. Target length is 55–110 English words:
EDIT: Choose the smallest authorized scope; retain source identity, geometry, pose, camera view, optics, framing, and every unauthorized axis.
LIGHT: One L and E with explicit highlight, midtone, shadow, black-point, background, T, and optional A behavior.
RENDER: One G palette/curve plus one D capture response. Omit for G0 + D0.
SKIN: One scale-aware S plus one light-consistent P finish.
AVOID: Only two or three source-specific failures.
The skill does not pile identity audits, object inventories, repeated negatives, and several photographic styles into one prompt. That often causes constraints to cancel each other or produces an unchanged copy.
For skin-only requests, V2.1 forces L0 + E0 + T0 + G0 + D0 + A0. Tone correction changes only E/T/G; capture-style changes only G/D and a logically required E. Relighting changes L/E/T/A. Viewpoint, perspective, crop, focal plane, and depth of field stay source-matched unless the user explicitly requests optical-restyle.
A6 forces E6 silhouette exposure, moves the effective light behind the person, removes all fill and catchlights, and renders the subject interior black. L/T and any G/D treatment affect only the rear source and background; S/P are suppressed.
Choose only:
one L light + one E exposure + one S skin scale + one P skin finish + one T light color + one G color/style grade + one D capture response + zero or one A atmosphere
| Code | Purpose |
|---|---|
L0 |
Match the source; repair only flat light, unexplained crushed shadows, abnormal highlights, and harsh transitions |
L1 |
Natural backlight, highlight-priority by default; add fill only when explicitly requested |
L2 |
Soft natural window light |
L3 |
Large commercial soft light |
L4 |
Outdoor skylight |
L5 |
Indoor practical and mixed lighting |
L6 |
Hard single-point light or direct sunlight |
L7 |
Low-key diagonal narrow light beam |
L8 |
Classic editorial Rembrandt lighting |
L9 |
Cinematic low-key warm key / cool ambient light |
L10 |
Golden-hour sunset side backlight |
L11 |
Cyberpunk cyan/magenta dual-tone neon |
L12 |
Clean, even commercial soft light |
| Code | Purpose |
|---|---|
E0 |
Preserve source highlights, midtones, shadows, and black point |
E1 |
Balanced natural exposure with clear midtones and directional shadows |
E2 |
Protect a bright source/rim and let unlit planes follow available bounce |
E3 |
Recover only blocked shadow information while controlling bright sources |
E4 |
High-key exposure with textured whites and gentle facial modeling |
E5 |
Low-key exposure with selected lit planes and a clean black point |
E6 |
Full silhouette exposure; use only with A6 |
E7 |
Direct-flash subject exposure with rapid ambient falloff |
| Code | Purpose |
|---|---|
S0 |
Small face or wide shot; restore only clean skin tone and natural reflection |
S1 |
Default for medium shots; low-contrast microtexture with original lip and eye-area detail |
S2 |
High-resolution close-up; region-aware pores, fine vellus hair, and existing details |
| Code | Purpose |
|---|---|
P0 |
Preserve the exact source diffuse/specular response; default for texture-only edits |
P1 |
Natural satin-matte balance with bounded key-facing highlights |
P2 |
Soft-daylight luminous midtones and broad highlight roll-off |
P3 |
Editorial satin response with controlled T-zone highlights |
P4 |
Direct-flash response with compact separated highlights |
P5 |
Clean beauty response without porcelain uniformity |
P6 |
Available-light response with source focus falloff and no added grain or marks |
| Code | Purpose |
|---|---|
T0 |
Preserve the source white balance |
T1 |
Neutral natural daylight |
T2 |
Golden warm light with healthy neutral zones retained in the skin |
T3 |
Warm key light with cool background ambience |
T4 |
Cyan/magenta neon relationship |
T5 |
Cool-neutral overcast or blue-hour light without a full-frame blue wash |
T6 |
Warm tungsten practicals with distance-based color falloff |
T7 |
Mixed daylight/practical balance with believable skin and neutral objects |
| Code | Purpose |
|---|---|
G0 |
Preserve the source palette and curve |
G1 |
Neutral editorial color with a restrained S-curve |
G2 |
Clean commercial color, accurate whites, bright midtones |
G3 |
Muted documentary environment with protected skin chroma |
G4 |
Warm lit skin with controlled cool background/shadow ambience |
G5 |
Pastel editorial midtones and compressed highlights |
G6 |
Tonal monochrome with separated skin, hair, clothing, and background |
G7 |
Restrained 1970s print response; grain remains opt-in |
G8 |
Clean 1990s/Y2K flash color and contrast |
| Code | Purpose |
|---|---|
D0 |
Preserve source capture response |
D1 |
Modern full-frame digital: clean detail and smooth highlight roll-off |
D2 |
Medium-format digital: smooth tonal steps and restrained sharpening |
D3 |
35mm color negative: gentle highlight compression and softer microcontrast |
D4 |
Compact CCD/digicam: direct crisp tone with modest highlight headroom |
D5 |
Point-and-shoot direct flash; pair with L6 + E7 |
D6 |
Smartphone computational: broad range without HDR halos or crunchy edges |
D7 |
Instant-film tone; border and grain remain opt-in |
D8 |
Disposable-camera response; exposure defects and grain remain opt-in |
| Code | Purpose | | ---