[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C4J5V3NW0S5HCMASMDK9CZ":3,"skill-same:01M6C4J5V3NW0S5HCMASMDK9CZ":52},{"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":24,"linkOnly":25,"markdownContent":26,"markdownBody":27,"frontMatter":28,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":32,"repositoryHtmlUrl":33,"repositoryHomepageUrl":6,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":36,"updatedAt":37,"install":38,"resources":51},"01M6C4J5V3NW0S5HCMASMDK9CZ","principle-encode-lessons-in-structure",null,"WHEN a verified lesson recurs, the same failure or correction having happened at least twice; NOT for an unverified hypothesis, a single occurrence or a full recurrence investigation; chooses one narrow structural guard, or one instruction for a judgement-only lesson.","mintuz\u002Fskills","mintuz","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F447031?v=4","01M6BVWJYSVR4XQC9AQCEMWQRG","Adam Bulmer","01M6C4DCXKNYZB281YB3PZDJJG",35,"MIT","https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fprinciple\u002Fskills\u002Fprinciple-encode-lessons-in-structure\u002FSKILL.md",[],[19,20,21,22,23],"principle encode lessons in structure","hypothesis","investigation","guard","only","2026-11-10 10:12:30",false,"---\nname: principle-encode-lessons-in-structure\ndescription: \"WHEN a verified lesson recurs, the same failure or correction having happened at least twice; NOT for an unverified hypothesis, a single occurrence or a full recurrence investigation; chooses one narrow structural guard, or one instruction for a judgement-only lesson.\"\n---\n\n# Encode lessons in structure\n\nTurn a verified recurring lesson into one guard when the rule is mechanically decidable.\n\n1. Identify the concrete failure and the invariant that would exclude it. Use existing evidence; repeated wording alone does not prove a code defect. A lesson recurs once the same failure or correction has happened twice; fix a single occurrence directly and encode it when it repeats.\n2. Choose the smallest fitting owner: a domain type, constructor, metadata constraint, lint rule, runtime check or existing script. Show that the guard rejects a real past failure and that valid behaviour still passes.\n3. Keep one authoritative enforcement point. Remove redundant reminders only where the structural guard actually covers their meaning; retain necessary explanation of intent.\n4. When correctness needs judgement, keep one focused instruction at its existing owner with a concrete failure and successful example, plus a review criterion a reviewer can check. A noisy classifier is weaker than honest review.\n\nDistinct from: `principle-build-the-lever` (making repeated work a rerunnable tool for the task in hand), `principle-fix-root-causes` (repairing one reproducible defect), `principle-never-weaken-a-check` (a gate fails).\n\nDone: the guard rejects a real past failure and valid behaviour passes, or the judgement-only lesson has one clear instruction and review criterion at its owner. Broader investigation of recurring mistakes belongs to a separate correction workflow; this principle does not require one.\n","# Encode lessons in structure\n\nTurn a verified recurring lesson into one guard when the rule is mechanically decidable.\n\n1. Identify the concrete failure and the invariant that would exclude it. Use existing evidence; repeated wording alone does not prove a code defect. A lesson recurs once the same failure or correction has happened twice; fix a single occurrence directly and encode it when it repeats.\n2. Choose the smallest fitting owner: a domain type, constructor, metadata constraint, lint rule, runtime check or existing script. Show that the guard rejects a real past failure and that valid behaviour still passes.\n3. Keep one authoritative enforcement point. Remove redundant reminders only where the structural guard actually covers their meaning; retain necessary explanation of intent.\n4. When correctness needs judgement, keep one focused instruction at its existing owner with a concrete failure and successful example, plus a review criterion a reviewer can check. A noisy classifier is weaker than honest review.\n\nDistinct from: `principle-build-the-lever` (making repeated work a rerunnable tool for the task in hand), `principle-fix-root-causes` (repairing one reproducible defect), `principle-never-weaken-a-check` (a gate fails).\n\nDone: the guard rejects a real past failure and valid behaviour passes, or the judgement-only lesson has one clear instruction and review criterion at its owner. Broader investigation of recurring mistakes belongs to a separate correction workflow; this principle does not require one.\n",{"name":5,"description":7},"main","4e0a12b5048eac78a3ace4feee657873cdd530ef","src\u002Fprinciple\u002Fskills\u002Fprinciple-encode-lessons-in-structure",7,"https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills","https:\u002F\u002Fgithub.com\u002Fmintuz","http:\u002F\u002Fwww.mintuz.com","Working at @monzo, Previously worked at Moonpig, @booking and @bbc","2026-11-13 00:57:20",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add mintuz\u002Fskills --skill principle-encode-lessons-in-structure",{"tool":44,"command":45},"bunx","bunx skills add mintuz\u002Fskills --skill principle-encode-lessons-in-structure",{"tool":47,"command":48},"pnpm","pnpm dlx skills add mintuz\u002Fskills --skill principle-encode-lessons-in-structure","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fprinciple\u002Fskills\u002Fprinciple-encode-lessons-in-structure\u002FSKILL.md",true,[],[53,76,99,112,133,150],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":67,"publishedAt":24},"01M6C4PDGB6ZZWBS35N3DF7PZZ","xstate","WHEN React state changes in response to an external answer — async submit, in-flight or loading flags, retries, cancellation, polling, optimistic updates, stale responses — or to an interaction with an interruptible middle, such as a drag or a gesture; or WHEN building, reviewing, testing, or visualising XState 5 actors and @xstate\u002Freact integrations; NOT for a value one event sets completely, such as a text draft, a focus flag, or a plain open and closed toggle; models typed lifecycles and renders legal Mermaid stateDiagram-v2 charts.","https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fweb\u002Fskills\u002Fxstate\u002FSKILL.md",[59,64],{"categoryNo":60,"categoryName":61,"taxonomyType":62,"taxonomyTypeDesc":63},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",{"categoryNo":65,"categoryName":66,"taxonomyType":62,"taxonomyTypeDesc":63},"01JBSEEDCAT000000000000009","前端开发",[55,68,69,70,71,72,73,74,75],"react","text","state","integrations","Charts","mermaid","testing","open",{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":90,"publishedAt":24},"01M6C4PB6VVC2X19B63B7YNH0T","web-design","WHEN refining UI layout, typography, color, or polish; NOT code implementation; provides concise principles for intentional, legible design.","https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fweb\u002Fskills\u002Fweb-design\u002FSKILL.md",[82,87],{"categoryNo":83,"categoryName":84,"taxonomyType":85,"taxonomyTypeDesc":86},"01JBSEEDCAT000000000000032","设计师","PROFESSION","适用职业",{"categoryNo":88,"categoryName":89,"taxonomyType":62,"taxonomyTypeDesc":63},"01JBSEEDCAT000000000000015","视觉设计",[91,92,93,94,95,96,97,98],"web","design","web design","code implementation","polish","ui","typography","code",{"skillNo":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":106,"publishedAt":24},"01M6C4P8D92GJDA49V7X1CZXEV","tailwind","USE WHEN writing, fixing or reviewing styling in a project that uses Tailwind CSS, even a one-class change or a request that does not name Tailwind: colours, focus rings, spacing, class names chosen by a prop, map or CVA variants, theme tokens and dark mode in the Tailwind stylesheet or tailwind.config, setup or upgrades (if unsure whether the project uses Tailwind, check package.json or the main stylesheet first); NOT WHEN writing plain CSS or Sass in a project without Tailwind; produces class names Tailwind can find, syntax for the installed major version, visible focus indicators, and no unrequested dependency or invented brand value.","https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fweb\u002Fskills\u002Ftailwind\u002FSKILL.md",[105],{"categoryNo":88,"categoryName":89,"taxonomyType":62,"taxonomyTypeDesc":63},[107,108,109,110,92,111],"Tailwind","libraries","component","css","design systems",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":121,"publishedAt":24},"01M6C4P5VWQ69Q32DA0634GDJY","refactoring","WHEN you need a plan to refactor, restructure, or clean up working code and the test result is known, either green or a recorded failing set; NOT for new feature delivery or any behavior change; reversible-baseline safety with prioritized improvements.","https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fweb\u002Fskills\u002Frefactoring\u002FSKILL.md",[118],{"categoryNo":119,"categoryName":120,"taxonomyType":62,"taxonomyTypeDesc":63},"01JBSEEDCAT000000000000007","代码审查",[114,122,123,124,125,126,127,128,129,130,98,131,132],"Safety","baseline","refactor","behavior","change","plan","new feature","SET","up","feature delivery","test",{"skillNo":134,"name":68,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":140,"publishedAt":24},"01M6C4P345APEFEX00J8T7QMXQ","USE WHEN changing the logic, data, props, state, Effects or rendered text of a React component, hook or page, even a one-line change; NOT WHEN the request is styling only (class names, Tailwind, CSS, dark mode, spacing, shadows) or tests only, or when it models submit, in-flight, loading, retry or failure states, even for a named React form (xstate covers that, including its React wiring); applies React 19 composition, state, Effect, structure, API and performance rules with only the project's installed libraries.","https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fweb\u002Fskills\u002Freact\u002FSKILL.md",[138,139],{"categoryNo":60,"categoryName":61,"taxonomyType":62,"taxonomyTypeDesc":63},{"categoryNo":65,"categoryName":66,"taxonomyType":62,"taxonomyTypeDesc":63},[68,98,110,107,141,74,142,143,144,145,146,70,132,147,148,149],"performance","hooks","components","architecture","api","react components","state management","styling","management",{"skillNo":151,"name":152,"nameZh":6,"description":153,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":154,"categories":155,"keywords":158,"publishedAt":24},"01M6C4P0DK385QBG3B3S86TQV2","react-testing","USE WHEN writing, fixing or reviewing a React Testing Library test for a component, hook or context provider, even one small test, or when asked for an end-to-end journey inside a Vitest or React Testing Library suite; NOT WHEN changing the component itself (react), testing XState actors or @xstate\u002Freact (xstate), or writing a Playwright or Cypress test; covers renderHook, providers, async results, forms and false-pass anti-patterns, and declines end-to-end journeys with the testable slices.","https:\u002F\u002Fgithub.com\u002Fmintuz\u002Fskills\u002Fblob\u002Fmain\u002Fsrc\u002Fweb\u002Fskills\u002Freact-testing\u002FSKILL.md",[156,157],{"categoryNo":60,"categoryName":61,"taxonomyType":62,"taxonomyTypeDesc":63},{"categoryNo":65,"categoryName":66,"taxonomyType":62,"taxonomyTypeDesc":63},[159,74,68,160,142,161,162,163,143,164,165,146],"react testing","anti-patterns","e2e","library","testing library","Providers","context"]