Add to Claude Code
47 addsInstall this Claude Code skill.
Name: Photoshop Script Generator
Save to: ~/.claude/skills/photoshop-script-generator.md
---
---
name: Photoshop Script Generator
description: Generate a Photoshop automation script (UXP or ExtendScript)
---
Generate a Photoshop script to: $ARGUMENTS
## Instructions
1. Determine the target API:
- **UXP** (default, Photoshop 2022+): modern async JavaScript
- **ExtendScript** (legacy, Photoshop CS6+): JSX/ES3-like syntax
- Ask if unclear which version the user needs
2. Write the script following Adobe's API conventions
3. Include error handling for common failures (no document open, locked layers, etc.)
4. Add comments explaining each major step
## UXP script structure
```javascript
const { app, constants } = require("photoshop")
const { executeAsModal } = require("photoshop").core
async function main() {
const doc = app.activeDocument
if (!doc) {
console.error("No document open")
return
}
await executeAsModal(async () => {
// Your operations here
const layer = doc.activeLayers[0]
layer.opacity = 50
}, { commandName: "Script Name" })
}
main()
```
## ExtendScript structure
```javascript
#target photoshop
if (app.documents.length === 0) {
alert("No document open")
} else {
var doc = app.activeDocument;
// Your operations here
var layer = doc.activeLayer;
layer.opacity = 50;
}
```
## Common operations reference
| Operation | UXP | ExtendScript |
|-----------|-----|-------------|
| Get active doc | `app.activeDocument` | `app.activeDocument` |
| Create layer | `doc.createLayer()` | `doc.artLayers.add()` |
| Set blend mode | `layer.blendMode = constants.BlendMode.MULTIPLY` | `layer.blendMode = BlendMode.MULTIPLY` |
| Apply Gaussian blur | `await batchPlay([{_obj:"gaussianBlur", radius: 5}])` | `layer.applyGaussianBlur(5)` |
| Save as PNG | `doc.saveAs.png(filePath, options)` | `doc.saveAs(file, pngOpts, true)` |
## Constraints
- Always wrap UXP operations in `executeAsModal`
- ExtendScript uses `#target photoshop` directive at the top
- Test with a duplicate document first — scripts can't easily undo
Paste into Claude Code to add this skill.
How to add
Full guide →Click Add, then paste into Claude Code. Claude will save it to the right location for you.
Target: .claude/commands/<name>.md