.claude/skills/klytos-core-development/SKILL.md
Guide for developing and maintaining Klytos CMS core. Use when modifying core files, adding MCP tools, fixing bugs, extending the core architecture, changing the build engine, modifying the installer, implementing hooks, or working with storage backends. Covers foundational principles (AI-first, privacy by design, security by default), architecture, boot sequence, manager pattern, MCP tool registration, and security checklist.
npx skillsauth add joseconti/klytos klytos-core-developmentInstall 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.
installer/
├── index.php ← Front controller (routes all requests)
├── install.php ← Multi-step installer
├── t.php ← Analytics tracking pixel
├── config/ ← Encrypted config files (.htaccess blocks)
├── core/ ← PHP source (Klytos\Core namespace)
│ ├── app.php ← Application bootstrap (singleton)
│ ├── storage-interface.php ← Storage abstraction
│ ├── file-storage.php ← Flat-file storage implementation
│ ├── database-storage.php ← MySQL/MariaDB implementation
│ ├── hooks.php ← Action/filter hook engine
│ ├── helpers-global.php ← klytos_*() global functions
│ ├── plugin-loader.php ← Plugin discovery and loading
│ ├── page-manager.php ← Page CRUD
│ ├── theme-manager.php ← Theme configuration
│ ├── menu-manager.php ← Navigation menus
│ ├── site-config.php ← Global settings
│ ├── user-manager.php ← Multi-user with roles
│ ├── task-manager.php ← Review tasks/annotations
│ ├── version-manager.php ← Page version history
│ ├── block-manager.php ← Modular HTML blocks
│ ├── page-template-manager.php ← Page template recipes
│ ├── analytics-manager.php ← Privacy-first analytics
│ ├── webhook-manager.php ← Event notifications
│ ├── cron-manager.php ← Pseudo-cron scheduler
│ ├── audit-log.php ← Action audit trail
│ ├── auth.php ← Authentication (session, bearer, OAuth, app passwords)
│ ├── encryption.php ← AES-256-GCM encryption
│ ├── build-engine.php ← Static site generator
│ ├── helpers.php ← Utility functions
│ ├── i18n.php ← Internationalization
│ ├── license.php ← Plugin license verification
│ ├── updater.php ← OTA update system
│ ├── router.php ← Request routing
│ ├── lang/ ← Translation files (en.json, es.json)
│ └── mcp/ ← MCP server implementation
│ ├── server.php ← JSON-RPC 2.0 HTTP server
│ ├── tool-registry.php ← Tool registration and dispatch
│ ├── token-auth.php ← Multi-method auth (Bearer → OAuth → Basic)
│ ├── oauth-server.php ← OAuth 2.0/2.1 with PKCE
│ ├── rate-limiter.php ← Sliding window rate limiter
│ ├── json-rpc.php ← JSON-RPC 2.0 parser/builder
│ └── tools/ ← MCP tool definitions
├── admin/ ← Admin panel pages
│ ├── setup-wizard.php ← Post-install setup wizard (2FA, AI keys, MCP)
├── plugins/ ← Plugin directory
├── public/ ← Static site output
├── data/ ← Encrypted data storage
├── backups/ ← Backup archive storage
└── templates/ ← HTML templates
klytos.init action.klytos-installer/installer.php): Downloads CMS from GitHub releases.install.php): Simplified wizard — site name, username, password, dark/light preference, storage type. Sets setup_completed => false in config. Redirects to login after completion.bootstrap.php detects setup_completed === false and redirects to setup-wizard.php.admin/setup-wizard.php): 5-screen guided setup:
setup_completed => true. Existing/upgraded installs skip the wizard (key doesn't exist in config).core/mcp/tools/{feature}-tools.php.registerXxxTools(ToolRegistry $registry, App $app) function.$registry->register(name, description, schema, handler, annotations).core/{feature}-manager.php in the Klytos\Core namespace.StorageInterface in the constructor (NEVER Storage or FileStorage).const COLLECTION = '{name}' for the storage collection.{feature}.before_save, {feature}.after_save, etc.App::boot() as a property with a getter.All managers MUST use StorageInterface, never a concrete implementation:
// Collection + ID paradigm:
$this->storage->read('pages', 'about'); // Read
$this->storage->write('pages', 'about', $data); // Write (upsert)
$this->storage->delete('pages', 'about'); // Delete
$this->storage->exists('pages', 'about'); // Check existence
$this->storage->list('pages', ['status' => 'published']); // List with filters
$this->storage->count('pages', ['status' => 'draft']); // Count
$this->storage->search('pages', 'keyword', ['title']); // Search
$this->storage->transaction(function($storage) { ... }); // Transaction
A register_shutdown_function in admin/bootstrap.php catches PHP fatal errors after boot:
E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_USER_ERRORerror_log() as fallbackLogger::writeAlways() (bypasses Developer Mode)Logger::writeAlways() is the unconditional counterpart to Logger::write(). It skips Developer Mode and per-plugin checks. Use it only for fatal/critical errors that must always be recorded.
declare(strict_types=1).Klytos\Core (autoloaded via kebab-case filenames).Every page generated by the build engine MUST include:
<meta name="generator" content="Klytos {version}"><meta name="description" content="...">Every new translation key added to the core MUST exist in installer/core/lang/en.json.
The en.json file is the master reference. If a key is added to es.json without adding
it to en.json, the Translation Manager will not discover it.
Correct workflow:
en.json (English).es.json (and other languages if desired).__('namespace.key').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.