[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6HJMFNSFYPVGXP4QJYBZQCK":3,"skill-same:01M6HJMFNSFYPVGXP4QJYBZQCK":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":24,"linkOnly":25,"markdownContent":26,"markdownBody":27,"frontMatter":28,"refName":31,"commitSha":32,"skillDirectory":33,"forksCount":34,"repositoryHtmlUrl":35,"repositoryHomepageUrl":36,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":38,"updatedAt":39,"install":40,"resources":53},"01M6HJMFNSFYPVGXP4QJYBZQCK","spec-check",null,"Checks a module against its spec. Produces: a pass or fail table.","mrwogu\u002Fpromptscript","mrwogu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2917861?v=4","01M6CD988FG8NZ7SGMM9JG76Y7","Wojciech Guziak","01M6CD98C8MZJE9HW7P95CYB3S",344,"MIT","https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Fsrc\u002F__tests__\u002F__golden__\u002Fnative-frontmatter\u002F.factory\u002Fskills\u002Fspec-check\u002FSKILL.md",[],[19,20,21,22,23],"spec","check","spec check","table","module","2026-11-10 10:12:30",false,"---\n\ndescription: Generate the directory structure and client-extension.yaml for any Liferay client extension type. Use when the user asks to create a client extension, scaffold a custom element, add an object action microservice, create a site initializer, or build any other CET. After scaffolding, calls deploy-and-verify to confirm startup.\nname: scaffold-client-extension\n\n---\n\n# Scaffold Client Extension\n\nGenerate a ready to deploy client extension under `client-extensions\u002F\u003Cname>`. The CET type drives the file layout and the companion OAuth entry requirement.\n\n## When to Invoke\n\n- \"Create a client extension\", \"scaffold a custom element\", \"build a React widget\"\n- \"Add an object action microservice\"\n- \"Create a site initializer\"\n- \"I need a global CSS override\" or \"inject a JS library on every page\"\n\n## Workflow\n\n### Identify the CET Type\n\nIf the user did not specify a type, ask. Refer to `rules\u002Fclient-extension-types.md` for the full list of types grouped by classification:\n\n- **Frontend**: `customElement`, `globalCSS`, `globalJS`, `iframe`, `themeCSS`, `themeFavicon`, `themeSpritemap`, `staticContent`, `jsImportMapsEntry`, `editorConfigContributor`, `fdsCellRenderer`, `fdsFilter`, `commerceCheckoutStep`\n- **Microservice**: `objectAction`, `objectValidationRule`, `objectEntryManager`, `workflowAction`, `notificationType`, `captcha`, `commercePaymentIntegration`, `commerceShippingEngine`, `commerceTaxEngine`\n- **Configuration**: `oAuthApplicationHeadlessServer`, `oAuthApplicationUserAgent`, `instanceSettings`\n- **Batch**: `batch`, `siteInitializer`\n\n### Collect Inputs\n\n| Input | How to Obtain |\n| --- | --- |\n| Extension name | From user; convert to `kebab-case` for the directory |\n| Workspace ID | Read from the `id` field at the root of `client-extension.yaml` in the workspace root |\n| Microservice port | For microservice types; default `8081`, or next unused port |\n| OAuth scopes | Look up in `rules\u002Foauth-scopes.md` for the CET type |\n\n### Create the Directory\n\n```\nclient-extensions\u002F\u003Cextension-name>\u002F\n  client-extension.yaml\n```\n\nAdditional source files depend on type (see templates below).\n\n### Type Specific Templates\n\n#### `customElement` (React example)\n\n```yaml\n\u003Cworkspace-id>-\u003Cname>:\n  cssURLs:\n    - \"css\u002Fmain.css\"\n  friendlyURLMapping: \u003Cname>\n  htmlElementName: \u003Cname>-element\n  name: \u003CDisplay Name>\n  portletCategoryName: category.client-extensions\n  type: customElement\n  urls:\n    - \"js\u002Fmain.js\"\n  useESM: true\n```\n\nSource layout:\n\n```\nclient-extensions\u002F\u003Cname>\u002F\n  client-extension.yaml\n  package.json\n  src\u002F\n    index.jsx       # React entry, exports a web component\n  build.gradle      # optional; Blade transpiles via Liferay's frontend Gradle tooling\n```\n\nMinimal `src\u002Findex.jsx`:\n\n```jsx\nimport React from 'react';\nimport {createRoot} from 'react-dom\u002Fclient';\n\nclass MyElement extends HTMLElement {\n  connectedCallback() {\n    const root = createRoot(this);\n    root.render(\u003CApp \u002F>);\n  }\n}\ncustomElements.define('\u003Cname>-element', MyElement);\n\nfunction App() {\n  return \u003Cdiv className=\"\u003Cname>\">Hello from \u003CDisplay Name>\u003C\u002Fdiv>;\n}\n```\n\n#### `globalCSS`\n\n```yaml\n\u003Cworkspace-id>-global-css:\n  name: \u003CDisplay Name> Global CSS\n  type: globalCSS\n  url: \"css\u002Fmain.css\"\n```\n\n```\nclient-extensions\u002F\u003Cname>\u002F\n  client-extension.yaml\n  css\u002F\n    main.css\n```\n\n#### `globalJS`\n\n```yaml\n\u003Cworkspace-id>-global-js:\n  name: \u003CDisplay Name> Global JS\n  scriptElementAttributes:\n    async: true\n  type: globalJS\n  url: \"js\u002Fmain.js\"\n```\n\n#### `objectAction` (Spring Boot example)\n\n```yaml\n\u003Cworkspace-id>-oauth:\n    .serviceAddress: localhost:8081\n    .serviceScheme: http\n    name: \u003CWorkspaceId> OAuth\n    scopes:\n        - c_\u003Cname>.everything\n    type: oAuthApplicationUserAgent\n\n\u003Cworkspace-id>-\u003Cname>:\n    name: \u003CDisplay Name> Action\n    oAuth2ApplicationExternalReferenceCode: \u003Cworkspace-id>-oauth\n    resourcePath: \u002Fobject\u002Faction\u002F\u003Cname>\n    type: objectAction\n```\n\n```\nclient-extensions\u002F\u003Cname>\u002F\n  client-extension.yaml\n  src\u002Fmain\u002Fjava\u002F\u003Cpackage>\u002F\n    Application.java\n    ObjectActionRestController.java\n  src\u002Fmain\u002Fresources\u002F\n    application.properties\n```\n\n`ObjectActionRestController.java` minimal shape:\n\n```java\n@RestController\npublic class ObjectActionRestController {\n\n    @PostMapping(\"\u002F\")\n    public ResponseEntity\u003CString> post(@RequestBody Map\u003CString, Object> body) {\n\n        \u002F\u002F Body contains the object entry fields\n\n        return ResponseEntity.ok(\"{}\");\n    }\n\n}\n```\n\n`application.properties`:\n\n```properties\nserver.port=8081\nliferay.oauth.application.external.reference.code=\u003Cworkspace-id>-oauth\n```\n\n#### Every Microservice Project Needs a `Dockerfile` and `LCP.json`\n\nThe project templates above list only source files, but `createClientExtensionConfig` refuses a microservice project without both, even for a purely local deploy:\n\n```text\nRequired file \"Dockerfile\" not found in project \"\u003Cname>\"\nRequired file \"LCP.json\" not found in project \"\u003Cname>\"\n```\n\nCopy them from the matching sample on GitHub — [liferay-sample-etc-node](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions\u002Fliferay-sample-etc-node) or [liferay-sample-etc-spring-boot](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions\u002Fliferay-sample-etc-spring-boot) — and change the port in `LCP.json` to the one in `.serviceAddress`. Verified on 2026.Q1 with a Node project.\n\n#### Run a Microservice Locally\n\nDeploying registers the CET with Liferay; it does not start the service. The deploy writes the service's configuration into `bundles\u002Froutes\u002Fdefault\u002F\u003Cproject>` and the portal's into `bundles\u002Froutes\u002Fdefault\u002Fdxp`. Point the service's config loader at both, as the [samples](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions) do.\n\n**Start the service detached from the agent's session.** It has to keep running after the agent finishes or goes down — object actions keep firing at it, and anything that fires while it is down fails and is not retried. An agent's own background execution ties the process to the session, so it dies with it. Start it in a new session with `setsid nohup`, logging to the bundle's log directory (for Node, after `npm install` in the project):\n\n```bash\nWORKSPACE=$(pwd)\n\nsetsid \\\n\tnohup \\\n\tenv \\\n\tLIFERAY_ROUTES_CLIENT_EXTENSION=\"${WORKSPACE}\u002Fbundles\u002Froutes\u002Fdefault\u002F\u003Cproject>\" \\\n\tLIFERAY_ROUTES_DXP=\"${WORKSPACE}\u002Fbundles\u002Froutes\u002Fdefault\u002Fdxp\" \\\n\tnode \\\n\t\"${WORKSPACE}\u002Fclient-extensions\u002F\u003Cproject>\u002Fapp.js\" \\\n\t> \"${WORKSPACE}\u002Fbundles\u002Flogs\u002F\u003Cproject>.log\" 2>&1 \u003C \u002Fdev\u002Fnull &\n```\n\nRun it from the workspace root. Stop an earlier copy first — a second one fails to bind the port and exits, leaving the old code serving:\n\n```bash\nWORKSPACE=$(pwd)\n\npkill -f \"[n]ode ${WORKSPACE}\u002Fclient-extensions\u002F\u003Cproject>\u002Fapp.js\"\n```\n\nThe `[n]` keeps the pattern from matching the shell that runs the command. Without it, `pkill` also kills that shell, because its own command line contains the pattern.\n\nThen confirm both that it answers and that it no longer belongs to the agent. Run this from the workspace root too:\n\n```bash\nWORKSPACE=$(pwd)\n\ncurl \\\n\t--silent \\\n\t--url \"http:\u002F\u002Flocalhost:\u003Cport>\u002Fready\"\n\nps -o pid=,ppid=,sid=,args= -p \"$(pgrep -d , -f \"[n]ode ${WORKSPACE}\u002Fclient-extensions\u002F\u003Cproject>\u002Fapp.js\")\"\n```\n\n`READY` means it is up. `ps` prints one line per copy; more than one line means an earlier copy is still running. The process must be its own session leader — its `pid` equals its `sid` — and its parent must not be the agent's process. If either check fails, the service stops when the session does. It does not survive a reboot; restart it the same way after one.\n\n#### `siteInitializer`\n\n```yaml\n\u003Cworkspace-id>-site-init:\n  name: \u003CSite Name> Initializer\n  oAuthApplicationHeadlessServer: \u003Cworkspace-id>-site-oauth\n  siteExternalReferenceCode: \u003Csite-erc>\n  siteName: \u003CSite Name>\n  type: siteInitializer\n\n\u003Cworkspace-id>-site-oauth:\n  name: \u003CSite Name> OAuth\n  scopes:\n    - Liferay.Headless.Site.everything\n  type: oAuthApplicationHeadlessServer\n```\n\nPopulate `site-initializer` per `rules\u002Fsite-initializer-format.md`.\n\n`siteExternalReferenceCode` uniquely identifies the site so rerunning the initializer updates it rather than creating a duplicate. Derive it from the site name in kebab-case.\n\n#### `batch`\n\nCopy [liferay-sample-batch](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions\u002Fliferay-sample-batch) from GitHub into `client-extensions\u002F\u003Cname>`. Rename the top level keys and each `name` in `client-extension.yaml`, and replace the files in `batch\u002F` with your own.\n\n**Keep the sample's `assemble` block.** Without it, the `batch\u002F` directory is left out of the zip. The build succeeds, the bundle reaches `STARTED`, and nothing is imported. The signal is `assembleClientExtension NO-SOURCE` in the build output, or no `Started batch engine import task` line in the log after `STARTED`. Confirm the files made it in with `unzip -l dist\u002F\u003Cname>.zip`. Verified on 2026.Q1.\n\nFiles import in filename order, so number them so that dependencies come first. Each file is one envelope, in the shape of the sample's files. On a local bundle, the import runs inside the portal, and `Liferay.Headless.Batch.Engine.everything` alone was enough for `ObjectField` and `ObjectAction` items. Verified on 2026.Q1. Liferay Cloud was not tested.\n\nA batch project needs no `Dockerfile` or `LCP.json`; the build and import succeed without them, as in the sample. Only microservice projects require them. Verified on 2026.Q1.\n\n### Wire OAuth When Required\n\nIf `rules\u002Fclient-extension-types.md` shows \"Yes\" in the OAuth column, call `setup-oauth` to add the companion OAuth entry: `oAuthApplicationUserAgent` for a microservice CET, or `oAuthApplicationHeadlessServer` for a `batch` or `siteInitializer` CET (see `rules\u002Foauth-scopes.md`). The OAuth entry must appear in the same `client-extension.yaml` file.\n\n### Deploy and Verify\n\nCall `deploy-and-verify`. For microservice CETs, also start the microservice process on the declared port before the smoke check.\n\n### Troubleshoot\n\n| Symptom | Check |\n| --- | --- |\n| Bundle not STARTED | Read `bundles\u002Flogs\u002Fliferay.\u003Cdate>.log` for the error; run `diag \u003Cid>` in Gogo shell |\n| Custom element not in Fragments panel | `htmlElementName` must be a valid custom element name (contains a hyphen) |\n| 401 from microservice CET | OAuth companion not deployed or scopes insufficient |\n| Site initializer not in template list | CET not `ACTIVE`; redeploy and recheck log |\n\n## CSS Architecture for Custom Elements\n\nCSS rules in Custom Element CETs run alongside theme styles and other CETs. A few rules keep the cascade predictable:\n\n- **`global.css` is additive only.** Never redefine a class that already exists in the theme SCSS — the later stylesheet wins at equal specificity, producing silent cascade conflicts. Only add new classes.\n- **Each component's `style.css` must be selfcontained.** The `globalCSS` client extension is not injected on every site; never rely on it from inside a Custom Element. Every rule the component needs has to be present in its own stylesheet.\n- **Prefix scoped selectors with the custom element tag name.** E.g. `my-widget .btn { ... }`. This raises specificity above theme defaults regardless of stylesheet load order.\n- **Include all required properties on each scoped rule.** A scoped rule does not inherit sibling properties from a lower specificity theme rule — declare every property the component depends on.\n\n## Asset URLs\n\nAfter deploy, CET assets are served at `\u002Fo\u002F\u003CwebContextPath>\u002F\u003Cfilename>.\u003Chash>.\u003Cext>`. The exact URL — including the content hash — is regenerated on each build, so read the deployed `*.client-extension-config.json` (under `bundles\u002Fosgi\u002Fclient-extensions`) to resolve it at runtime. Never hardcode asset paths.\n\n## Runtime Patterns When Calling Liferay APIs From a Custom Element\n\n### Always Use `Liferay.Util.fetch`\n\nUse `Liferay.Util.fetch` for every API call inside a Custom Element — including GET requests:\n\n```javascript\nLiferay.Util.fetch(endpoint, options)\n```\n\nNative `fetch()` fails in two distinct ways:\n\n- For write calls (`POST`, `PUT`, `DELETE`), native `fetch()` omits the CSRF token and the request is rejected.\n- For GET calls on nonpublic Object APIs, native `fetch()` sends an anonymous request — Liferay responds `200 OK` with `items: []` rather than a 401, silently hiding every record the Guest role cannot see.\n\n`Liferay.Util.fetch` propagates the user's session context for both cases.\n\n### Resolve the Current User via `my-user-account`, Not `ThemeDisplay`\n\nNever use `Liferay.ThemeDisplay.getUserId()` in client side Custom Element code. It can return `0` or a stale ID when the page is partially cached.\n\nResolve the current user via the session fresh API instead:\n\n```text\nGET \u002Fo\u002Fheadless-admin-user\u002Fv1.0\u002Fmy-user-account\n```\n\nCall this through `Liferay.Util.fetch` so the CSRF token is attached automatically.\n\n### Never Use `roleBriefs` for Access Control\n\n`my-user-account.roleBriefs` is not invalidated immediately after a role is assigned via API — the permission cache may not reflect the new role until the session is refreshed or the cache expires.\n\nDo not gate Custom Element UI on `roleBriefs`. Use a functional data check against your own object model instead — to confirm a user has a role, check whether they have records that prove it (a direct report, an account membership, an assignment). This is authoritative, always current, and degrades gracefully if the data model changes.\n\n## Success Signal\n\nTODO \u002F inferred — verify against a running bundle. Confirm the deployed CET manifests for its type via `deploy-and-verify`'s Smoke Check on a live bundle.","# Scaffold Client Extension\n\nGenerate a ready to deploy client extension under `client-extensions\u002F\u003Cname>`. The CET type drives the file layout and the companion OAuth entry requirement.\n\n## When to Invoke\n\n- \"Create a client extension\", \"scaffold a custom element\", \"build a React widget\"\n- \"Add an object action microservice\"\n- \"Create a site initializer\"\n- \"I need a global CSS override\" or \"inject a JS library on every page\"\n\n## Workflow\n\n### Identify the CET Type\n\nIf the user did not specify a type, ask. Refer to `rules\u002Fclient-extension-types.md` for the full list of types grouped by classification:\n\n- **Frontend**: `customElement`, `globalCSS`, `globalJS`, `iframe`, `themeCSS`, `themeFavicon`, `themeSpritemap`, `staticContent`, `jsImportMapsEntry`, `editorConfigContributor`, `fdsCellRenderer`, `fdsFilter`, `commerceCheckoutStep`\n- **Microservice**: `objectAction`, `objectValidationRule`, `objectEntryManager`, `workflowAction`, `notificationType`, `captcha`, `commercePaymentIntegration`, `commerceShippingEngine`, `commerceTaxEngine`\n- **Configuration**: `oAuthApplicationHeadlessServer`, `oAuthApplicationUserAgent`, `instanceSettings`\n- **Batch**: `batch`, `siteInitializer`\n\n### Collect Inputs\n\n| Input | How to Obtain |\n| --- | --- |\n| Extension name | From user; convert to `kebab-case` for the directory |\n| Workspace ID | Read from the `id` field at the root of `client-extension.yaml` in the workspace root |\n| Microservice port | For microservice types; default `8081`, or next unused port |\n| OAuth scopes | Look up in `rules\u002Foauth-scopes.md` for the CET type |\n\n### Create the Directory\n\n```\nclient-extensions\u002F\u003Cextension-name>\u002F\n  client-extension.yaml\n```\n\nAdditional source files depend on type (see templates below).\n\n### Type Specific Templates\n\n#### `customElement` (React example)\n\n```yaml\n\u003Cworkspace-id>-\u003Cname>:\n  cssURLs:\n    - \"css\u002Fmain.css\"\n  friendlyURLMapping: \u003Cname>\n  htmlElementName: \u003Cname>-element\n  name: \u003CDisplay Name>\n  portletCategoryName: category.client-extensions\n  type: customElement\n  urls:\n    - \"js\u002Fmain.js\"\n  useESM: true\n```\n\nSource layout:\n\n```\nclient-extensions\u002F\u003Cname>\u002F\n  client-extension.yaml\n  package.json\n  src\u002F\n    index.jsx       # React entry, exports a web component\n  build.gradle      # optional; Blade transpiles via Liferay's frontend Gradle tooling\n```\n\nMinimal `src\u002Findex.jsx`:\n\n```jsx\nimport React from 'react';\nimport {createRoot} from 'react-dom\u002Fclient';\n\nclass MyElement extends HTMLElement {\n  connectedCallback() {\n    const root = createRoot(this);\n    root.render(\u003CApp \u002F>);\n  }\n}\ncustomElements.define('\u003Cname>-element', MyElement);\n\nfunction App() {\n  return \u003Cdiv className=\"\u003Cname>\">Hello from \u003CDisplay Name>\u003C\u002Fdiv>;\n}\n```\n\n#### `globalCSS`\n\n```yaml\n\u003Cworkspace-id>-global-css:\n  name: \u003CDisplay Name> Global CSS\n  type: globalCSS\n  url: \"css\u002Fmain.css\"\n```\n\n```\nclient-extensions\u002F\u003Cname>\u002F\n  client-extension.yaml\n  css\u002F\n    main.css\n```\n\n#### `globalJS`\n\n```yaml\n\u003Cworkspace-id>-global-js:\n  name: \u003CDisplay Name> Global JS\n  scriptElementAttributes:\n    async: true\n  type: globalJS\n  url: \"js\u002Fmain.js\"\n```\n\n#### `objectAction` (Spring Boot example)\n\n```yaml\n\u003Cworkspace-id>-oauth:\n    .serviceAddress: localhost:8081\n    .serviceScheme: http\n    name: \u003CWorkspaceId> OAuth\n    scopes:\n        - c_\u003Cname>.everything\n    type: oAuthApplicationUserAgent\n\n\u003Cworkspace-id>-\u003Cname>:\n    name: \u003CDisplay Name> Action\n    oAuth2ApplicationExternalReferenceCode: \u003Cworkspace-id>-oauth\n    resourcePath: \u002Fobject\u002Faction\u002F\u003Cname>\n    type: objectAction\n```\n\n```\nclient-extensions\u002F\u003Cname>\u002F\n  client-extension.yaml\n  src\u002Fmain\u002Fjava\u002F\u003Cpackage>\u002F\n    Application.java\n    ObjectActionRestController.java\n  src\u002Fmain\u002Fresources\u002F\n    application.properties\n```\n\n`ObjectActionRestController.java` minimal shape:\n\n```java\n@RestController\npublic class ObjectActionRestController {\n\n    @PostMapping(\"\u002F\")\n    public ResponseEntity\u003CString> post(@RequestBody Map\u003CString, Object> body) {\n\n        \u002F\u002F Body contains the object entry fields\n\n        return ResponseEntity.ok(\"{}\");\n    }\n\n}\n```\n\n`application.properties`:\n\n```properties\nserver.port=8081\nliferay.oauth.application.external.reference.code=\u003Cworkspace-id>-oauth\n```\n\n#### Every Microservice Project Needs a `Dockerfile` and `LCP.json`\n\nThe project templates above list only source files, but `createClientExtensionConfig` refuses a microservice project without both, even for a purely local deploy:\n\n```text\nRequired file \"Dockerfile\" not found in project \"\u003Cname>\"\nRequired file \"LCP.json\" not found in project \"\u003Cname>\"\n```\n\nCopy them from the matching sample on GitHub — [liferay-sample-etc-node](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions\u002Fliferay-sample-etc-node) or [liferay-sample-etc-spring-boot](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions\u002Fliferay-sample-etc-spring-boot) — and change the port in `LCP.json` to the one in `.serviceAddress`. Verified on 2026.Q1 with a Node project.\n\n#### Run a Microservice Locally\n\nDeploying registers the CET with Liferay; it does not start the service. The deploy writes the service's configuration into `bundles\u002Froutes\u002Fdefault\u002F\u003Cproject>` and the portal's into `bundles\u002Froutes\u002Fdefault\u002Fdxp`. Point the service's config loader at both, as the [samples](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions) do.\n\n**Start the service detached from the agent's session.** It has to keep running after the agent finishes or goes down — object actions keep firing at it, and anything that fires while it is down fails and is not retried. An agent's own background execution ties the process to the session, so it dies with it. Start it in a new session with `setsid nohup`, logging to the bundle's log directory (for Node, after `npm install` in the project):\n\n```bash\nWORKSPACE=$(pwd)\n\nsetsid \\\n\tnohup \\\n\tenv \\\n\tLIFERAY_ROUTES_CLIENT_EXTENSION=\"${WORKSPACE}\u002Fbundles\u002Froutes\u002Fdefault\u002F\u003Cproject>\" \\\n\tLIFERAY_ROUTES_DXP=\"${WORKSPACE}\u002Fbundles\u002Froutes\u002Fdefault\u002Fdxp\" \\\n\tnode \\\n\t\"${WORKSPACE}\u002Fclient-extensions\u002F\u003Cproject>\u002Fapp.js\" \\\n\t> \"${WORKSPACE}\u002Fbundles\u002Flogs\u002F\u003Cproject>.log\" 2>&1 \u003C \u002Fdev\u002Fnull &\n```\n\nRun it from the workspace root. Stop an earlier copy first — a second one fails to bind the port and exits, leaving the old code serving:\n\n```bash\nWORKSPACE=$(pwd)\n\npkill -f \"[n]ode ${WORKSPACE}\u002Fclient-extensions\u002F\u003Cproject>\u002Fapp.js\"\n```\n\nThe `[n]` keeps the pattern from matching the shell that runs the command. Without it, `pkill` also kills that shell, because its own command line contains the pattern.\n\nThen confirm both that it answers and that it no longer belongs to the agent. Run this from the workspace root too:\n\n```bash\nWORKSPACE=$(pwd)\n\ncurl \\\n\t--silent \\\n\t--url \"http:\u002F\u002Flocalhost:\u003Cport>\u002Fready\"\n\nps -o pid=,ppid=,sid=,args= -p \"$(pgrep -d , -f \"[n]ode ${WORKSPACE}\u002Fclient-extensions\u002F\u003Cproject>\u002Fapp.js\")\"\n```\n\n`READY` means it is up. `ps` prints one line per copy; more than one line means an earlier copy is still running. The process must be its own session leader — its `pid` equals its `sid` — and its parent must not be the agent's process. If either check fails, the service stops when the session does. It does not survive a reboot; restart it the same way after one.\n\n#### `siteInitializer`\n\n```yaml\n\u003Cworkspace-id>-site-init:\n  name: \u003CSite Name> Initializer\n  oAuthApplicationHeadlessServer: \u003Cworkspace-id>-site-oauth\n  siteExternalReferenceCode: \u003Csite-erc>\n  siteName: \u003CSite Name>\n  type: siteInitializer\n\n\u003Cworkspace-id>-site-oauth:\n  name: \u003CSite Name> OAuth\n  scopes:\n    - Liferay.Headless.Site.everything\n  type: oAuthApplicationHeadlessServer\n```\n\nPopulate `site-initializer` per `rules\u002Fsite-initializer-format.md`.\n\n`siteExternalReferenceCode` uniquely identifies the site so rerunning the initializer updates it rather than creating a duplicate. Derive it from the site name in kebab-case.\n\n#### `batch`\n\nCopy [liferay-sample-batch](https:\u002F\u002Fgithub.com\u002Fliferay\u002Fliferay-portal\u002Ftree\u002Fmaster\u002Fworkspaces\u002Fliferay-sample-workspace\u002Fclient-extensions\u002Fliferay-sample-batch) from GitHub into `client-extensions\u002F\u003Cname>`. Rename the top level keys and each `name` in `client-extension.yaml`, and replace the files in `batch\u002F` with your own.\n\n**Keep the sample's `assemble` block.** Without it, the `batch\u002F` directory is left out of the zip. The build succeeds, the bundle reaches `STARTED`, and nothing is imported. The signal is `assembleClientExtension NO-SOURCE` in the build output, or no `Started batch engine import task` line in the log after `STARTED`. Confirm the files made it in with `unzip -l dist\u002F\u003Cname>.zip`. Verified on 2026.Q1.\n\nFiles import in filename order, so number them so that dependencies come first. Each file is one envelope, in the shape of the sample's files. On a local bundle, the import runs inside the portal, and `Liferay.Headless.Batch.Engine.everything` alone was enough for `ObjectField` and `ObjectAction` items. Verified on 2026.Q1. Liferay Cloud was not tested.\n\nA batch project needs no `Dockerfile` or `LCP.json`; the build and import succeed without them, as in the sample. Only microservice projects require them. Verified on 2026.Q1.\n\n### Wire OAuth When Required\n\nIf `rules\u002Fclient-extension-types.md` shows \"Yes\" in the OAuth column, call `setup-oauth` to add the companion OAuth entry: `oAuthApplicationUserAgent` for a microservice CET, or `oAuthApplicationHeadlessServer` for a `batch` or `siteInitializer` CET (see `rules\u002Foauth-scopes.md`). The OAuth entry must appear in the same `client-extension.yaml` file.\n\n### Deploy and Verify\n\nCall `deploy-and-verify`. For microservice CETs, also start the microservice process on the declared port before the smoke check.\n\n### Troubleshoot\n\n| Symptom | Check |\n| --- | --- |\n| Bundle not STARTED | Read `bundles\u002Flogs\u002Fliferay.\u003Cdate>.log` for the error; run `diag \u003Cid>` in Gogo shell |\n| Custom element not in Fragments panel | `htmlElementName` must be a valid custom element name (contains a hyphen) |\n| 401 from microservice CET | OAuth companion not deployed or scopes insufficient |\n| Site initializer not in template list | CET not `ACTIVE`; redeploy and recheck log |\n\n## CSS Architecture for Custom Elements\n\nCSS rules in Custom Element CETs run alongside theme styles and other CETs. A few rules keep the cascade predictable:\n\n- **`global.css` is additive only.** Never redefine a class that already exists in the theme SCSS — the later stylesheet wins at equal specificity, producing silent cascade conflicts. Only add new classes.\n- **Each component's `style.css` must be selfcontained.** The `globalCSS` client extension is not injected on every site; never rely on it from inside a Custom Element. Every rule the component needs has to be present in its own stylesheet.\n- **Prefix scoped selectors with the custom element tag name.** E.g. `my-widget .btn { ... }`. This raises specificity above theme defaults regardless of stylesheet load order.\n- **Include all required properties on each scoped rule.** A scoped rule does not inherit sibling properties from a lower specificity theme rule — declare every property the component depends on.\n\n## Asset URLs\n\nAfter deploy, CET assets are served at `\u002Fo\u002F\u003CwebContextPath>\u002F\u003Cfilename>.\u003Chash>.\u003Cext>`. The exact URL — including the content hash — is regenerated on each build, so read the deployed `*.client-extension-config.json` (under `bundles\u002Fosgi\u002Fclient-extensions`) to resolve it at runtime. Never hardcode asset paths.\n\n## Runtime Patterns When Calling Liferay APIs From a Custom Element\n\n### Always Use `Liferay.Util.fetch`\n\nUse `Liferay.Util.fetch` for every API call inside a Custom Element — including GET requests:\n\n```javascript\nLiferay.Util.fetch(endpoint, options)\n```\n\nNative `fetch()` fails in two distinct ways:\n\n- For write calls (`POST`, `PUT`, `DELETE`), native `fetch()` omits the CSRF token and the request is rejected.\n- For GET calls on nonpublic Object APIs, native `fetch()` sends an anonymous request — Liferay responds `200 OK` with `items: []` rather than a 401, silently hiding every record the Guest role cannot see.\n\n`Liferay.Util.fetch` propagates the user's session context for both cases.\n\n### Resolve the Current User via `my-user-account`, Not `ThemeDisplay`\n\nNever use `Liferay.ThemeDisplay.getUserId()` in client side Custom Element code. It can return `0` or a stale ID when the page is partially cached.\n\nResolve the current user via the session fresh API instead:\n\n```text\nGET \u002Fo\u002Fheadless-admin-user\u002Fv1.0\u002Fmy-user-account\n```\n\nCall this through `Liferay.Util.fetch` so the CSRF token is attached automatically.\n\n### Never Use `roleBriefs` for Access Control\n\n`my-user-account.roleBriefs` is not invalidated immediately after a role is assigned via API — the permission cache may not reflect the new role until the session is refreshed or the cache expires.\n\nDo not gate Custom Element UI on `roleBriefs`. Use a functional data check against your own object model instead — to confirm a user has a role, check whether they have records that prove it (a direct report, an account membership, an assignment). This is authoritative, always current, and degrades gracefully if the data model changes.\n\n## Success Signal\n\nTODO \u002F inferred — verify against a running bundle. Confirm the deployed CET manifests for its type via `deploy-and-verify`'s Smoke Check on a live bundle.",{"name":29,"description":30},"scaffold-client-extension","Generate the directory structure and client-extension.yaml for any Liferay client extension type. Use when the user asks to create a client extension, scaffold a custom element, add an object action microservice, create a site initializer, or build any other CET. After scaffolding, calls deploy-and-verify to confirm startup.","master","02992542dbd5a9d65782cdc1d0c3151ddc3debb3","packages\u002Fcli\u002Fsrc\u002F__tests__\u002F__golden__\u002Fnative-frontmatter\u002F.factory\u002Fskills\u002Fspec-check",7,"https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript","https:\u002F\u002Fgetpromptscript.dev\u002F","https:\u002F\u002Fgithub.com\u002Fmrwogu","AI Developer Experience","2026-11-09 13:55:29",{"source":8,"skillName":29,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add mrwogu\u002Fpromptscript --skill scaffold-client-extension",{"tool":46,"command":47},"bunx","bunx skills add mrwogu\u002Fpromptscript --skill scaffold-client-extension",{"tool":49,"command":50},"pnpm","pnpm dlx skills add mrwogu\u002Fpromptscript --skill scaffold-client-extension","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fpackages\u002Fcli\u002Fsrc\u002F__tests__\u002F__golden__\u002Fnative-frontmatter\u002F.factory\u002Fskills\u002Fspec-check\u002FSKILL.md",true,[],[55,93,108,131,146,172],{"skillNo":56,"name":57,"nameZh":58,"description":59,"descriptionZh":60,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":73,"publishedAt":24},"01M6CDARG1R0SC1QS30MG6NH4Z","promptscript","PromptScript 脚本编写与排查","PromptScript language expert for reading, writing, modifying, and troubleshooting .prs files. Use when working with PromptScript syntax, creating or editing .prs files, adding blocks like @identity, @standards, @restrictions, @shortcuts, @skills, or @agents, configuring promptscript.yaml, resolving compilation errors, understanding inheritance (@inherit), composition (@use, @extend, @override), contextual @header metadata, or migrating AI instructions to PromptScript. Also use when asked about the 50 built-in coding agent compilation targets, including GitHub Copilot, Claude Code, Cursor, Antigravity, Factory AI, and AGENTS.md-based platforms, or about the bundle and prompt-text targets for application prompts.","PromptScript 语言专家，用于读取、编写、修改和排查 .prs 文件。适用于处理 PromptScript 语法、创建或编辑 .prs 文件、添加 @identity、@standards、@restrictions、@shortcuts、@skills 或 @agents 等块、配置 promptscript.yaml、解决编译错误、理解继承（@inherit）、组合（@use、@extend、@override）、上下文 @header 元数据，或将 AI 指令迁移到 PromptScript。当用户询问 50 个内置编码智能体编译目标（包括 GitHub Copilot、Claude Code、Cursor、Antigravity、Factory AI 以及基于 AGENTS.md 的平台），或询问用于应用提示词的 bundle 和 prompt-text 目标时，也适用此技能。","https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fskills\u002Fpromptscript\u002FSKILL.md",[63,68],{"categoryNo":64,"categoryName":65,"taxonomyType":66,"taxonomyTypeDesc":67},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师","PROFESSION","适用职业",{"categoryNo":69,"categoryName":70,"taxonomyType":71,"taxonomyTypeDesc":72},"01M8C7GF33QZZR2SXBJQHRAFNN","提示词工程与优化","SCENARIO","使用场景",[57,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92],"identity","Composition","files","writing","text","read","write","coding","standards","gemini","expert","kiro-cli","inheritance","windsurf","kilo","reading","factory-ai","goose","for",{"skillNo":94,"name":84,"nameZh":95,"description":96,"descriptionZh":97,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":104,"publishedAt":24},"01M6CDANHZWNCXCKZQSGVZW8S8","基础专家技能","Base expert skill","基础专家技能。","https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fpackages\u002Fresolver\u002Fsrc\u002F__tests__\u002F__fixtures__\u002Fskill-references\u002Fskills\u002Fexpert\u002FSKILL.md",[100,101],{"categoryNo":64,"categoryName":65,"taxonomyType":66,"taxonomyTypeDesc":67},{"categoryNo":102,"categoryName":103,"taxonomyType":71,"taxonomyTypeDesc":72},"01M8CFBYPPFQY4HRA5R71EZ0TS","AI系统核心与身份配置",[84,105,106,107],"spring","references","base",{"skillNo":109,"name":110,"nameZh":111,"description":112,"descriptionZh":113,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":122,"publishedAt":24},"01M6CDAK4J08AXZ8ZKX9VWP9NE","tdd-workflow","测试驱动开发工作流","Test-driven development workflow","测试驱动开发（TDD）工作流。","https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fpackages\u002Fresolver\u002Fsrc\u002F__tests__\u002F__fixtures__\u002Fregistry\u002Fnative-skills\u002Ftdd-workflow\u002FSKILL.md",[116,119],{"categoryNo":117,"categoryName":118,"taxonomyType":66,"taxonomyTypeDesc":67},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师",{"categoryNo":120,"categoryName":121,"taxonomyType":71,"taxonomyTypeDesc":72},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[123,124,125,126,127,128,129,130],"tdd workflow","tdd","workflow","test-driven","driven","development","development workflow","test",{"skillNo":132,"name":133,"nameZh":134,"description":135,"descriptionZh":134,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":144,"publishedAt":24},"01M6CDAGQMZ3SZP69Q1XREEX48","alpha","Alpha 技能","Alpha skill","https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fpackages\u002Fresolver\u002Fsrc\u002F__tests__\u002F__fixtures__\u002Fmd-imports\u002Fskill-dir\u002Falpha\u002FSKILL.md",[138,141],{"categoryNo":139,"categoryName":140,"taxonomyType":66,"taxonomyTypeDesc":67},"01M8BS5011KJDVSRXG1DC4P666","普通用户",{"categoryNo":142,"categoryName":143,"taxonomyType":71,"taxonomyTypeDesc":72},"01M8BSYDSNXQT2W2GMZGF0ZHH4","示例与演示技能",[133,145],"alpha skill",{"skillNo":147,"name":148,"nameZh":149,"description":150,"descriptionZh":151,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":152,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":159,"publishedAt":24},"01M6CDAEB3EZ86CQSYM28J34ZS","pdf-processing","PDF 文件处理","Extract PDF text, fill forms, merge files. Use when handling PDFs.","提取 PDF 文本、填写表单、合并文件。用于处理 PDF 时。","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fpackages\u002Fformatters\u002Fsrc\u002F__tests__\u002Ffixtures\u002Fplatform-contracts\u002Fgemini\u002Fskill.md",[155,158],{"categoryNo":156,"categoryName":157,"taxonomyType":71,"taxonomyTypeDesc":72},"01M8BQ6TK1MPB82068236GSXDE","文档处理",{"categoryNo":139,"categoryName":140,"taxonomyType":66,"taxonomyTypeDesc":67},[160,161,162,163,164,76,165,78,166,167,168,169,170,171],"processing","pdf processing","PDF","fill","example","use","merge","extract","when","extract pdf","forms","org",{"skillNo":173,"name":174,"nameZh":175,"description":176,"descriptionZh":177,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":184,"publishedAt":24},"01M6CDABP7FSQ9BY079P1QWJR2","react-component-patterns","React 组件编写规范","Conventions for writing React components in this codebase.","在此代码库中编写 React 组件的约定。","https:\u002F\u002Fgithub.com\u002Fmrwogu\u002Fpromptscript\u002Fblob\u002Fmain\u002Fpackages\u002Fformatters\u002Fsrc\u002F__tests__\u002Ffixtures\u002Fplatform-contracts\u002Fcursor\u002Fskill.md",[180,181],{"categoryNo":117,"categoryName":118,"taxonomyType":66,"taxonomyTypeDesc":67},{"categoryNo":182,"categoryName":183,"taxonomyType":71,"taxonomyTypeDesc":72},"01M8BRASNPVNJVQQJ4KZX8XM5D","前端开发与界面实现",[185,186,187,188,189,92,190,191,192,193,194,195,77,196],"react","patterns","component","react component","react component patterns","codebase","conventions","ui","packages","react components","components","tsx"]