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.
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 50 GitHub stars.
xxg-portrait-rebuild-light's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
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!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
把输入照片视为同一张摄影原片,对其做一次明确、克制的 image edit:
光源物理效果优先于“所有内容都清楚”。根据光位与曝光意图,允许受光面明亮、背光面深暗、局部高光自然溢出、暗部接近黑色或主体形成合理剪影;不得用统一补光把逆光、低调或硬光重新抹平成平均曝光。
取得源图后,先读取当前智能体原生图片生成 Skill 的规则,再从当前工具注册表发现真实 callable。默认使用宿主自己的 image edit 能力,不直接拼装 API、CLI、SDK 或模型端点。
在 functions.exec 中先检查 ALL_TOOLS:
const candidates = ALL_TOOLS.filter(({ name, description }) => {
const text = `${name} ${description || ""}`.toLowerCase();
return name === "image_gen__imagegen" ||
(text.includes("image") && (text.includes("generate") || text.includes("edit")));
});
const selected = candidates.find(({ name }) => name === "image_gen__imagegen");
发现 image_gen__imagegen 后,本地源图编辑只能使用:
const result = await tools.image_gen__imagegen({
referenced_image_paths: ["/absolute/path/to/source.png"],
prompt: "紧凑的四行 image edit 提示词"
});
generatedImage(result);
禁止调用未经发现确认的 tools.image_gen,禁止猜测 input_image。错误函数名、错误参数或 JavaScript TypeError 属于调度错误;重新发现并按真实签名调用,不能据此声称工具不可用。
Claude、OpenClaw 和其他智能体调用它们工具注册表中明确暴露的等价原生图片编辑动作。
prompt-only,直接给出紧凑完整提示词。invocation-handoff,直接给出紧凑完整提示词。prompt-handoff,从原图重组紧凑完整提示词。读取 Skill、查看图片、生成审计文件或输出“正在调用”都不等于已经调用图片工具。
不得使用 Pillow、NumPy、OpenCV、ImageMagick、FFmpeg、sips 或自写脚本为交付图片补光、调色、磨皮、锐化、加纹理、裁切、扩边、缩放、合成或修复。它们只可用于只读宽高比检查、蒙版验证和结果审计,不能冒充 image edit。
依赖记录在根目录 requirements.txt。运行只读脚本前,从当前 SKILL.md 解析绝对 Skill 根目录;不得假设当前工作目录。
生成提示之前先在内部决定七项,不把分析过程或候选方案全部塞入提示词:
Key:主光来自哪里,是柔光、硬光、侧光还是逆光;Exposure intent:选择平衡曝光、高光优先、阴影优先、低调、剪影或高调;Fill:决定无补光、环境反射或明确补光;不得默认补亮所有暗部;Shadow:决定阴影硬度、深度、过渡宽度以及是否允许接近黑色;Subject:光如何跨过额头、眼周、鼻梁、面颊、颈肩与衣物;Background:背景亮度、反射和色温如何响应同一光源;Atmosphere:最多选择一种窗影、树影、柔焦光斑、夕阳光晕、轻微体积光或 A6 主体全黑剪影。选择配方时读取 光影、皮肤、色温与氛围配方。每次只选:
一个 L 主光 + 一个 S 皮肤 + 一个 T 色温 + 零个或一个 A 氛围
不要同时堆叠柔窗光、伦勃朗光、硬光束、霓虹和夕阳。氛围效果必须服从主光,不可只贴在脸上。
A6 是强制覆盖项,不是普通叠加效果。只要配方包含 A6,立即把曝光意图设为 silhouette,把有效主光置于人物后方,取消正面/侧面 Fill、眼神光和人物内部受光;脸、皮肤、头发、衣物与身体内部统一压成干净全黑,仅由明亮背景或背后光源显出原人物的完整外轮廓与姿态。此时 A6 覆盖 L 中关于人物正面受光的描述,S 只保留为配方记录、不要求纹理可见,T 只控制背景与轮廓附近光色。
图片模型的实际提示词不是审计报告。读取 紧凑提示词编译器,严格压缩为四行:
编辑:同一人物与原构图,只重建光影和肤质。
光影:主光 + 曝光意图 + 补光/阴影策略 + 背景响应 + 可选单一氛围。
肤质:与面部尺度匹配的干净、低对比真实微纹理。
限制:4–6 个最高风险禁止项;目标变化必须可辨。
执行规则:
invocation-handoff、prompt-only 和 prompt-handoff 输出的提示词也遵守同一长度与四行结构;必须无占位符,但不展开成长篇清单。
保持人物身份、脸型轮廓、头脸比例、五官位置与大小、自然轻微不对称、表情、视线、发际线、姿势、相机视角、构图和原画幅。不要“完美对称化”、瘦脸、大眼、缩鼻、丰唇或重塑身体。
选择 A6 时,内部五官会按授权消失在黑色剪影中;改用头部与发型外轮廓、肩颈关系、身体比例、姿态和人物占画位置判断结构保持,不得借剪影重塑轮廓或姿势。
这些结构约束不等于原样复制。允许以下外观按目标光源发生明显变化:
正常观看时先看到干净、柔和、健康的皮肤;合理放大后才看到微纹理。
选择 A6 时,本节的肤质可见性要求暂停:所有可见皮肤必须与头发、衣物和身体一起落为均匀干净的黑色剪影,不显示肤色、毛孔、唇纹、眼周细节、妆面、眼神光或局部面光;这不算塑料皮或肤质失败。
面部高度建议:
<256 px:使用 S0,不新增毛孔、黑头、绒毛或细纹;光影仍按用户目标清楚重建;256–511 px:使用 S1,只做克制微纹理;≥512 px:可用 S2,保留分区微纹理,但禁止超清毛孔和颗粒锐化。细腻胶片颗粒只在用户明确要求杂志或电影胶片感时作为全画面极轻的统一成像特征;不能只加在皮肤上,也不能代替毛孔。
catchlight in eyes:只在需要时添加一处与主光方向一致的眼神光;已有眼神光时优先保持,禁止双重眼神光。subtle fill light:只在曝光意图需要暗部可读时使用;剪影、低调或高光优先曝光可完全不用补光。ambient occlusion:只用于极轻的接触阴影和空间贴合,不能充当补光,也不能加深眼下或法令纹。A6 主体全黑剪影:优先级高于 L 的人物受光、Fill、catchlight 与 S 的肤质可见性;人物内部不得残留脸部、肤色、发丝、衣纹或饰品明暗细节,只允许极窄同源轮廓溢光且不能进入人物内部。要求保持输入构图、方向、宽高比和人物占画比例,不要求输出像素尺寸与原图一致。允许图片后端因最大分辨率限制等比例缩小,也允许边长取整造成轻微比例偏差。
有本地结果文件时只运行:
python3 "$XXG_SKILL_DIR/scripts/check_aspect_ratio.py" SOURCE_IMAGE EDITED_IMAGE
默认相对宽高比偏差不超过 5% 即通过。不要比较或强制恢复原始 W × H,不要因为输出分辨率较小判失败,也不要用本地脚本放大、缩放、裁切或补边。只有明显拉伸、改变方向、裁切/扩图导致比例超差,或人物占画位置发生明显变化时才进入 prompt-handoff。
按正常观看倍率先检查:
结果近乎原图时,不再增加一串同义限制;改为加强唯一主光句和一个可观察目标。结果脏化时,删除颗粒、强对比、深邃皱褶等词,并替换为“干净连续肤色 + 低对比反射微纹理”。
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.
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.

The skill first makes a director-style lighting decision internally:
Key light → Exposure intent → Fill → Shadow → Subject → Background → Atmosphere
The prompt sent to the image model is compressed into four lines, usually 80–160 English words:
Edit: keep the same person and composition; rebuild only lighting and skin rendering.
Lighting: one key light + exposure intent + fill/shadow relation + background response + optional single atmosphere effect.
Skin: clean, low-contrast photographic microtexture appropriate to the visible face scale.
Constraints: no identity change, beauty reshaping, smoothing, grain overlay, dirty color variation, or background redraw.
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.
Physical lighting takes priority over keeping every detail visible. The skill selects an exposure intent from source-matched, balanced, highlight-priority, shadow-priority, low-key, silhouette, and high-key. Sunset backlight may naturally darken the unlit side of the face or create a partial silhouette. Low-key and hard lighting may contain near-black shadows. Fill is used only when information that should remain readable is lost without a plausible cause.
A6 is a forced override: whenever selected, it switches to silhouette exposure, moves the effective light behind the person, removes all fill and catchlights, and renders the entire subject interior black. The selected L and T recipes control only the backlight and background response; the S recipe is not rendered visibly.
Choose only:
one L lighting recipe + one S skin recipe + one T color-temperature recipe + zero or one A atmosphere recipe
| 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 |
|---|---|
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 |
|---|---|
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 |
| Code | Purpose |
|---|---|
A0 |
Add no atmosphere effect |
A1 |
Soft window shadow |
A2 |
Sparse natural tree shadow |
A3 |
Soft bokeh restricted to the defocused background |
A4 |
Gentle lens flare aligned with the sunset direction |
A5 |
Very subtle volumetric light with sparse dust motes |
A6 |
Force the entire backlit subject to a clean black silhouette; no face, skin, hair, or clothing detail remains visible inside |
See Lighting, skin, color-temperature, and atmosphere recipes for detailed prompt clauses.
| Agent | Default route |
|---|---|
| Codex | Read the $imagegen rules, discover the actual tool in ALL_TOOLS, prefer tools.image_gen__imagegen, and pass source images through referenced_image_paths |
| Claude Code | Use the image-generation or image-editing capability installed or built into the current environment |
| OpenClaw | Use the imagegen skill or native image action enabled for the current agent |
| Other agents | Use an equivalent image-edit capability explicitly exposed by the tool registry |
In Codex, the skill never guesses tools.image_gen or input_image. It returns a prompt handoff only after tool discovery confirms that no compatible image capability exists. If the real image tool fails, produces an almost unchanged image, changes identity, or dirties the skin, the skill also returns a short copy-ready prompt.
SKILL.md skills.Install the read-only script dependencies:
python3 -m pip install -r ./xxg-portrait-rebuild-light/requirements.txt
Personal skill:
mkdir -p ~/.codex/skills
cp -R ./xxg-portrait-rebuild-light ~/.codex/skills/
Shared Agent Skills directory:
mkdir -p ~/.agents/skills
cp -R ./xxg-portrait-rebuild-light ~/.agents/skills/
For a project-level install, place it in .agents/skills/ at the project root. Invoke it explicitly with $xxg-portrait-rebuild-light.
Personal install:
mkdir -p ~/.claude/skills
cp -R ./xxg-portrait-rebuild-light ~/.claude/skills/
Project install:
mkdir -p .claude/skills
cp -R ./xxg-portrait-rebuild-light .claude/skills/
Invoke it with /xxg-portrait-rebuild-light.
Local install:
openclaw skills install ./xxg-portrait-rebuild-light \
--as xxg-portrait-rebuild-light
Shared install:
openclaw skills install ./xxg-portrait-rebuild-light \
--as xxg-portrait-rebuild-light \
--global
You can also copy the complete directory into the current agent workspace's skills/ directory or the shared ~/.openclaw/skills/ directory.
Copy the complete xxg-portrait-rebuild-light/ directory into the agent's personal or project skill root. Preserve the relative structure of SKILL.md, requirements.txt, references/, scripts/, and agents/, then reload the skill list.
Use $xxg-portrait-rebuild-light to edit this portrait with L8 + S2 + T1 + A0.
A large soft key from the upper front-side creates restrained Rembrandt lighting; subtle fill preserves the eye socket, one cheek falls into a deep soft shadow, and the eyes receive