[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71H628R33C1H285MSMF6RN9":3,"skill-same:01M71H628R33C1H285MSMF6RN9":54},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":34,"commitSha":35,"skillDirectory":36,"forksCount":13,"repositoryHtmlUrl":37,"repositoryHomepageUrl":6,"ownerHtmlUrl":38,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":39,"install":40,"resources":53},"01M71H628R33C1H285MSMF6RN9","04-resources",null,"Effect-TS 4 resource management — Scope, acquireRelease, Layer.scoped, and safe resource lifecycle","lambda-solver\u002Flambdabench-pro","lambda-solver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F279071046?v=4","01M71H55W2WK3PM6RRAY9JZWAJ","01M71H55WRT9XAFDAVACTCC2XP",0,"MIT","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Feffect-ts\u002Fcore\u002F04-resources\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28],"resources","04 resources","effect","opencode","resource management","scope","lifecycle","safe","scoped","layer","management","2026-11-10 10:12:30",false,"---\nname: 04-resources\ndescription: Effect-TS 4 resource management — Scope, acquireRelease, Layer.scoped, and safe resource lifecycle\nlicense: MIT\ncompatibility: opencode\n---\n\n# Resource Management\n\n## acquireRelease — safe open\u002Fclose pair\n\nThe release is guaranteed to run even on interruption or failure.\n\n```typescript\nimport { Effect } from \"effect\";\n\nconst connection =\n  yield *\n  Effect.acquireRelease(\n    Effect.sync(() => db.connect()), \u002F\u002F acquire\n    (conn) => Effect.sync(() => conn.close()), \u002F\u002F release — always runs\n  );\n```\n\n## Layer.scoped — resource tied to layer lifetime\n\nUse when the resource should live as long as the layer's scope.\n\n```typescript\nimport { Context, Effect, Layer } from \"effect\";\n\nexport class DbPool extends Context.Service\u003C\n  DbPool,\n  {\n    query(sql: string): Effect.Effect\u003CArray\u003Cunknown>>;\n  }\n>()(\"myapp\u002FDbPool\") {\n  static readonly layer = Layer.scoped(\n    DbPool,\n    Effect.gen(function* () {\n      const pool = yield* Effect.acquireRelease(\n        Effect.promise(() => createPool(config)),\n        (p) => Effect.promise(() => p.end()),\n      );\n      return DbPool.of({\n        query: Effect.fn(\"DbPool.query\")(function* (sql) {\n          return yield* Effect.promise(() => pool.query(sql));\n        }),\n      });\n    }),\n  );\n}\n```\n\n## Effect.addFinalizer — finalizer in current scope\n\n```typescript\nyield * Effect.addFinalizer(() => Effect.sync(() => console.log(\"scope closing\")));\n```\n\n## Scope — explicit lifetime management\n\n```typescript\nimport { Scope } from \"effect\";\n\nconst program = Effect.gen(function* () {\n  const scope = yield* Scope.make();\n\n  const conn = yield* Effect.acquireRelease(\n    Effect.sync(() => db.connect()),\n    (c) => Effect.sync(() => c.close()),\n  ).pipe(Effect.provideService(Scope.Scope, scope));\n\n  \u002F\u002F ... use conn ...\n\n  \u002F\u002F Close explicitly when done\n  yield* Scope.close(scope, Exit.void);\n});\n```\n\n## Effect.using — acquire + use + release in one expression\n\n```typescript\nconst result =\n  yield *\n  Effect.using(\n    Effect.acquireRelease(\n      Effect.sync(() => openFile(path)),\n      (f) => Effect.sync(() => f.close()),\n    ),\n    (file) => readLines(file),\n  );\n```\n\n## forkScoped — fiber tied to scope\n\nThe fiber is interrupted when the enclosing scope closes.\n\n```typescript\nyield *\n  Effect.forkScoped(\n    Effect.gen(function* () {\n      while (true) {\n        yield* Effect.sleep(\"5 seconds\");\n        yield* Effect.log(\"heartbeat\");\n      }\n    }),\n  );\n```\n\n## Key rules\n\n- Never manage resources with `try\u002Ffinally` inside `Effect.gen` — use `acquireRelease`.\n- `Layer.scoped` > `Layer.effect` when the service wraps a resource.\n- `Effect.forkScoped` > `Effect.fork` for long-running background tasks.\n","# Resource Management\n\n## acquireRelease — safe open\u002Fclose pair\n\nThe release is guaranteed to run even on interruption or failure.\n\n```typescript\nimport { Effect } from \"effect\";\n\nconst connection =\n  yield *\n  Effect.acquireRelease(\n    Effect.sync(() => db.connect()), \u002F\u002F acquire\n    (conn) => Effect.sync(() => conn.close()), \u002F\u002F release — always runs\n  );\n```\n\n## Layer.scoped — resource tied to layer lifetime\n\nUse when the resource should live as long as the layer's scope.\n\n```typescript\nimport { Context, Effect, Layer } from \"effect\";\n\nexport class DbPool extends Context.Service\u003C\n  DbPool,\n  {\n    query(sql: string): Effect.Effect\u003CArray\u003Cunknown>>;\n  }\n>()(\"myapp\u002FDbPool\") {\n  static readonly layer = Layer.scoped(\n    DbPool,\n    Effect.gen(function* () {\n      const pool = yield* Effect.acquireRelease(\n        Effect.promise(() => createPool(config)),\n        (p) => Effect.promise(() => p.end()),\n      );\n      return DbPool.of({\n        query: Effect.fn(\"DbPool.query\")(function* (sql) {\n          return yield* Effect.promise(() => pool.query(sql));\n        }),\n      });\n    }),\n  );\n}\n```\n\n## Effect.addFinalizer — finalizer in current scope\n\n```typescript\nyield * Effect.addFinalizer(() => Effect.sync(() => console.log(\"scope closing\")));\n```\n\n## Scope — explicit lifetime management\n\n```typescript\nimport { Scope } from \"effect\";\n\nconst program = Effect.gen(function* () {\n  const scope = yield* Scope.make();\n\n  const conn = yield* Effect.acquireRelease(\n    Effect.sync(() => db.connect()),\n    (c) => Effect.sync(() => c.close()),\n  ).pipe(Effect.provideService(Scope.Scope, scope));\n\n  \u002F\u002F ... use conn ...\n\n  \u002F\u002F Close explicitly when done\n  yield* Scope.close(scope, Exit.void);\n});\n```\n\n## Effect.using — acquire + use + release in one expression\n\n```typescript\nconst result =\n  yield *\n  Effect.using(\n    Effect.acquireRelease(\n      Effect.sync(() => openFile(path)),\n      (f) => Effect.sync(() => f.close()),\n    ),\n    (file) => readLines(file),\n  );\n```\n\n## forkScoped — fiber tied to scope\n\nThe fiber is interrupted when the enclosing scope closes.\n\n```typescript\nyield *\n  Effect.forkScoped(\n    Effect.gen(function* () {\n      while (true) {\n        yield* Effect.sleep(\"5 seconds\");\n        yield* Effect.log(\"heartbeat\");\n      }\n    }),\n  );\n```\n\n## Key rules\n\n- Never manage resources with `try\u002Ffinally` inside `Effect.gen` — use `acquireRelease`.\n- `Layer.scoped` > `Layer.effect` when the service wraps a resource.\n- `Effect.forkScoped` > `Effect.fork` for long-running background tasks.\n",{"name":5,"license":14,"description":7,"compatibility":21},"main","816c073aaf171300af3605b06f7ec5aa7370ef0b",".opencode\u002Fskills\u002Feffect-ts\u002Fcore\u002F04-resources","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro","https:\u002F\u002Fgithub.com\u002Flambda-solver","2026-05-31 17:08:46",{"source":8,"skillName":5,"commands":41,"prompt":51,"zipAvailable":52},[42,45,48],{"tool":43,"command":44},"npx","npx skills add lambda-solver\u002Flambdabench-pro --skill 04-resources",{"tool":46,"command":47},"bunx","bunx skills add lambda-solver\u002Flambdabench-pro --skill 04-resources",{"tool":49,"command":50},"pnpm","pnpm dlx skills add lambda-solver\u002Flambdabench-pro --skill 04-resources","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Feffect-ts\u002Fcore\u002F04-resources\u002FSKILL.md",true,[],[55,86,108,126,147,165],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":66,"publishedAt":29},"01M71H9FNA5D6Y4ANXD18Z1Z3X","tmux-workflow","Development workflow with tmux — run dev servers, Storybook, and background processes in persistent sessions with live logs, while keeping OpenCode free for chat","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002Freference\u002Fghui\u002F.opencode\u002Fskills\u002Ftmux\u002FSKILL.md",[61],{"categoryNo":62,"categoryName":63,"taxonomyType":64,"taxonomyTypeDesc":65},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[67,68,69,70,71,72,73,74,75,76,77,21,78,79,80,81,82,83,84,85],"tmux","workflow","tmux workflow","chat","dev servers","background","processes","storybook","live","servers","run","with","logs","development workflow","free","dev","sessions","for","development",{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":95,"publishedAt":29},"01M71H9DQJDAJVZX37NDN99D3P","04-anti-patterns","React anti-patterns to avoid — manual JSX repetition, useEffect misuse, reference instability, prop drilling, conditional hooks, and common performance traps","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002Freference\u002Fghui\u002F.opencode\u002Fskills\u002Freact\u002Fpatterns\u002F04-anti-patterns\u002FSKILL.md",[92],{"categoryNo":93,"categoryName":94,"taxonomyType":64,"taxonomyTypeDesc":65},"01JBSEEDCAT000000000000009","前端开发",[96,97,98,99,100,101,102,103,104,105,106,21,107],"patterns","anti patterns","04 anti patterns","common","jsx","reference","conditional","hooks","manual","performance","anti-patterns","react",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":115,"publishedAt":29},"01M71H9BXF511W2R3B73S5P9ZN","03-state-management","React state management patterns — lifting state, colocation, URL state, server state with TanStack Query, local state with useState\u002FuseReducer","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002Freference\u002Fghui\u002F.opencode\u002Fskills\u002Freact\u002Fpatterns\u002F03-state-management\u002FSKILL.md",[114],{"categoryNo":93,"categoryName":94,"taxonomyType":64,"taxonomyTypeDesc":65},[28,116,117,118,107,119,96,120,121,122,123,21,124,78,125],"state management","state","03 state management","query","URL","tanstack","react state management","local","server","tanstack query",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":133,"publishedAt":29},"01M71H9AAGVWMYQ4NG82QPYCTE","02-component-composition","React component composition patterns — render props, compound components, list rendering with map, slot patterns, and layout primitives","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002Freference\u002Fghui\u002F.opencode\u002Fskills\u002Freact\u002Fpatterns\u002F02-component-composition\u002FSKILL.md",[132],{"categoryNo":93,"categoryName":94,"taxonomyType":64,"taxonomyTypeDesc":65},[134,135,136,21,78,137,138,107,139,96,140,141,142,143,144,145,146],"02 component composition","component","Composition","compound","components","primitives","composition patterns","list","map","rendering","render","react component","layout",{"skillNo":148,"name":149,"nameZh":6,"description":150,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":154,"publishedAt":29},"01M71H98RDXRQZDR496SRD906M","01-fp-style","React functional programming style — pure components, hooks conventions, Effect Atom integration, and Tailwind patterns","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002Freference\u002Fghui\u002F.opencode\u002Fskills\u002Freact\u002Fpatterns\u002F01-fp-style\u002FSKILL.md",[153],{"categoryNo":93,"categoryName":94,"taxonomyType":64,"taxonomyTypeDesc":65},[155,156,157,96,158,159,21,160,107,161,138,103,162,163,164,20],"01 fp style","style","atom","conventions","integration","functional","programming","Tailwind","tailwind patterns","functional programming",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":172,"publishedAt":29},"01M71H95PYGAWBS5C8KN0C4WGT","react-animation","React animation with react\u002Fmotion (Framer Motion) — declarative animations, gestures, layout animations, and performance best practices","https:\u002F\u002Fgithub.com\u002Flambda-solver\u002Flambdabench-pro\u002Fblob\u002Fmain\u002Freference\u002Fghui\u002F.opencode\u002Fskills\u002Freact\u002Fanimation\u002FSKILL.md",[171],{"categoryNo":93,"categoryName":94,"taxonomyType":64,"taxonomyTypeDesc":65},[107,173,174,105,175,21,146,176,177,78,178,179,180,181],"react animation","Animation","framer motion","motion","best practices","framer","gestures","animations","declarative"]