with one click
phlix-server
phlix-server contains 10 collected skills from detain, with repository-level occupation coverage and site-owned skill detail pages.
Skills in this repository
Adds a data-access/repository class in src/ using Workerman\MySQL\Connection with parameterized $db->query('... WHERE id = ?', [$id]), the project's sprintf-based generateUuid() helper, and metadata_json hydration via json_decode. Use when the user says 'add repository', 'add table', 'CRUD', 'query the database', 'data access layer', or touches src/Auth/UserRepository.php, src/Media/Library/ItemRepository.php, or src/Session/SessionManager.php. Do NOT use for PDO, mysqli, raw mysqli_* calls, Eloquent/Doctrine ORMs, or migration file authoring (use migrations/NNN_*.sql directly for schema).
Creates HTTP controller classes in src/Server/Http/Controllers/ following the project's Request/Response pattern with chained (new Response())->status()->json() calls, constructor-injected services, and $params array from {id} route matches. Registers the route in src/Server/Http/Router.php (API) or src/Server/WebPortal/WebPortalRouter.php (web portal). Use when user says 'add endpoint', 'new route', 'new controller', 'create API endpoint', 'add HTTP handler', or adds files to src/Server/Http/Controllers/. Do NOT use for WebSocket events (use websocket-event skill), static page rendering with Smarty templates (use smarty-page skill), or DLNA/UPnP protocol handlers (different stack in src/Dlna/).
Writes a PHPUnit 10 unit test under `tests/Unit/{Module}/{Class}Test.php` extending `PHPUnit\Framework\TestCase`, following the exact patterns in `tests/Unit/Auth/JwtHandlerTest.php` and `tests/Unit/Media/Library/ItemRepositoryTest.php` — uses `$this->createMock(Connection::class)` for `Workerman\MySQL\Connection` with `->method('query')->willReturn([['col' => 'val']])` for reads and `->expects($this->once())->method('query')->with($this->stringContains('SQL'), $this->callback(fn))` for writes. Use when the user says 'write a test', 'add unit test', 'TDD this', 'test this class', or adds files under `tests/Unit/`. Covers PSR-4 namespacing (`Phlix\Tests\Unit\{Module}`), constructor-injection mocking, return-value stubs, expectation-based assertions, and running with `vendor/bin/phpunit --testsuite Unit`. Do NOT use for JS tests (project has no JS test runner), integration/E2E tests that need a real DB (no integration testsuite is configured), or non-`tests/Unit/` paths.
Adds a new Smarty template under `public/templates/{section}/*.tpl` (extending `layouts/main.tpl` via `{extends}`/`{block name="main"}`) and a matching `renderXxx(Request $request): Response` method in `src/Server/WebPortal/PageRenderer.php` that builds `new \Smarty()`, calls `setTemplateDir($this->templateDir)`, assigns data, fetches the template, and returns `(new Response())->html(...)`. Use when user says 'add page', 'new template', 'render view', 'add a Smarty view', or modifies anything under `public/templates/` or `PageRenderer.php`. Do NOT use for JSON API endpoints (those live in `WebPortalRouter` and return `(new Response())->json(...)` — use the http-controller / api-endpoint skill instead), and do NOT use for layout partials in `public/templates/partials/` (those are `{include}`-only fragments with no PageRenderer method).
Registers a new WebSocket event handler via MessageHandler->on('event_name', fn($conn, $payload) => ...) and adds the corresponding constant to src/Server/WebSocket/Events.php (WebSocketEvents::*). Uses $conn->sendMessage('type', [...]) for replies and $handler->broadcast() / sendToUser() / sendToSession() for fan-out. Use when user says 'add websocket event', 'real-time message', 'syncplay event', 'broadcast event', or touches src/Server/WebSocket/MessageHandler.php. Do NOT use for HTTP routes (use http-controller), DLNA SSDP events, or REST API endpoints.
Writes, debugs, and refactors JavaScript code using modern ES2023+ features, async/await patterns, ESM module systems, and Node.js APIs. Use when building vanilla JavaScript applications, implementing Promise-based async flows, optimising browser or Node.js performance, working with Web Workers or Fetch API, or reviewing .js/.mjs/.cjs files for correctness and best practices.
Plan and review MySQL/InnoDB schema, indexing, query tuning, transactions, and operations. Use when creating or modifying MySQL tables, indexes, or queries; diagnosing slow/locking behavior; planning migrations; or troubleshooting replication and connection issues. Load when using a MySQL database.
PHPUnit testing best practices and conventions guide. This skill should be used when writing, reviewing, or refactoring PHPUnit tests to ensure consistent, maintainable, and effective test suites. Triggers on tasks involving test creation, test refactoring, test configuration, code coverage, data providers, mocking, or PHPUnit XML configuration.
Use this skill when writing bash or zsh scripts, parsing arguments, handling errors, or automating CLI workflows. Triggers on bash scripting, shell scripts, argument parsing, process substitution, here documents, signal trapping, exit codes, and any task requiring portable shell script development.
Optimizes SQL queries, designs database schemas, and troubleshoots performance issues. Use when a user asks why their query is slow, needs help writing complex joins or aggregations, mentions database performance issues, or wants to design or migrate a schema. Invoke for complex queries, window functions, CTEs, indexing strategies, query plan analysis, covering index creation, recursive queries, EXPLAIN/ANALYZE interpretation, before/after query benchmarking, or migrating queries between database dialects (PostgreSQL, MySQL, SQL Server, Oracle).