[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EG6WRENPRZAVZT6HQV07MW":3,"skill-same:01M7EG6WRENPRZAVZT6HQV07MW":53},{"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":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":46},"01M7EG6WRENPRZAVZT6HQV07MW","craft-refactor",null,"Improve the structure of existing code without changing its behavior, in small verified steps from a green baseline, adding characterization tests where protection is thin. Explicit invocation only.","giuseppecrj\u002Fpi-herdr-clean-craft","giuseppecrj","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F5714678?v=4","01M7E7A7DZHS53J4N29EW0XYZX","Giuseppe Rodriguez","01M7EG6CZ3TEX6A0572FTR7CZ7",1,"MIT","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Fskills\u002Fcraft-refactor\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: craft-refactor\ndescription: Improve the structure of existing code without changing its behavior, in small verified steps from a green baseline, adding characterization tests where protection is thin. Explicit invocation only.\ndisable-model-invocation: true\n---\n\n# Craft refactor\n\nMake code easier to understand and change while its observable behavior stays exactly the same. The claim of preserved behavior rests on the same tests passing before and after, run on known revisions.\n\nInputs: the target code, the intended improvement, the permitted scope, and the project's test commands.\n\n## Before you start\n\n- **Authority.** Loading this skill grants nothing. Ask before committing, installing, deleting, changing shared configuration, or editing outside the permitted scope, unless the request already allows it.\n- **Ownership.** If another workflow or a parent session owns the task, do only the refactor you were given, return the evidence below to that owner, and stop. Do not re-plan the task or launch children.\n- **Green baseline.** Run the tests that cover the target and record the result and revision. If anything fails, stop and report it. A refactor that starts red cannot show that behavior was preserved.\n- **Protection.** Check whether the tests would notice a change in the behavior you are about to touch. Where they would not, add characterization tests first. Characterization tests record what the code does now, including behavior that looks wrong. Note the odd behavior as a finding and keep it unchanged here.\n\n## What to look for\n\n- Names that hide intent, or that no longer match what the code does.\n- Units that mix responsibilities, such as parsing, deciding, and performing side effects in one place.\n- Coupling that forces unrelated code to change together, and data that travels further than it needs to.\n- Duplication. Before merging two similar pieces, ask whether they change for the same reason. Code that looks alike but serves different purposes should stay apart.\n- Mutable state shared more widely than necessary.\n- Error paths that are swallowed, inconsistent, or untested.\n- Dead code. Before removing it, confirm through search and tests that nothing reaches it, including reflection, configuration, or public API consumers.\n- Tests that are hard to read. See [test quality](references\u002Ftest-quality.md).\n\n## Making changes\n\n1. Change one thing at a time: a rename, an extraction, a move, an inlining.\n2. Run the relevant tests after every meaningful step. If something turns red, undo that step rather than debugging forward.\n3. Extract a unit only when it gets a name that describes one responsibility and it owns a coherent set of inputs. Do not split a function that already does one thing just to make it shorter or to lower a complexity score.\n4. Keep public interfaces stable unless the brief allows changing them. If one must change, update every caller in scope and say so.\n5. Do not edit test assertions during a refactor. If a test pinned private structure and must change, make that a separate, visible step and explain why the behavior it checks is unchanged.\n\nStop if you find a defect. Record it, keep the current behavior, and propose a separate test-first fix using [craft-tdd](..\u002Fcraft-tdd\u002FSKILL.md). A refactor that also fixes bugs cannot show that it preserved behavior.\n\nWhen the result adds, removes, or reverses a dependency between modules or layers, recommend a boundary review with [craft-architecture](..\u002Fcraft-architecture\u002FSKILL.md) and name the edges.\n\n## Report\n\nReturn only the fields that apply:\n\n- What was improved and why, with a before and after summary for each step.\n- The preserved-behavior evidence: the test commands, with the baseline and final results and the revision of each.\n- Any characterization tests you added, and the odd behaviors they recorded.\n- Suspected defects or behavior changes, left for a separate task.\n- Changed edges between modules, if any.\n- Anything blocked or skipped, and remaining risks.\n\nUse these outcome words: **pass** when a check ran and supports the claim, **fail** when it ran and contradicts the claim, **blocked\u002Fnot measured** when it could not run, and **skipped** when it was deliberately not run, with the reason. A skipped required check is not a pass.\n","# Craft refactor\n\nMake code easier to understand and change while its observable behavior stays exactly the same. The claim of preserved behavior rests on the same tests passing before and after, run on known revisions.\n\nInputs: the target code, the intended improvement, the permitted scope, and the project's test commands.\n\n## Before you start\n\n- **Authority.** Loading this skill grants nothing. Ask before committing, installing, deleting, changing shared configuration, or editing outside the permitted scope, unless the request already allows it.\n- **Ownership.** If another workflow or a parent session owns the task, do only the refactor you were given, return the evidence below to that owner, and stop. Do not re-plan the task or launch children.\n- **Green baseline.** Run the tests that cover the target and record the result and revision. If anything fails, stop and report it. A refactor that starts red cannot show that behavior was preserved.\n- **Protection.** Check whether the tests would notice a change in the behavior you are about to touch. Where they would not, add characterization tests first. Characterization tests record what the code does now, including behavior that looks wrong. Note the odd behavior as a finding and keep it unchanged here.\n\n## What to look for\n\n- Names that hide intent, or that no longer match what the code does.\n- Units that mix responsibilities, such as parsing, deciding, and performing side effects in one place.\n- Coupling that forces unrelated code to change together, and data that travels further than it needs to.\n- Duplication. Before merging two similar pieces, ask whether they change for the same reason. Code that looks alike but serves different purposes should stay apart.\n- Mutable state shared more widely than necessary.\n- Error paths that are swallowed, inconsistent, or untested.\n- Dead code. Before removing it, confirm through search and tests that nothing reaches it, including reflection, configuration, or public API consumers.\n- Tests that are hard to read. See [test quality](references\u002Ftest-quality.md).\n\n## Making changes\n\n1. Change one thing at a time: a rename, an extraction, a move, an inlining.\n2. Run the relevant tests after every meaningful step. If something turns red, undo that step rather than debugging forward.\n3. Extract a unit only when it gets a name that describes one responsibility and it owns a coherent set of inputs. Do not split a function that already does one thing just to make it shorter or to lower a complexity score.\n4. Keep public interfaces stable unless the brief allows changing them. If one must change, update every caller in scope and say so.\n5. Do not edit test assertions during a refactor. If a test pinned private structure and must change, make that a separate, visible step and explain why the behavior it checks is unchanged.\n\nStop if you find a defect. Record it, keep the current behavior, and propose a separate test-first fix using [craft-tdd](..\u002Fcraft-tdd\u002FSKILL.md). A refactor that also fixes bugs cannot show that it preserved behavior.\n\nWhen the result adds, removes, or reverses a dependency between modules or layers, recommend a boundary review with [craft-architecture](..\u002Fcraft-architecture\u002FSKILL.md) and name the edges.\n\n## Report\n\nReturn only the fields that apply:\n\n- What was improved and why, with a before and after summary for each step.\n- The preserved-behavior evidence: the test commands, with the baseline and final results and the revision of each.\n- Any characterization tests you added, and the odd behaviors they recorded.\n- Suspected defects or behavior changes, left for a separate task.\n- Changed edges between modules, if any.\n- Anything blocked or skipped, and remaining risks.\n\nUse these outcome words: **pass** when a check ran and supports the claim, **fail** when it ran and contradicts the claim, **blocked\u002Fnot measured** when it could not run, and **skipped** when it was deliberately not run, with the reason. A skipped required check is not a pass.\n",{"name":5,"description":7,"disable-model-invocation":24},true,"main","6b397836833902f4cf87dd008d22e067b1fb5e5d","skills\u002Fcraft-refactor",0,"https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj","giuseppecrj.com","Building agent infrastructure, protocol systems, and real-time product software.","2026-10-22 08:08:25",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":24},[36,39,42],{"tool":37,"command":38},"npx","npx skills add giuseppecrj\u002Fpi-herdr-clean-craft --skill craft-refactor",{"tool":40,"command":41},"bunx","bunx skills add giuseppecrj\u002Fpi-herdr-clean-craft --skill craft-refactor",{"tool":43,"command":44},"pnpm","pnpm dlx skills add giuseppecrj\u002Fpi-herdr-clean-craft --skill craft-refactor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Fskills\u002Fcraft-refactor\u002FSKILL.md",[47],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Ftest-quality.md","REFERENCE","参考文档",3138,"https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Fskills\u002Fcraft-refactor\u002Freferences\u002Ftest-quality.md",[54,61,67,73,80,87],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7EG78GE5QAW7DS3RZ090NHJ","missing-reference","Fixture whose instructions link a bundled file that does not exist.","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fmissing-reference\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7EG77BNMJ2DWZ3RZKPVNPE4","mismatched-name","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fmismatched-name\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7EG74NFKN3NEZHDE2HTH89J","malformed-frontmatter","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Ftest\u002Ffixtures\u002Fmalformed-frontmatter\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7EG70MFPZ297S2A3F5P2ANG","craft-tdd","Change behavior test-first. Write one focused test, confirm it fails for the predicted reason, make the smallest passing change, then tidy under green. Explicit invocation only. Says so plainly when a meaningful failing test could not be shown.","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Fskills\u002Fcraft-tdd\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":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7EG6RH49ER1RK9P1QS572R0","craft-quality","Assess code risk from qualified measurements such as complexity, coverage, and duplication, and disclose missing or stale data instead of filling gaps. Report-only by default. Explicit invocation only. No upstream analyzer is supported in this release.","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Fskills\u002Fcraft-quality\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},"01M7EG6MC27S09ENAGM1AR47Y8","craft-mutation","Check whether tests notice small seeded changes to the source, starting from a green baseline, then classify survivors, strengthen tests honestly, and verify the source is restored. Explicit invocation only.","https:\u002F\u002Fgithub.com\u002Fgiuseppecrj\u002Fpi-herdr-clean-craft\u002Fblob\u002Fmain\u002Fskills\u002Fcraft-mutation\u002FSKILL.md",[],[]]