Asset Embedding Reference
Shared reference for skills that embed user-provided images in markdown output.
Asset Resolution Protocol
For each user-provided image/folder path:
1. Check: is_jaan_path "$source"
(Tests if path is inside $JAAN_OUTPUTS_DIR, $JAAN_TEMPLATES_DIR, $JAAN_CONTEXT_DIR, or $JAAN_LEARN_DIR)
YES → Reference in-place. No copy.
resolved_path=$(resolve_asset_path "$source" "$OUTPUT_FILE")
Markdown: 
NO → Asset is external.
Ask user: "Copy these external assets into output folder? [y/n]"
If yes → copy_external_assets "$source" "$OUTPUT_FOLDER"
resolved_path=$(resolve_asset_path "$source" "$OUTPUT_FILE")
Markdown: 
asset-handler.sh Usage
Source the utility in the Write Phase, after output folder creation:
source "${CLAUDE_PLUGIN_ROOT}/scripts/lib/asset-handler.sh"
Functions:
| Function | Args | Returns |
|---|---|---|
is_jaan_path "$path" | Absolute path | Exit 0 if inside $JAAN_*, 1 if external |
resolve_asset_path "$source" "$output_file" | Source path, output .md file | Relative path for markdown link |
copy_external_assets "$source" "$output_folder" | Source path, output folder | Copies to $OUTPUT_FOLDER/assets/ |
url_encode_path "$path" | Path string | URL-encoded path (spaces → %20) |
Markdown Embedding Syntax
Use standard markdown image syntax with URL-encoded paths:
)
For paths with spaces or special characters, always URL-encode:
- Spaces →
%20 - Parentheses →
%28/%29
Quality Check Items
When a skill accepts image input, add these to its quality check step:
- All image references use
markdown syntax (not plain text file names) - Paths are URL-encoded (no raw spaces or special characters)
-
$JAAN_*assets reference existing location (no unnecessary copies) - External assets copied to
$OUTPUT_FOLDER/assets/only after user consent
Write Phase Pattern
Insert asset resolution after output folder creation and before writing the main file:
- For each user-provided image path, call
is_jaan_path - Group results:
$JAAN_*paths (reference in-place) vs external paths (need copy) - If external paths exist, ask user for copy consent
- If approved, call
copy_external_assetsfor each external path - Call
resolve_asset_pathfor all paths to get markdown-relative references - Use resolved paths in
when generating document content