Extract, catalog, and propagate reference assets (screenshots, designs) throughout the webgen workflow
/plugin marketplace add gaurangrshah/gsc-plugins/plugin install appgen@gsc-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Purpose: Detect, extract, catalog, and propagate reference assets (screenshots, UI mockups, design files) provided by users throughout the entire webgen workflow, ensuring all implementation agents have access to visual references.
Before: Users provide screenshots or design references in the initial prompt, but these assets:
After: Assets are extracted, cataloged, and made available to every phase of the workflow.
.webgen/
├── assets/
│ ├── catalog.json # Asset manifest with metadata
│ ├── screenshots/ # UI reference screenshots
│ ├── designs/ # Design files (Figma, Sketch exports)
│ ├── references/ # Other reference materials
│ └── README.md # Asset usage instructions
{
"version": "1.0",
"created": "2024-12-13T10:00:00Z",
"updated": "2024-12-13T10:00:00Z",
"projectSlug": "example-project",
"assets": [
{
"id": "asset-1",
"type": "screenshot",
"originalName": "hero-reference.png",
"path": ".webgen/assets/screenshots/hero-reference.png",
"description": "Hero section layout with gradient background",
"source": "user-prompt",
"usedIn": ["architecture", "implementation"],
"tags": ["hero", "layout", "gradient"],
"metadata": {
"width": 1920,
"height": 1080,
"format": "png"
}
}
]
}
Field Definitions:
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (asset-1, asset-2, etc.) |
type | string | Asset type: screenshot, design, reference, mockup |
originalName | string | Original filename from user |
path | string | Relative path within project |
description | string | What the asset shows/represents |
source | string | Where it came from: user-prompt, research, generated |
usedIn | array | Which phases need this: requirements, architecture, implementation, etc. |
tags | array | Searchable tags: hero, navigation, footer, layout, color-scheme |
metadata | object | Additional info: dimensions, format, color palette |
When: User provides /webgen command with description
Action: Detect and extract assets from the prompt context
Detection Logic:
// Pseudo-code for asset detection
function detectAssets(prompt, attachments) {
const assets = [];
// Check for explicit asset references
if (prompt.includes("screenshot") || prompt.includes("reference image")) {
// Asset mentioned
}
// Check for file attachments (Claude Code provides these)
if (attachments && attachments.length > 0) {
attachments.forEach(file => {
if (isImageFile(file)) {
assets.push(createAssetEntry(file));
}
});
}
// Check shared screenshots location
const screenshotsDir = "~/workspace/screenshots/";
// Look for recently added files if user mentioned them
return assets;
}
Extraction Process:
~/workspace/screenshots/ if user mentioned screenshots.webgen/assets/{type}/When: Orchestrator dispatches @webgen for competitive research
Action: Make researcher aware of provided assets
Handoff Context:
## Reference Assets Provided
The following assets were provided for this project:
- **asset-1**: Hero section reference (path: .webgen/assets/screenshots/hero-reference.png)
- Use to understand desired layout and visual style
- Tags: hero, layout, gradient
Analyze these assets to inform your competitive research and recommendations.
When: Orchestrator dispatches @webgen for project scaffolding
Action: Include asset context in architecture decisions
Handoff Context:
## Architecture Context - Reference Assets
The following reference assets are available:
{{#each assets}}
- **{{id}}**: {{description}}
- Path: {{path}}
- Type: {{type}}
- Relevant for: {{usedIn}}
{{/each}}
**Architecture Guidance:**
- Review reference assets to inform component structure
- Identify components needed based on visual references
- Consider layout patterns shown in screenshots
When: Orchestrator dispatches @webgen for code generation
Action: Provide direct asset references to implementation agents
Handoff Context:
## Implementation Assets - CRITICAL
You have access to the following reference assets. **Read and analyze these BEFORE implementing:**
{{#each assets where usedIn includes "implementation"}}
### {{id}}: {{description}}
- **Path:** {{path}}
- **Use for:** {{usedIn}}
- **Tags:** {{tags}}
**MANDATORY:** Use the Read tool to view this asset before implementing related components.
Read Command Example:
# Agent should execute:
Read(.webgen/assets/screenshots/hero-reference.png)
# This provides visual context for pixel-perfect implementation
When: Final documentation generation
Action: Document assets used in the project
Generated Section (docs/assets.md):
# Reference Assets
This project was generated using the following reference assets:
## Screenshots
- **hero-reference.png**: Hero section layout reference
- Source: User-provided
- Used for: Hero component design and layout
## Usage
All reference assets are stored in `.webgen/assets/` for future reference.
Purpose: Extract assets from user input and attachments
Returns: Array of asset objects
{
id: "asset-1",
type: "screenshot",
originalName: "ui-reference.png",
tempPath: "/tmp/asset-1.png", // Before copying to project
description: "Auto-detected from user prompt",
tags: []
}
Purpose: Initialize asset catalog in project
Actions:
.webgen/assets/ directory structurecatalog.json with metadataREADME.md with usage instructionsReturns: Path to catalog.json
Purpose: Load existing catalog for a project
Returns: Catalog object with assets array
Purpose: Add new asset to existing catalog (e.g., from research phase)
Updates: catalog.json with new entry and updated timestamp
Purpose: Filter assets relevant for specific phase
Returns: Subset of assets where usedIn includes phaseName
Extensions: .png, .jpg, .jpeg, .gif, .webp, .svg
Analysis:
Extensions: .fig (Figma export), .sketch (Sketch export), .xd (Adobe XD)
Note: These are typically exported as images or PDFs for webgen processing
Extensions: .pdf (brand guidelines, wireframes)
Processing: Extract relevant pages as images if needed
The @webgen-orchestrator must:
Phase 1 (Requirements): Invoke asset extraction
@webgen: Extract any reference assets from the user prompt.
Use the asset-management skill to create catalog.
Phase 2+ (All subsequent phases): Include asset context in dispatch
@webgen: Proceeding to [PHASE].
**Reference Assets Available:**
- Review catalog at .webgen/assets/catalog.json
- Read assets before implementing related components
Load catalog using asset-management skill for full context.
Handoff verification: Ensure catalog.json exists before proceeding to implementation
Each @webgen agent invocation must:
User: /webgen restaurant landing page. I want it to look like this:
[Attaches: hero-reference.png]
Description: Modern hero section with large food image and reservation button
@webgen (Requirements phase):
1. Detect attachment: hero-reference.png
2. Create .webgen/assets/screenshots/hero-reference.png
3. Generate catalog.json:
{
"assets": [{
"id": "asset-1",
"type": "screenshot",
"path": ".webgen/assets/screenshots/hero-reference.png",
"description": "Hero section reference - large food image with reservation button",
"usedIn": ["architecture", "implementation"],
"tags": ["hero", "food-image", "cta-button"]
}]
}
4. Report to orchestrator: "Asset catalog created with 1 screenshot"
@webgen (Architecture phase):
1. Load catalog.json
2. Read asset-1 to understand layout requirements
3. Identify components needed: Hero (with image background), CTAButton
4. Include in architecture report: "Hero component based on asset-1 reference"
@webgen (Implementation phase):
1. Load catalog.json
2. Read .webgen/assets/screenshots/hero-reference.png
3. Analyze:
- Image fills full viewport height
- Text overlays image with dark gradient
- CTA button prominent, centered
- Color scheme: warm tones (extracted from image)
4. Implement Hero component matching reference
5. Document: "Hero section implements layout from asset-1"
Behavior: Skip asset extraction, proceed normally Catalog: Create empty catalog.json for consistency
{
"version": "1.0",
"assets": []
}
Behavior: Prompt user to provide the asset
You mentioned a screenshot/reference but I don't see an attachment.
Please provide the file, or I can proceed without it using competitive research for design inspiration.
Behavior: Log error, continue without asset
⚠️ Warning: Could not read asset-1 (hero-reference.png).
Proceeding with competitive research for design guidance instead.
Threshold: > 10MB
Behavior: Store reference in catalog but don't inline in prompts
Asset-2 (design-mockup.pdf) is large (15MB).
Stored in catalog for manual reference, but not loaded automatically.
Asset management is successful when:
.webgen/assets/catalog.jsonTo integrate asset management into webgen:
skills/asset-management/skill.md (this file)agents/webgen.md - Add Phase 1 asset extractionagents/webgen-orchestrator.md - Add asset propagationcommands/webgen.md - Mention asset support in docsREADME.md - Add asset management to featuresdocs/ARCHITECTURE.md - Document asset flowVersion: 1.0 Created: 2024-12-13 Requires: webgen v1.4+
Use when working with Payload CMS projects (payload.config.ts, collections, fields, hooks, access control, Payload API). Use when debugging validation errors, security issues, relationship queries, transactions, or hook behavior.