[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ACNCV8AQ52TKEZK5MXFRVG":3,"skill-same:01M6ACNCV8AQ52TKEZK5MXFRVG":64},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":31,"linkOnly":32,"markdownContent":33,"markdownBody":33,"frontMatter":34,"refName":35,"commitSha":36,"skillDirectory":37,"forksCount":38,"repositoryHtmlUrl":39,"repositoryHomepageUrl":40,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":7,"updatedAt":43,"install":44,"resources":57},"01M6ACNCV8AQ52TKEZK5MXFRVG","manage-controller","控制器管理",null,"","apache\u002Fofbiz-plugins","apache","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47359?v=4","01M6AC83E6K4FDKK7HZ8WNMQKE","The Apache Software Foundation","01M6ACMJJ1Q4WYATY4GXZ2FAVD",178,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-controller\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8C36CP2J9CRK1B6PYRXVHPN","应用配置管理","SCENARIO","使用场景",[30],"manage controller","2026-11-10 10:12:30",false,"\u003C!--\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements.  See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership.  The ASF licenses this file\nto you under the Apache License, Version 2.0 (the\n\"License\"); you may not use this file except in compliance\nwith the License.  You may obtain a copy of the License at\n\nhttp:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied.  See the License for the\nspecific language governing permissions and limitations\nunder the License.\n-->\n\n---\nname: manage-controller\ndescription: Manage OFBiz Web Controller definitions. Use when defining requests, redirects, and view mappings.\n---\n\n# Skill: manage-controller\n## Goal\nDefine and maintain request mappings and view definitions within the OFBiz `controller.xml`.\n\n## Triggers\n**ALWAYS** read this skill when:\n- Modifying `WEB-INF\u002Fcontroller.xml`.\n- Registering a web application in `ofbiz-component.xml`.\n- Adding new UI pages (views) or form submission targets (requests).\n\n## Use when\n- Designing URL structures for the web application.\n- Mapping requests to Java\u002FGroovy events or OFBiz services.\n- Configuring security (HTTPS, Auth) for specific URLs.\n\n## Procedure\n1. **Security & Authentication**:\n    - Set `uri` to a unique identifier.\n    - Set `https=\"true\"` for sensitive data.\n    - Set `auth=\"true\"` to require user login.\n2. **Register**: Ensure the webapp is registered in `ofbiz-component.xml`:\n   ```xml\n   \u003Cwebapp name=\"myApp\" title=\"My App\" server=\"default-server\" location=\"webapp\u002FmyApp\" mount-point=\"\u002Fmyapp\"\u002F>\n   ```\n3. **Advanced Request Routing (Events before URIs)**:\n    - **`\u003Cpreprocessor>`**: Runs unconditionally on *every single request* to this webapp before the regular `\u003Crequest-map>` logic. Use for global checks, request logging, setting up tenant databases, or enforcing global security rules.\n    - **`\u003Cfirstvisit>`**: Runs only once per user session (on their very first request). Perfect for initializing analytics tracking, setting up an empty shopping cart, or calculating initial geographical settings based on IP.\n4. **Request Mapping**:\n    - Define `\u003Cevent type=\"...\" path=\"...\" invoke=\"...\"\u002F>` for processing logic.\n    - **Architectural Decision: Which Event Type to Use?**\n        - `type=\"service\"`: **Preferred for 90% of requests**. Use this when the request maps directly to a standard OFBiz service (which handles transactions, permissions, and IN\u002FOUT parameter mapping automatically).\n        - `type=\"service-multi\"`: Use to handle multi-form submissions natively. It extracts tabular POST data (like multiple input rows), loops over them in the framework, and calls a standard single-record service repeatedly. No custom Java\u002FGroovy iteration required.\n        - `type=\"groovy\"`: Use this for orchestrating multiple services, formatting\u002Fpre-processing HTTP Request parameters before calling a service, or writing custom endpoints (like streaming files or returning JSON).\n        - `type=\"java\"`: **Use sparingly for HTTP Controllers**. Only use this for core framework events (like login\u002Flogout, JWT validation, or low-level HTTP session manipulation). Standard business logic belongs in Services, not Java HTTP events.\n4. **Response Handling**:\n    - **`type=\"view\"`**: Use to render a UI page (Screen\u002FTemplate). This is the final step in a request lifecycle where the response HTML is sent back. Do not use this if you need to run another event first.\n    - **`type=\"request\"`**: Use for an internal server-side forward to another `\u003Crequest-map>`. **Crucial:** Request attributes (like error messages, form data, or queried entities) are kept and passed forward. The browser URL does *not* change.\n    - **`type=\"request-redirect\"`**: Use for an HTTP 302 Redirect to another `\u003Crequest-map>`. The browser URL *does* change. **Crucial:** All request attributes are lost because it's a completely new HTTP request. Form parameters are appended to the URL as query params. Use this after a successful database update (PRG pattern: Post\u002FRedirect\u002FGet) to prevent double-submissions on browser refresh.\n    - **`type=\"request-redirect-noparam\"`**: Like `request-redirect`, but explicitly strips all form parameters so they are not leaked in the resulting URL's query string. Essential for URLs containing sensitive data (e.g., passwords or tokens) after a form submission.\n    - **`name=\"error\"` Handling**: Always include a `\u003Cresponse name=\"error\" type=\"view\" value=\"...\"\u002F>` to return the user to the input page (with their submitted data intact) if the event fails or throws validation errors.\n5. **RESTful APIs, JSON, & AJAX**:\n    - To build API endpoints or handle AJAX requests, return pure JSON instead of an HTML view.\n    - Use `\u003Cresponse name=\"success\" type=\"request\" value=\"json\"\u002F>` (assuming a global `json` request exists in `common-controller.xml`) to serialize the `requestAttributes` into a JSON response.\n    - Alternatively, use `\u003Cresponse name=\"success\" type=\"none\"\u002F>`. Use this when the Groovy\u002FJava event explicitly writes to the `HttpServletResponse` output stream (e.g., when generating a custom JSON string or streaming a file download) so OFBiz does not attempt to render a view.\n6. **View Definitions**:\n    - Map the `value` in the response to a `\u003Cview-map>`.\n    - **`type=\"screen\"`**: **Preferred for UI**. Renders an OFBiz Screen Widget (`page` points to a `component:\u002F\u002F...\u002FScreens.xml#Name`).\n    - **`type=\"json\"`**: Used inherently for API responses when returning data (though often handled implicitly by `request` chaining to a global `json` handler rather than an explicit view).\n    - **`type=\"url\"`**: Direct redirect to an external URL or static asset. Set `page=\"https:\u002F\u002F...\"` or an absolute server path.\n\n## Guardrails\n- **Naming**: Request URIs should be camelCase (e.g., `updateExample`).\n- **Chaining**: Avoid deep request chains; prefer direct redirects (`type=\"request-redirect\"`).\n- **Redundancy**: Check for global-requests and global-responses in standard OFBiz controllers to avoid duplication.\n- **Event Anti-Pattern**: Do NOT use `type=\"java\"` events to write standard business logic that extracts parameters from the `HttpServletRequest`. That logic belongs in a `Service` (which automatically maps parameters) or a `Groovy` script (if HTTP orchestration is required).\n- **View Anti-Pattern**: Do NOT use `type=\"ftl\"` in view-maps for new code. Always route UI rendering through Screen Widgets (`type=\"screen\"`) to maintain consistent decorators, security, and context setup.\n- **Security Check**: Be careful with `https=\"true\"`. In modern OFBiz deployments behind an SSL-terminating proxy (like Nginx), setting this can cause infinite 302 redirect loops if `port.https.enabled` is not configured correctly in `url.properties`.\n- **CSRF Protection**: For form submissions (POST requests), always ensure the request map is protected or utilizes OFBiz's built-in token mechanisms to prevent Cross-Site Request Forgery.\n\n## Examples\n**Example: Standard Request with Service Event and View Mapping**\n```xml\n\u003Crequest-map uri=\"updateExample\">\n    \u003Csecurity https=\"true\" auth=\"true\"\u002F>\n    \u003Cevent type=\"service\" invoke=\"updateExample\"\u002F>\n    \u003Cresponse name=\"success\" type=\"view\" value=\"EditExample\"\u002F>\n    \u003Cresponse name=\"error\" type=\"view\" value=\"EditExample\"\u002F>\n\u003C\u002Frequest-map>\n\n\u003Cview-map name=\"EditExample\" type=\"screen\" page=\"component:\u002F\u002Fexample\u002Fwidget\u002Fexample\u002FExampleScreens.xml#EditExample\"\u002F>\n```\n\n### JSON\u002FAJAX API Endpoint (Standard OFBiz Way)\n```xml\n\u003C!-- This will invoke the service, and the 'json' request handler will serialize the result to the browser -->\n\u003Crequest-map uri=\"getExampleDetailsJson\">\n    \u003Csecurity https=\"false\" auth=\"true\"\u002F>\n    \u003Cevent type=\"service\" invoke=\"getExampleDetails\"\u002F>\n    \u003Cresponse name=\"success\" type=\"request\" value=\"json\"\u002F>\n    \u003Cresponse name=\"error\" type=\"request\" value=\"json\"\u002F>\n\u003C\u002Frequest-map>\n```\n\n### Advanced Routing: Preprocessors and Firstvisit\n```xml\n\u003C!-- This block is placed inside the \u003Csite-conf> tag, usually near the top -->\n\n\u003C!-- Runs on EVERY request to this webapp -->\n\u003Cpreprocessor>\n    \u003C!-- Example: Check for suspicious activity or validate tenant ID -->\n    \u003Cevent name=\"checkBlacklist\" type=\"java\" path=\"org.apache.ofbiz.security.SecurityEvents\" invoke=\"checkBlacklist\"\u002F>\n\u003C\u002Fpreprocessor>\n\n\u003C!-- Runs ONLY ONCE per user session -->\n\u003Cfirstvisit>\n    \u003C!-- Example: Initialize analytics tracking or an empty shopping cart -->\n    \u003Cevent name=\"initVisitor\" type=\"java\" path=\"org.apache.ofbiz.webapp.control.LoginWorker\" invoke=\"checkExternalLoginKey\"\u002F>\n\u003C\u002Ffirstvisit>\n```\n\n### Custom Response Writing (Streaming or Custom JSON)\n```xml\n\u003C!-- The Groovy event directly writes to response.getWriter() and returns \"success\", so we use type=\"none\" to stop further rendering -->\n\u003Crequest-map uri=\"downloadCustomData\">\n    \u003Csecurity https=\"true\" auth=\"true\"\u002F>\n    \u003Cevent type=\"groovy\" path=\"component:\u002F\u002Fexample\u002FgroovyScripts\u002FStreamCustomData.groovy\"\u002F>\n    \u003Cresponse name=\"success\" type=\"none\"\u002F>\n    \u003Cresponse name=\"error\" type=\"view\" value=\"main\"\u002F>\n\u003C\u002Frequest-map>\n```\n",{},"trunk","6c6c27710443de03e9247605d33a2e2f5bc3d1e2","ai-agent-skills\u002Fmanage-controller",222,"https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins","https:\u002F\u002Fofbiz.apache.org\u002F","https:\u002F\u002Fgithub.com\u002Fapache","https:\u002F\u002Fwww.apache.org\u002F","2026-11-12 22:04:06",{"source":9,"skillName":5,"commands":45,"prompt":55,"zipAvailable":56},[46,49,52],{"tool":47,"command":48},"npx","npx skills add apache\u002Fofbiz-plugins --skill manage-controller",{"tool":50,"command":51},"bunx","bunx skills add apache\u002Fofbiz-plugins --skill manage-controller",{"tool":53,"command":54},"pnpm","pnpm dlx skills add apache\u002Fofbiz-plugins --skill manage-controller","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-controller\u002FSKILL.md",true,[58],{"path":59,"resourceType":60,"resourceTypeDesc":61,"sizeBytes":62,"sourceHtmlUrl":63},"OWNERSHIP","OTHER","其他",37,"https:\u002F\u002Fgithub.com\u002FJetBrains\u002Fintellij-community\u002Fblob\u002Fmaster\u002F.claude\u002Fskills\u002Fplugin-model-analyzer\u002FOWNERSHIP",[65,77,89,103,117,131],{"skillNo":66,"name":67,"nameZh":68,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":69,"categories":70,"keywords":75,"publishedAt":31},"01M6ACQSN90YKJZ92MQ52D9R8H","prepush-readiness","推送前就绪检查","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fprepush-readiness\u002FSKILL.md",[71,72],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":73,"categoryName":74,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BR5V701HCN066VEP7H4812","代码仓库协作管理",[76],"prepush readiness",{"skillNo":78,"name":79,"nameZh":80,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":81,"categories":82,"keywords":87,"publishedAt":31},"01M6ACQPR1WRA751V4DXVC3AHF","manage-webapps","Web 应用管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-webapps\u002FSKILL.md",[83,84],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},{"categoryNo":85,"categoryName":86,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BWKS60NTYJHFE9FQSXGDKS","低代码应用开发",[88],"manage webapps",{"skillNo":90,"name":91,"nameZh":92,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":93,"categories":94,"keywords":101,"publishedAt":31},"01M6ACQMCX8Z7NY2CE08NCV6ND","manage-themes","主题管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-themes\u002FSKILL.md",[95,98],{"categoryNo":96,"categoryName":97,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQMKHSMFVQHR2KYAEVN","界面设计师",{"categoryNo":99,"categoryName":100,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BRASNPVNJVQQJ4KZX8XM5D","前端开发与界面实现",[102],"manage themes",{"skillNo":104,"name":105,"nameZh":106,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":107,"categories":108,"keywords":115,"publishedAt":31},"01M6ACQHYN20AFWF6TKK4RGQ8A","manage-tests","测试管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-tests\u002FSKILL.md",[109,112],{"categoryNo":110,"categoryName":111,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":113,"categoryName":114,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[116],"manage tests",{"skillNo":118,"name":119,"nameZh":120,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":121,"categories":122,"keywords":129,"publishedAt":31},"01M6ACQFRMW7R45YD3HRAXPGWF","manage-templates","模板管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-templates\u002FSKILL.md",[123,126],{"categoryNo":124,"categoryName":125,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BQ6TK1MPB82068236GSXDE","文档处理",{"categoryNo":127,"categoryName":128,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TPH3VQWKQZXV7EPF8VZ","办公行政人员",[130],"manage templates",{"skillNo":132,"name":133,"nameZh":134,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":7,"sourceHtmlUrl":135,"categories":136,"keywords":143,"publishedAt":31},"01M6ACQCSSDZQMD8VX2K3WRR93","manage-strategies","策略管理","https:\u002F\u002Fgithub.com\u002Fapache\u002Fofbiz-plugins\u002Fblob\u002Ftrunk\u002Fai-agent-skills\u002Fmanage-strategies\u002FSKILL.md",[137,140],{"categoryNo":138,"categoryName":139,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BTXF8K9DFQC4T4TXVH0NMZ","策略与托管设置管理",{"categoryNo":141,"categoryName":142,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8C6RQ852C9AEJFCBGG1YA7S","IT 管理员",[144],"manage strategies"]