.claude/skills/klytos-media-management/SKILL.md
Guide for working with the Klytos Media Management system — asset metadata, categories, usage tracking, admin UI, API endpoints, and MCP tools. Use when working with asset or media management, image categories, usage tracking, asset cleanup, media library admin UI, or asset organization.
npx skillsauth add joseconti/klytos klytos-media-managementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Klytos has an enhanced media management system that goes beyond simple file storage. It provides:
assets collection with ID, title, alt text, description, categories, and upload info.asset-categories collection) to organize media files.asset-usage collection records where each asset is used (pages, header, footer, theme settings).page.after_save, page.after_delete, and theme.after_save keep usage records up to date.| File | Purpose |
|------|---------|
| installer/core/asset-manager.php | AssetManager class — upload, delete, categories, usage tracking, sync, rebuild |
| installer/core/asset-usage-hooks.php | 3 hooks for automatic usage tracking |
| installer/admin/assets.php | Admin UI — grid/list views, filters, detail panel, category management, bulk cleanup |
| installer/admin/api/assets-management.php | REST API for asset CRUD, categories, sync, rebuild |
| installer/admin/api/media-upload.php | Gutenberg editor upload endpoint (returns asset_id) |
| installer/core/mcp/tools/asset-tools.php | 12 MCP tools for AI-driven asset management |
upload(filename, dataBase64, directory) — Uploads file, auto-registers metadata, returns result with asset_iduploadRaw(filename, data, directory) — Same but with raw binary datadelete(relativePath) — Deletes file + metadata + all usage recordscreateCategory(name, description, parent) — Create category (ID = slug)listCategories() — List all categoriesupdateCategory(categoryId, data) — Update name/description/parent/orderdeleteCategory(categoryId) — Delete category, unlink from assetssetAssetCategories(assetId, categoryIds) — Assign categories to assetgetAssetsByCategory(categoryId) — Get assets in a categorytrackUsage(assetId, contextType, contextId, contextLabel, field) — Record usageremoveUsage(assetId, contextType, contextId) — Remove usage recordgetUsage(assetId) — Get all places an asset is usedgetAssetsForContext(contextType, contextId) — Get assets used in a contextisAssetInUse(assetId) — Check if asset has any usagegetUnusedAssets() — Get all assets with no usage recordsdeleteUsageForAsset(assetId) — Remove all usage for an assetdeleteUsageForContext(contextType, contextId) — Remove all usage for a contextfindAssetByPath(relativePath) — Look up asset by file pathsyncExistingAssets() — Scan filesystem, register untracked filesrebuildUsageIndex() — Delete all usage records and rebuild from contentassets{
"id": "a1b2c3d4",
"filename": "hero.jpg",
"path": "assets/images/2026/04/hero.jpg",
"mime_type": "image/jpeg",
"size": 245760,
"size_human": "240 KB",
"alt_text": "",
"title": "Hero",
"description": "",
"categories": ["banners"],
"uploaded_by": "admin",
"uploaded_at": "2026-04-01T10:00:00+00:00",
"updated_at": "2026-04-01T10:00:00+00:00"
}
asset-categories{
"id": "banners",
"name": "Banners",
"slug": "banners",
"description": "Banner images",
"parent": null,
"order": 0,
"created_at": "2026-04-01T10:00:00+00:00"
}
asset-usage{
"id": "a1b2c3d4--page--about-us",
"asset_id": "a1b2c3d4",
"context_type": "page",
"context_id": "about-us",
"context_label": "About Us",
"field": "content_html",
"added_at": "2026-04-01T10:00:00+00:00"
}
Context types: page, post, header, footer, sidebar, widget, theme, plugin, favicon, og_image
klytos_upload_asset — Upload base64 fileklytos_list_assets — List files from filesystemklytos_delete_asset — Delete file by pathklytos_assets_list_filtered — List registered assets with filters (usage, category, type, search) and paginationklytos_assets_get_usage — Get all locations where an asset is usedklytos_assets_get_unused — Get assets not used anywhereklytos_assets_update_metadata — Update title, alt_text, description, categoriesklytos_asset_categories_list — List categories with asset countsklytos_asset_categories_create — Create a new categoryklytos_assets_sync — Sync filesystem with databaseklytos_assets_rebuild_usage — Rebuild usage index from contentklytos_assets_cleanup_unused — Delete all unused assets (requires confirm: true)File: installer/admin/api/assets-management.php
GET actions:
?action=list&filter=all|in_use|unused&category=slug&type=image&search=term&page=1&per_page=20?action=get&id=assetId — Get asset detail with usage?action=list_categories — List categories with countsPOST actions (require CSRF + JSON body):
action=update + id, title, alt_text, description, categoriesaction=delete + idaction=bulk_delete + ids[]action=syncaction=rebuild_usageaction=create_category + name, descriptionaction=update_category + id, name, description, parent, orderaction=delete_category + idThe media library at admin/assets.php provides:
admin.assets.before_toolbaradmin.assets.after_toolbaradmin.assets.detail_panel_extraadmin.assets.beforeadmin.assets.afteradmin/api/media-upload.php returns asset_id in the response so the editor can store data-asset-id attributes on <img> tags. This enables the page.after_save hook to identify assets by ID rather than just path.
development
Guide for working with dates, times, and timezones in Klytos CMS. Use when formatting dates, converting timezones, scheduling actions with timestamps, displaying local time, working with UTC storage, building timezone selectors, or using any klytos_date/klytos_gmdate/klytos_timezone functions.
tools
Guide for developing and extending the Klytos web terminal. Use when modifying terminal commands, adding terminal commands from plugins, fixing terminal bugs, extending the pseudo-terminal, working with TerminalExecutor class, registering custom permissions, adding custom category labels, or managing terminal UI and security.
development
--- name: klytos-site-builder description: Guide for building a complete website from scratch with Klytos CMS. Use when creating a new site, configuring a site after installation, setting up design/content/SEO/navigation, or when the user pastes the post-install prompt. Covers 9 phases: discovery, design reference, global config, theme, content structure, templates, content creation, additional features, and launch. --- # Klytos Site Builder ## Overview The Site Builder is a conversational AI
development
Use when creating or editing page content in Klytos CMS. Ensures every page has proper SEO structure, HTML semantics, meta tags, structured data, accessibility for maximum search engine visibility. Apply when writing page titles, descriptions, content, headings, images, internal links, JSON-LD schema, or following the SEO checklist before publishing pages.