[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75MVFZ3YMSKB8Z9TMBWY4GV":3,"skill-same:01M75MVFZ3YMSKB8Z9TMBWY4GV":45},{"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":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M75MVFZ3YMSKB8Z9TMBWY4GV","single-responsibility",null,"Use when a class, function, module, or file is hard to reason about. A unit you cannot describe in one sentence holds too many responsibilities; decompose it into single-responsibility units that collaborate through clear interfaces.","selamy-labs\u002Fagent-skills","selamy-labs","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F287832944?v=4","01M75MDKJ0CKAM94KZ7TWQJM5Q","01M75MDKJNP3TATHAW1MX1FWM6",0,"MIT","https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsingle-responsibility\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: single-responsibility\ndescription: Use when a class, function, module, or file is hard to reason about. A unit you cannot describe in one sentence holds too many responsibilities; decompose it into single-responsibility units that collaborate through clear interfaces.\n---\n\n# Single Responsibility\n\nA unit of code — a class, function, module, or file — should have **one\nresponsibility**: one reason to change, one job you can state in a single\nsentence. When a unit is **hard to reason about**, that difficulty is the\nsignal that it has accreted several responsibilities. The fix is not to comment\nit or split it arbitrarily; it is to **separate the concerns** into distinct\nsingle-responsibility units that collaborate through clear interfaces.\n\nThis is the long-established Single Responsibility Principle \u002F separation of\nconcerns, applied as an enforceable code-design habit.\n\n## The bar for a good unit\n\nAfter decomposing, each unit should satisfy all three:\n\n1. **One sentence.** You can say what it does, how to use it, and what it\n   depends on — each in one sentence. If the \"what it does\" sentence needs an\n   \"and\", you probably have two units.\n2. **Understand from the outside.** A caller can use it correctly from its\n   name and signature, without reading its internals.\n3. **Change the inside safely.** You can change how it works internally without\n   breaking any consumer, because consumers only depend on its interface.\n\n## Detection heuristics (when to decompose)\n\nConcrete signals that a unit owns too much:\n\n- **More than one reason to change.** A change to formatting *and* a change to\n  the data source *and* a change to retry policy all land in the same unit.\n- **Too big to hold in your head.** You scroll, or lose the thread, to\n  understand one path through it.\n- **Too many parameters or too much state.** A long parameter list or a pile of\n  fields that don't all relate to each other (see `parameter-design`,\n  `complexity-budgets`).\n- **High branching \u002F nesting.** Cyclomatic or cognitive complexity over the\n  budget; deeply nested control flow (see `complexity-budgets`,\n  `early-return-over-else`).\n- **A name that needs \"and\", or hides behind \"Manager\"\u002F\"Util\"\u002F\"Helper\"\u002F\n  \"Service\"\u002F\"Processor\".** A vague catch-all name is a unit with no single\n  answer to \"what is it responsible for?\"\n- **Tests need elaborate setup.** If exercising one behavior forces you to\n  stand up five unrelated collaborators, the unit is doing five things.\n\nOne signal is a hint; several together mean decompose now.\n\n## The move: decompose, then delegate\n\n1. **Name the responsibilities.** List the distinct jobs the unit is doing —\n   each becomes a candidate unit. The names should be answerable in one\n   sentence; if you can't name a clean job, the seam is wrong.\n2. **Extract each into its own unit** with a focused interface — the smallest\n   surface a caller needs, hiding the internals behind it.\n3. **Turn the original into a coordinator that delegates.** It wires the pieces\n   together and calls them; it no longer does the work inline. A thin\n   coordinator with a clear story beats a fat unit that does everything.\n4. **Keep behavior unchanged.** Decompose as a behavior-preserving refactor\n   first (tests stay green), then make any behavior change separately (see\n   `small-focused-changes`).\n\n## Before \u002F after\n\nA function that validates, transforms, persists, and notifies — four reasons to\nchange in one body:\n\n```python\n# before: one function, four responsibilities, hard to test in isolation\ndef handle_signup(raw):\n    if \"@\" not in raw[\"email\"] or len(raw[\"password\"]) \u003C 8:\n        raise ValueError(\"invalid\")\n    user = {\"email\": raw[\"email\"].lower(), \"hash\": bcrypt(raw[\"password\"])}\n    db.execute(\"INSERT INTO users ...\", user)\n    smtp.send(user[\"email\"], render_welcome(user))\n    return user\n\n# after: each unit has one job; handle_signup is a coordinator that delegates\ndef handle_signup(raw, validator, store, mailer):\n    fields = validator.validate(raw)      # validation: one reason to change\n    user = store.create(fields)           # persistence: one reason to change\n    mailer.send_welcome(user)             # notification: one reason to change\n    return user\n```\n\nEach collaborator (`validator`, `store`, `mailer`) is now usable and testable\non its own, swappable behind its interface, and `handle_signup` reads as the\nstory of a signup.\n\nA class that has grown an \"and\":\n\n```typescript\n\u002F\u002F before: \"manages orders AND prices them AND talks to the gateway\"\nclass OrderManager {\n  price(order: Order): Money { \u002F* tax + discount rules *\u002F }\n  charge(order: Order): Receipt { \u002F* payment-gateway calls *\u002F }\n  save(order: Order): void { \u002F* persistence *\u002F }\n}\n\n\u002F\u002F after: one responsibility each; a coordinator composes them\nclass Pricer     { price(order: Order): Money { \u002F* ... *\u002F } }\nclass Payments   { charge(order: Order, total: Money): Receipt { \u002F* ... *\u002F } }\nclass OrderStore { save(order: Order): void { \u002F* ... *\u002F } }\n\nclass Checkout {\n  constructor(\n    private readonly pricer: Pricer,\n    private readonly payments: Payments,\n    private readonly orders: OrderStore,\n  ) {}\n  place(order: Order): Receipt {\n    const total = this.pricer.price(order);\n    const receipt = this.payments.charge(order, total);\n    this.orders.save(order);\n    return receipt;\n  }\n}\n```\n\n## When NOT to (keep it simple)\n\n- **A small unit that already reads in one sentence** needs no splitting.\n  Decomposition is for units that are hard to reason about, not a quota.\n- **Don't shatter one cohesive job into fragments** that only make sense\n  together — that creates artificial coupling and worse locality, and is its\n  own complexity-budget violation.\n- **Don't manufacture interfaces with a single implementation** that will never\n  vary just to look decomposed; introduce the seam when a real responsibility\n  or variant exists (`interface-over-conditionals` covers the behavioral-variant\n  case specifically).\n- The target is the **smallest coherent unit**, not the smallest possible one.\n\n## Review checks\n\n- Each unit's responsibility is stateable in one sentence with no \"and\".\n- Callers use each unit from its interface without reading its internals.\n- Internals can change without breaking consumers.\n- The coordinator delegates; it does not inline the work it orchestrates.\n- The decomposition was behavior-preserving; any behavior change shipped\n  separately.\n\nCross-link: composes with `small-focused-changes` (decompose the *change*,\nthis decomposes the *unit*), `complexity-budgets` (enforceable size\u002Fbranching\nsignals), `parameter-design` (too many params signals too many jobs),\n`early-return-over-else` (flatten before you split), `interface-over-conditionals`\nand `map-dispatch-over-conditionals` (decompose behavioral variation behind an\ninterface), and `technical-integrity` (decompose for truth, not to hit a quota).\n","# Single Responsibility\n\nA unit of code — a class, function, module, or file — should have **one\nresponsibility**: one reason to change, one job you can state in a single\nsentence. When a unit is **hard to reason about**, that difficulty is the\nsignal that it has accreted several responsibilities. The fix is not to comment\nit or split it arbitrarily; it is to **separate the concerns** into distinct\nsingle-responsibility units that collaborate through clear interfaces.\n\nThis is the long-established Single Responsibility Principle \u002F separation of\nconcerns, applied as an enforceable code-design habit.\n\n## The bar for a good unit\n\nAfter decomposing, each unit should satisfy all three:\n\n1. **One sentence.** You can say what it does, how to use it, and what it\n   depends on — each in one sentence. If the \"what it does\" sentence needs an\n   \"and\", you probably have two units.\n2. **Understand from the outside.** A caller can use it correctly from its\n   name and signature, without reading its internals.\n3. **Change the inside safely.** You can change how it works internally without\n   breaking any consumer, because consumers only depend on its interface.\n\n## Detection heuristics (when to decompose)\n\nConcrete signals that a unit owns too much:\n\n- **More than one reason to change.** A change to formatting *and* a change to\n  the data source *and* a change to retry policy all land in the same unit.\n- **Too big to hold in your head.** You scroll, or lose the thread, to\n  understand one path through it.\n- **Too many parameters or too much state.** A long parameter list or a pile of\n  fields that don't all relate to each other (see `parameter-design`,\n  `complexity-budgets`).\n- **High branching \u002F nesting.** Cyclomatic or cognitive complexity over the\n  budget; deeply nested control flow (see `complexity-budgets`,\n  `early-return-over-else`).\n- **A name that needs \"and\", or hides behind \"Manager\"\u002F\"Util\"\u002F\"Helper\"\u002F\n  \"Service\"\u002F\"Processor\".** A vague catch-all name is a unit with no single\n  answer to \"what is it responsible for?\"\n- **Tests need elaborate setup.** If exercising one behavior forces you to\n  stand up five unrelated collaborators, the unit is doing five things.\n\nOne signal is a hint; several together mean decompose now.\n\n## The move: decompose, then delegate\n\n1. **Name the responsibilities.** List the distinct jobs the unit is doing —\n   each becomes a candidate unit. The names should be answerable in one\n   sentence; if you can't name a clean job, the seam is wrong.\n2. **Extract each into its own unit** with a focused interface — the smallest\n   surface a caller needs, hiding the internals behind it.\n3. **Turn the original into a coordinator that delegates.** It wires the pieces\n   together and calls them; it no longer does the work inline. A thin\n   coordinator with a clear story beats a fat unit that does everything.\n4. **Keep behavior unchanged.** Decompose as a behavior-preserving refactor\n   first (tests stay green), then make any behavior change separately (see\n   `small-focused-changes`).\n\n## Before \u002F after\n\nA function that validates, transforms, persists, and notifies — four reasons to\nchange in one body:\n\n```python\n# before: one function, four responsibilities, hard to test in isolation\ndef handle_signup(raw):\n    if \"@\" not in raw[\"email\"] or len(raw[\"password\"]) \u003C 8:\n        raise ValueError(\"invalid\")\n    user = {\"email\": raw[\"email\"].lower(), \"hash\": bcrypt(raw[\"password\"])}\n    db.execute(\"INSERT INTO users ...\", user)\n    smtp.send(user[\"email\"], render_welcome(user))\n    return user\n\n# after: each unit has one job; handle_signup is a coordinator that delegates\ndef handle_signup(raw, validator, store, mailer):\n    fields = validator.validate(raw)      # validation: one reason to change\n    user = store.create(fields)           # persistence: one reason to change\n    mailer.send_welcome(user)             # notification: one reason to change\n    return user\n```\n\nEach collaborator (`validator`, `store`, `mailer`) is now usable and testable\non its own, swappable behind its interface, and `handle_signup` reads as the\nstory of a signup.\n\nA class that has grown an \"and\":\n\n```typescript\n\u002F\u002F before: \"manages orders AND prices them AND talks to the gateway\"\nclass OrderManager {\n  price(order: Order): Money { \u002F* tax + discount rules *\u002F }\n  charge(order: Order): Receipt { \u002F* payment-gateway calls *\u002F }\n  save(order: Order): void { \u002F* persistence *\u002F }\n}\n\n\u002F\u002F after: one responsibility each; a coordinator composes them\nclass Pricer     { price(order: Order): Money { \u002F* ... *\u002F } }\nclass Payments   { charge(order: Order, total: Money): Receipt { \u002F* ... *\u002F } }\nclass OrderStore { save(order: Order): void { \u002F* ... *\u002F } }\n\nclass Checkout {\n  constructor(\n    private readonly pricer: Pricer,\n    private readonly payments: Payments,\n    private readonly orders: OrderStore,\n  ) {}\n  place(order: Order): Receipt {\n    const total = this.pricer.price(order);\n    const receipt = this.payments.charge(order, total);\n    this.orders.save(order);\n    return receipt;\n  }\n}\n```\n\n## When NOT to (keep it simple)\n\n- **A small unit that already reads in one sentence** needs no splitting.\n  Decomposition is for units that are hard to reason about, not a quota.\n- **Don't shatter one cohesive job into fragments** that only make sense\n  together — that creates artificial coupling and worse locality, and is its\n  own complexity-budget violation.\n- **Don't manufacture interfaces with a single implementation** that will never\n  vary just to look decomposed; introduce the seam when a real responsibility\n  or variant exists (`interface-over-conditionals` covers the behavioral-variant\n  case specifically).\n- The target is the **smallest coherent unit**, not the smallest possible one.\n\n## Review checks\n\n- Each unit's responsibility is stateable in one sentence with no \"and\".\n- Callers use each unit from its interface without reading its internals.\n- Internals can change without breaking consumers.\n- The coordinator delegates; it does not inline the work it orchestrates.\n- The decomposition was behavior-preserving; any behavior change shipped\n  separately.\n\nCross-link: composes with `small-focused-changes` (decompose the *change*,\nthis decomposes the *unit*), `complexity-budgets` (enforceable size\u002Fbranching\nsignals), `parameter-design` (too many params signals too many jobs),\n`early-return-over-else` (flatten before you split), `interface-over-conditionals`\nand `map-dispatch-over-conditionals` (decompose behavioral variation behind an\ninterface), and `technical-integrity` (decompose for truth, not to hit a quota).\n",{"name":5,"description":7},"main","54007b08157feb09e5bb9d7ff5ce4ddd21625dbf","skills\u002Fsingle-responsibility",3,"https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills","https:\u002F\u002Fselamy.dev","https:\u002F\u002Fgithub.com\u002Fselamy-labs","2026-11-15 03:50:58",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add selamy-labs\u002Fagent-skills --skill single-responsibility",{"tool":37,"command":38},"bunx","bunx skills add selamy-labs\u002Fagent-skills --skill single-responsibility",{"tool":40,"command":41},"pnpm","pnpm dlx skills add selamy-labs\u002Fagent-skills --skill single-responsibility","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsingle-responsibility\u002FSKILL.md",true,[],[46,53,60,67,73,80],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":18},"01M75MY70JMSNFHQX63G90SKZ7","silence-phrase","A seemingly normal skill.","https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fsilence-phrase\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":18},"01M75MY5PKVKY60M8H2DFTW58C","selamy-bad-skill","This skill has a vendor prefix that should be rejected.","https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fprefixed-name\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M75MY1TKXCH6WYN9ET0W4T02","oversized-description","This is a very long description that contains way too many words and should be rejected by the validator because it exceeds the forty five word limit that is enforced by the naming lint checker which ensures skill descriptions stay concise and readable for humans and machines alike without unnecessary verbosity or padding","https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Foversized-description\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M75MY0SZ7EKT99NWJEJ8HKS2","missing-frontmatter","https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fmissing-frontmatter\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M75MXYMBREE6D7KRR87YM4DH","malicious-skill","A poisoned skill used only as a negative fixture for the security gate.","https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fmalicious-skill\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M75MXX2B7AC2QSSRRQQXTA0N","leaking-org-name","A skill about something.","https:\u002F\u002Fgithub.com\u002Fselamy-labs\u002Fagent-skills\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fleaking-org-name\u002FSKILL.md",[],[]]