[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C2D9YH5RFV4F4EBVK674RV":3,"skill-same:01M6C2D9YH5RFV4F4EBVK674RV":53},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":26,"linkOnly":27,"markdownContent":28,"markdownBody":28,"frontMatter":29,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":35,"ownerHtmlUrl":36,"ownerBlogUrl":6,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M6C2D9YH5RFV4F4EBVK674RV","backend-router",null,"davidleonmayor\u002Fproyecto-grado-unimayor","davidleonmayor","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142275316?v=4","01M6C2D07NAZV2VQE96MD4HWYW","David León","01M6C2D0BN278C193FYXQB3TME",3,"MIT","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Fbackend-router\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",[23,24,25],"backend","router","backend router","2026-11-10 10:12:30",false,"# Backend Router (Express.js)\n\n## Overview\n\nThis skill defines the convention for declaring Express.js routers using an Object-Oriented approach.\n\n## Trigger\n\nWhen creating or updating route definitions for a backend feature.\n\n## Do's\n\n- **Use Classes**: Define routes inside a class (e.g., `FeatureRoutes`).\n- **Encapsulate Router**: Expose a `public router: Router` property initialized in the constructor with `Router()`.\n- **Instantiate Dependencies**: Initialize the respective `Controller` and any specific `Middleware` inside the constructor.\n- **`initRoutes()` Method**: Bind all routes in a dedicated `initRoutes()` method called from the constructor.\n- **Middleware Execution Order**: ALWAYS place `validateSchema` as the FIRST middleware in the route chain, BEFORE `isAuthenticatedUser`, `isConfirmed`, or any role checks. This ensures the payload and headers (like the authorization token) are structurally valid before running auth queries.\n- **Controller Binding**: Pass the controller method reference directly (e.g., `this.controller.methodName`). Ensure the controller constructor binds its methods (`this.methodName = this.methodName.bind(this)`).\n\n## Don'ts\n\n- **Don't use inline `.bind()` in the router**: Never do `this.controller.create.bind(this.controller)` inside the router definition. The router should look extremely clean (see Example Structure). Method binding MUST happen inside the Controller's constructor.\n- **Don't use functional routers**: Avoid top-level `const router = Router(); export default router;`. Stick to the Class structure.\n- **Don't define inline route handlers**: Do not put business or response logic directly in the `.post()` or `.get()` callback. Always delegate to the Controller.\n- **Don't mix schema logic in the router**: Validation schemas must be imported from the respective `*.schema.ts` file.\n\n## Example Structure\n\n- Always validate input data first with validateSchema() to prevent the passage of malformed or malicious data.\n- If necessary, then use the authentication and\u002For user role middleware; the authentication middleware should come first, followed by the user role.\n- Finally goes the controller to manage only the busines logic\n\n```typescript\nimport { Router } from \"express\";\nimport { FeatureController } from \".\u002Ffeature.controller\";\nimport { validateSchema } from \"..\u002Fcommon\u002Fmiddleware\u002FvalidateSchema\";\nimport { AuthMiddleware } from \"..\u002Fcommon\u002Fmiddleware\u002FAuthMiddleware\";\nimport { CreateFeatureSchema } from \".\u002Ffeature.schema\";\n\nexport class FeatureRoutes {\n  public router: Router;\n  private controller: FeatureController;\n  private authMiddleware: AuthMiddleware;\n\n  constructor() {\n    this.router = Router();\n    this.controller = new FeatureController();\n    this.authMiddleware = new AuthMiddleware();\n    this.initRoutes();\n  }\n\n  initRoutes() {\n    this.router.post(\n      \"\u002F\",\n      validateSchema(CreateFeatureSchema),\n      this.controller.create,\n    );\n\n    this.router.get(\n      \"\u002F\",\n      validateSchema(CreateFeatureSchema),\n      this.authMiddleware.isAuthenticatedUser,\n      this.authMiddleware.isConfirmed,\n      this.controller.getAll,\n    );\n  }\n}\n```\n\n## Don't do\n\n- don't\n\n```typescript\nimport { Router } from \"express\";\nimport { FeatureController } from \".\u002Ffeature.controller\";\nimport { validateSchema } from \"..\u002Fcommon\u002Fmiddleware\u002FvalidateSchema\";\nimport { AuthMiddleware } from \"..\u002Fcommon\u002Fmiddleware\u002FAuthMiddleware\";\nimport { CreateFeatureSchema } from \".\u002Ffeature.schema\";\n\nexport class FeatureRoutes {\n  public router: Router;\n  private controller: FeatureController;\n  private authMiddleware: AuthMiddleware;\n\n  constructor() {\n    this.router = Router();\n    this.controller = new FeatureController();\n    this.authMiddleware = new AuthMiddleware();\n    this.initRoutes();\n  }\n\n  \u002F\u002F don't use validateSchema before enyting, Alwais validale schema goes first\n  initRoutes() {\n    this.router.post(\n      \"\u002F\",\n      this.controller.create,\n      validateSchema(CreateFeatureSchema),\n    );\n\n    \u002F\u002F don't use, Allwais goes auth middlewares after validate schema\n    this.router.get(\n      \"\u002F\",\n      validateSchema(CreateFeatureSchema),\n      this.controller.getAll,\n      this.authMiddleware.isAuthenticatedUser,\n      this.authMiddleware.isConfirmed,\n    );\n  }\n}\n```\n",{},"main","3d76dc018cdded158c4f49df5edb56829229d265","skills\u002Fbackend-router",0,"https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor","https:\u002F\u002Fproyecto-grado-unimayor-8rtknmpjt-davidleonmayors-projects.vercel.app\u002Fadmin","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor","Full-stack developer focused on microservices backend","2026-11-11 00:05:51",{"source":7,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add davidleonmayor\u002Fproyecto-grado-unimayor --skill backend-router",{"tool":45,"command":46},"bunx","bunx skills add davidleonmayor\u002Fproyecto-grado-unimayor --skill backend-router",{"tool":48,"command":49},"pnpm","pnpm dlx skills add davidleonmayor\u002Fproyecto-grado-unimayor --skill backend-router","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Fbackend-router\u002FSKILL.md",true,[],[54,71,92,112,124,145],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":64,"publishedAt":26},"01M6C2DVB157H69PFWB1XXBVZS","skill-sync","Synchronizes skill metadata to AGENTS.md Auto-invoke sections. Trigger: When syncing skill metadata to AGENTS.md.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Fskill-sync\u002FSKILL.md",[61],{"categoryNo":62,"categoryName":63,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发",[65,66,67,68,69,70],"sync","skill sync","metadata","cloud","prowler","auto",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":78,"publishedAt":26},"01M6C2DRSV8QKEFA2J94YQKWK1","skill-creator","Creates new AI agent skills following the Agent Skills spec. Trigger: When user asks to create a new skill, add agent instructions, or document patterns for AI.","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Fskill-creator\u002FSKILL.md",[77],{"categoryNo":62,"categoryName":63,"taxonomyType":20,"taxonomyTypeDesc":21},[79,80,81,82,68,69,83,84,85,86,87,88,89,90,91],"skill creator","spec","ai agent","create","Bash","grep","read","write","edit","instructions","user","webfetch","add agent",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":102,"publishedAt":26},"01M6C2DP81DY28MKM0RKFWJQHX","skill-commit","Creates professional git commits following conventional-commits format. Trigger: When creating commits, after completing code changes, when user asks to commit.","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Fskill-commit\u002FSKILL.md",[98,101],{"categoryNo":99,"categoryName":100,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000009","前端开发",{"categoryNo":62,"categoryName":63,"taxonomyType":20,"taxonomyTypeDesc":21},[103,104,105,23,106,89,107,108,109,110,111],"commit","skill commit","landing","code","frontend","git commit","git","commits","format",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":26},"01M6C2DMHK8HST60TFQHMK8D94","project-info","General monorepo structure and component overview. Trigger: When AI needs project context or component locations.","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Fproject-info\u002FSKILL.md",[],[119,120,121,122,123],"project info","component","monorepo","context","overview",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":136,"publishedAt":26},"01M6C2DHT1Q0Q87WRYBCBH3QHG","frontend-context","Frontend architecture, patterns and conventions for the Next.js 15 app. Trigger: When working on frontend code, components, pages, or API integration.","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Ffrontend-context\u002FSKILL.md",[130,131],{"categoryNo":99,"categoryName":100,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":132,"categoryName":133,"taxonomyType":134,"taxonomyTypeDesc":135},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[107,122,137,138,139,140,106,141,142,143,144],"frontend context","api","components","architecture","frontend architecture","integration","Next.js","js",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":155,"publishedAt":26},"01M6C2DESFJR14Z3G38F4KZCSG","express-mocks-testing","Unit testing pattern for Express 5 controllers using node-mocks-http and @prisma\u002Fclient mocks. Trigger: When writing unit tests for backend controllers, testing Express routes, or avoiding Supertest\u002FServer instantiation.","https:\u002F\u002Fgithub.com\u002Fdavidleonmayor\u002Fproyecto-grado-unimayor\u002Fblob\u002Fmain\u002Fskills\u002Fexpress-mocks-testing\u002FSKILL.md",[151,154],{"categoryNo":152,"categoryName":153,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[156,157,158,159,160,161,162,163,23],"express mocks testing","testing","writing","unit tests","http","server","programming","node"]