[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M76VKTY390416E711VQMPWEC":3,"skill-same:01M76VKTY390416E711VQMPWEC":50},{"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":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M76VKTY390416E711VQMPWEC","matterjs",null,"2D physics engine for interactive UI, games, and dynamic visual effects. Covers Engine\u002FWorld setup, Render\u002FRunner config, bodies, constraints, mouse interaction, SPA cleanup, and offscreen pause. Trigger: When implementing 2D physics interactions, gravity simulations, draggable physics objects, or any Matter.js physics scene.","davidcoachdev\u002Fdcfiles","davidcoachdev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F69812733?v=4","01M758C4BR16TAV1N47W319E9V","David H. Caycedo Blum.","01M758C4CCZA2ZYGA0BGMXCDRH",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fmatterjs\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: matterjs\ndescription: >\n  2D physics engine for interactive UI, games, and dynamic visual effects.\n  Covers Engine\u002FWorld setup, Render\u002FRunner config, bodies, constraints,\n  mouse interaction, SPA cleanup, and offscreen pause.\n  Trigger: When implementing 2D physics interactions, gravity simulations,\n  draggable physics objects, or any Matter.js physics scene.\nlicense: Apache-2.0\nmetadata:\n  author: gentleman-programming (inspired by MengTo\u002FSkills)\n  version: \"1.0\"\n---\n\n## When to Use\n\n- Interactive 2D physics (falling, bouncing, colliding elements)\n- Draggable objects with physics behavior\n- Gravity-based UI elements or games\n- Physics sandbox, simulations, or data visualizations\n\n---\n\n## Core Setup\n\n### Minimal (quick start)\n\n```html\n\u003Cscript src=\"https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fmatter-js\u002F0.19.0\u002Fmatter.min.js\">\u003C\u002Fscript>\n\u003Cscript>\n  const { Engine, Render, Runner, Bodies, Composite } = Matter;\n\n  const engine = Engine.create();\n\n  const render = Render.create({\n    element: document.body,\n    engine: engine,\n    options: { width: 800, height: 600, wireframes: false },\n  });\n\n  const runner = Runner.create();\n  Runner.run(runner, engine);\n  Render.run(render);\n\n  \u002F\u002F Static ground\n  const ground = Bodies.rectangle(400, 610, 810, 60, { isStatic: true });\n  \u002F\u002F Dynamic box\n  const box = Bodies.rectangle(400, 200, 80, 80);\n\n  Composite.add(engine.world, [ground, box]);\n\u003C\u002Fscript>\n```\n\n### ES Module (npm)\n\n```bash\nnpm i matter-js\n```\n\n```js\nimport Matter from \"matter-js\";\nconst { Engine, Render, Runner, Bodies, Composite } = Matter;\n```\n\n---\n\n## Common Patterns\n\n### Bodies\n\n```js\n\u002F\u002F Rectangle (static: platform, dynamic: falling)\nconst platform = Bodies.rectangle(x, y, width, height, { isStatic: true });\nconst box = Bodies.rectangle(x, y, width, height);\n\n\u002F\u002F Circle\nconst ball = Bodies.circle(x, y, radius);\n\n\u002F\u002F Polygon (sides = 3 for triangle, 6 for hexagon, etc.)\nconst hex = Bodies.polygon(x, y, 6, radius);\n\n\u002F\u002F Compound body (multiple parts as one physics object)\nconst compound = Body.create({\n  parts: [\n    Bodies.rectangle(0, 0, 100, 20),\n    Bodies.rectangle(0, -20, 20, 40),\n  ],\n});\n```\n\n### Adding to World\n\n```js\n\u002F\u002F Single\nComposite.add(engine.world, body);\n\n\u002F\u002F Multiple\nComposite.add(engine.world, [bodyA, bodyB, bodyC]);\n```\n\n---\n\n## Mouse Interaction\n\n```js\nconst { Mouse, MouseConstraint } = Matter;\n\nconst mouse = Mouse.create(render.canvas);\nconst mouseConstraint = MouseConstraint.create(engine, {\n  mouse,\n  constraint: {\n    stiffness: 0.2,\n    render: { visible: false },\n  },\n});\n\nComposite.add(engine.world, mouseConstraint);\nrender.mouse = mouse;\n```\n\n### Mouse Constraint Options\n\n```js\n{\n  mouse: mouse,\n  constraint: {\n    stiffness: 0.2,       \u002F\u002F lower = more elastic\n    damping: 0.1,         \u002F\u002F resistance to motion\n    render: { visible: false },\n    \u002F\u002F angularStiffness: 0.1, \u002F\u002F for rotation\n  },\n}\n```\n\n---\n\n## Constraints & Joints\n\n```js\nconst { Constraint } = Matter;\n\n\u002F\u002F Pin body to a point in space\nconst constraint = Constraint.create({\n  pointA: { x: 400, y: 100 },\n  bodyB: box,\n  pointB: { x: 0, y: 0 },\n  stiffness: 0.9,\n  length: 0,\n});\nComposite.add(engine.world, constraint);\n\n\u002F\u002F Connect two bodies\nconst rope = Constraint.create({\n  bodyA: body1,\n  bodyB: body2,\n  stiffness: 0.8,\n  length: 100,\n});\n```\n\n---\n\n## Collision Events\n\n```js\nconst { Events } = Matter;\n\nEvents.on(engine, \"collisionStart\", (event) => {\n  event.pairs.forEach((pair) => {\n    console.log(\"Collision:\", pair.bodyA.label, pair.bodyB.label);\n  });\n});\n\nEvents.on(engine, \"collisionEnd\", (event) => { \u002F* ... *\u002F });\n```\n\n---\n\n## Render Options\n\n```js\nRender.create({\n  element: container,\n  engine,\n  options: {\n    width: 800,\n    height: 600,\n    wireframes: false,        \u002F\u002F true = debug outlines\n    background: \"#0f0f0f\",\n    \u002F\u002F showAngleIndicator: true,\n    \u002F\u002F showVelocity: true,\n    \u002F\u002F showCollisions: true,\n  },\n});\n```\n\n### Custom Rendering (no Matter.Render)\n\nUse this when you want to draw bodies yourself (e.g., with canvas, PixiJS, Three.js).\n\n```js\nfunction customUpdate() {\n  Engine.update(engine, 1000 \u002F 60);\n  \u002F\u002F Your custom render loop here\n  requestAnimationFrame(customUpdate);\n}\ncustomUpdate();\n```\n\n---\n\n## SPA Cleanup\n\n```js\nfunction cleanupPhysics() {\n  Runner.stop(runner);\n  Render.stop(render);\n  if (render.canvas.parentNode) {\n    render.canvas.parentNode.removeChild(render.canvas);\n  }\n  Engine.clear(engine);\n  Composite.clear(engine.world, false);\n}\n```\n\n## Offscreen Pause (performance)\n\n```js\nconst observer = new IntersectionObserver(\n  ([entry]) => {\n    if (entry.isIntersecting) {\n      Runner.run(runner, engine);\n    } else {\n      Runner.stop(runner);\n    }\n  },\n  { threshold: 0 }\n);\nobserver.observe(container);\n\n\u002F\u002F Cleanup observer when component unmounts\n\u002F\u002F observer.disconnect();\n```\n\n---\n\n## Performance Rules\n\n- ✅ Use `isStatic: true` for scenery\u002Fground (doesn't simulate)\n- ✅ Pause runner when offscreen (IntersectionObserver)\n- ✅ Limit total bodies (\u003C 200 for mobile)\n- ❌ No wireframes in production (set `wireframes: false`)\n- ❌ No `Render.run()` + custom render simultaneously\n- ❌ No high `stiffness` on mouse constraints (feels janky)\n\n## What to Ask the User\n\n- Viewport size and canvas dimensions?\n- Are we using Matter.Render or custom rendering?\n- Mouse\u002Ftouch drag interaction needed?\n- Should physics pause when offscreen?\n- Gravity direction (default: down)?\n","## When to Use\n\n- Interactive 2D physics (falling, bouncing, colliding elements)\n- Draggable objects with physics behavior\n- Gravity-based UI elements or games\n- Physics sandbox, simulations, or data visualizations\n\n---\n\n## Core Setup\n\n### Minimal (quick start)\n\n```html\n\u003Cscript src=\"https:\u002F\u002Fcdnjs.cloudflare.com\u002Fajax\u002Flibs\u002Fmatter-js\u002F0.19.0\u002Fmatter.min.js\">\u003C\u002Fscript>\n\u003Cscript>\n  const { Engine, Render, Runner, Bodies, Composite } = Matter;\n\n  const engine = Engine.create();\n\n  const render = Render.create({\n    element: document.body,\n    engine: engine,\n    options: { width: 800, height: 600, wireframes: false },\n  });\n\n  const runner = Runner.create();\n  Runner.run(runner, engine);\n  Render.run(render);\n\n  \u002F\u002F Static ground\n  const ground = Bodies.rectangle(400, 610, 810, 60, { isStatic: true });\n  \u002F\u002F Dynamic box\n  const box = Bodies.rectangle(400, 200, 80, 80);\n\n  Composite.add(engine.world, [ground, box]);\n\u003C\u002Fscript>\n```\n\n### ES Module (npm)\n\n```bash\nnpm i matter-js\n```\n\n```js\nimport Matter from \"matter-js\";\nconst { Engine, Render, Runner, Bodies, Composite } = Matter;\n```\n\n---\n\n## Common Patterns\n\n### Bodies\n\n```js\n\u002F\u002F Rectangle (static: platform, dynamic: falling)\nconst platform = Bodies.rectangle(x, y, width, height, { isStatic: true });\nconst box = Bodies.rectangle(x, y, width, height);\n\n\u002F\u002F Circle\nconst ball = Bodies.circle(x, y, radius);\n\n\u002F\u002F Polygon (sides = 3 for triangle, 6 for hexagon, etc.)\nconst hex = Bodies.polygon(x, y, 6, radius);\n\n\u002F\u002F Compound body (multiple parts as one physics object)\nconst compound = Body.create({\n  parts: [\n    Bodies.rectangle(0, 0, 100, 20),\n    Bodies.rectangle(0, -20, 20, 40),\n  ],\n});\n```\n\n### Adding to World\n\n```js\n\u002F\u002F Single\nComposite.add(engine.world, body);\n\n\u002F\u002F Multiple\nComposite.add(engine.world, [bodyA, bodyB, bodyC]);\n```\n\n---\n\n## Mouse Interaction\n\n```js\nconst { Mouse, MouseConstraint } = Matter;\n\nconst mouse = Mouse.create(render.canvas);\nconst mouseConstraint = MouseConstraint.create(engine, {\n  mouse,\n  constraint: {\n    stiffness: 0.2,\n    render: { visible: false },\n  },\n});\n\nComposite.add(engine.world, mouseConstraint);\nrender.mouse = mouse;\n```\n\n### Mouse Constraint Options\n\n```js\n{\n  mouse: mouse,\n  constraint: {\n    stiffness: 0.2,       \u002F\u002F lower = more elastic\n    damping: 0.1,         \u002F\u002F resistance to motion\n    render: { visible: false },\n    \u002F\u002F angularStiffness: 0.1, \u002F\u002F for rotation\n  },\n}\n```\n\n---\n\n## Constraints & Joints\n\n```js\nconst { Constraint } = Matter;\n\n\u002F\u002F Pin body to a point in space\nconst constraint = Constraint.create({\n  pointA: { x: 400, y: 100 },\n  bodyB: box,\n  pointB: { x: 0, y: 0 },\n  stiffness: 0.9,\n  length: 0,\n});\nComposite.add(engine.world, constraint);\n\n\u002F\u002F Connect two bodies\nconst rope = Constraint.create({\n  bodyA: body1,\n  bodyB: body2,\n  stiffness: 0.8,\n  length: 100,\n});\n```\n\n---\n\n## Collision Events\n\n```js\nconst { Events } = Matter;\n\nEvents.on(engine, \"collisionStart\", (event) => {\n  event.pairs.forEach((pair) => {\n    console.log(\"Collision:\", pair.bodyA.label, pair.bodyB.label);\n  });\n});\n\nEvents.on(engine, \"collisionEnd\", (event) => { \u002F* ... *\u002F });\n```\n\n---\n\n## Render Options\n\n```js\nRender.create({\n  element: container,\n  engine,\n  options: {\n    width: 800,\n    height: 600,\n    wireframes: false,        \u002F\u002F true = debug outlines\n    background: \"#0f0f0f\",\n    \u002F\u002F showAngleIndicator: true,\n    \u002F\u002F showVelocity: true,\n    \u002F\u002F showCollisions: true,\n  },\n});\n```\n\n### Custom Rendering (no Matter.Render)\n\nUse this when you want to draw bodies yourself (e.g., with canvas, PixiJS, Three.js).\n\n```js\nfunction customUpdate() {\n  Engine.update(engine, 1000 \u002F 60);\n  \u002F\u002F Your custom render loop here\n  requestAnimationFrame(customUpdate);\n}\ncustomUpdate();\n```\n\n---\n\n## SPA Cleanup\n\n```js\nfunction cleanupPhysics() {\n  Runner.stop(runner);\n  Render.stop(render);\n  if (render.canvas.parentNode) {\n    render.canvas.parentNode.removeChild(render.canvas);\n  }\n  Engine.clear(engine);\n  Composite.clear(engine.world, false);\n}\n```\n\n## Offscreen Pause (performance)\n\n```js\nconst observer = new IntersectionObserver(\n  ([entry]) => {\n    if (entry.isIntersecting) {\n      Runner.run(runner, engine);\n    } else {\n      Runner.stop(runner);\n    }\n  },\n  { threshold: 0 }\n);\nobserver.observe(container);\n\n\u002F\u002F Cleanup observer when component unmounts\n\u002F\u002F observer.disconnect();\n```\n\n---\n\n## Performance Rules\n\n- ✅ Use `isStatic: true` for scenery\u002Fground (doesn't simulate)\n- ✅ Pause runner when offscreen (IntersectionObserver)\n- ✅ Limit total bodies (\u003C 200 for mobile)\n- ❌ No wireframes in production (set `wireframes: false`)\n- ❌ No `Render.run()` + custom render simultaneously\n- ❌ No high `stiffness` on mouse constraints (feels janky)\n\n## What to Ask the User\n\n- Viewport size and canvas dimensions?\n- Are we using Matter.Render or custom rendering?\n- Mouse\u002Ftouch drag interaction needed?\n- Should physics pause when offscreen?\n- Gravity direction (default: down)?\n",{"name":5,"license":15,"metadata":24,"description":27},{"author":25,"version":26},"gentleman-programming (inspired by MengTo\u002FSkills)","1.0","2D physics engine for interactive UI, games, and dynamic visual effects. Covers Engine\u002FWorld setup, Render\u002FRunner config, bodies, constraints, mouse interaction, SPA cleanup, and offscreen pause. Trigger: When implementing 2D physics interactions, gravity simulations, draggable physics objects, or any Matter.js physics scene.\n","main","5dc86f90a5cbe45db3acd917825461b3ed6937fb","config\u002F.config\u002Fopencode\u002Fskills\u002Fmatterjs",0,"https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev","🌐 Apasionado por crear soluciones web escalables y eficientes. \r\n🧑‍🏫 Coach Dev.\r\n💻 Frontend Dev. \r\n🎚️Backend Dev.\r\n📊 Agile\u002FScrum.\r\n🚀100% remoto.","2026-08-26 07:28:05",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add davidcoachdev\u002Fdcfiles --skill matterjs",{"tool":42,"command":43},"bunx","bunx skills add davidcoachdev\u002Fdcfiles --skill matterjs",{"tool":45,"command":46},"pnpm","pnpm dlx skills add davidcoachdev\u002Fdcfiles --skill matterjs","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fmatterjs\u002FSKILL.md",true,[],[51,58,65,72,80,87],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7740FETMZY1VTYAEFY1TWY7","zustand-5","Zustand 5 state management patterns. Trigger: When managing React state with Zustand.","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fzustand-5\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M773ZZM9V68SA1AKP4WF4J29","zod-4","Zod 4 schema validation patterns. Trigger: When using Zod for validation - breaking changes from v3.","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fzod-4\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M773ZJFR90CQAY0N9QR40QVP","x-bookmark-quote-posts","Workflow para revisar bookmarks de X\u002FTwitter y convertirlos en drafts de quote posts. Accede a la sección de bookmarks vía browser headless, extrae posts recientes, y genera drafts con voz personal del usuario. No publica ni muta X — solo genera contenido para revisión. Trigger: X bookmarks, Twitter bookmarks, quote posts, bookmark automation, crear quote posts, revisar bookmarks, growth content X.","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fx-bookmark-quote-posts\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":76,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M773Z2RGV3786FV310SDB0YD","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","MIT","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":76,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M773YJH3KDSW467CSS63CSRJ","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M773Y3S3H2CPRK5S8YFHWB5C","work-unit-commits","Plan commits as reviewable work units. Trigger: implementation, commit splitting, chained PRs, or keeping tests and docs with code.","https:\u002F\u002Fgithub.com\u002Fdavidcoachdev\u002Fdcfiles\u002Fblob\u002Fmain\u002Fconfig\u002F.config\u002Fopencode\u002Fskills\u002Fwork-unit-commits\u002FSKILL.md",[],[]]