[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6X73DHA90BPMNN4KN1PMBCP":3,"skill-same:01M6X73DHA90BPMNN4KN1PMBCP":87},{"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":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":58,"commitSha":59,"skillDirectory":60,"forksCount":61,"repositoryHtmlUrl":62,"repositoryHomepageUrl":63,"ownerHtmlUrl":64,"ownerBlogUrl":63,"ownerDescription":65,"updatedAt":66,"install":67,"resources":80},"01M6X73DHA90BPMNN4KN1PMBCP","learning-to-rule-or-skill",null,"Use when a repeated learning, mistake, or successful pattern should be turned into a new rule or skill. Also use after completing a task to capture learnings from the work.","event4u-app\u002Fagent-config","event4u-app","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F199339632?v=4","01M6X5TWBNCQCE1VDKT4E9KF7N","event4u.app","01M6X5TWF4HRM266RG2Q5VVH1X",19,"MIT","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Flearning-to-rule-or-skill\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"learning to rule or skill","learning","rule","pattern","new","when","prove","handler","subprocess","can","scope","project","config","learnings","never","use","command","work","execution","Tools","Meta","2026-11-10 10:12:30",false,"---\nmodel_tier: inherit\nname: learning-to-rule-or-skill\ndescription: \"Use when a repeated learning, mistake, or successful pattern should be turned into a new rule or skill. Also use after completing a task to capture learnings from the work.\"\nsource: project\ndomain: process\nscope:\n  write: []\n  verification_reason: \"execution.handler is internal, so this skill spawns no subprocess — writes happen through the agent's declared allowed_tools. No command can prove a scope the skill never executes.\"\nexecution:\n  type: assisted\n  handler: internal\n  allowed_tools: []\nworkspaces:\n  - agent-config-maintainer\npacks:\n  - meta\n---\n\n# learning-to-rule-or-skill\n\n## When to use\n\nUse this skill when:\n\n* A repeated mistake appears across multiple tasks\n* A successful pattern should be reused in the future\n* A new constraint or workflow should be captured permanently\n* Reviewing post-task learnings or retrospectives\n* Deciding whether a learning belongs in a rule or a skill\n* After completing a task — reflecting on what worked or caused friction\n* Mining the audit log (`agents\u002Fruntime\u002Fstate\u002Faudit\u002F\u003CYYYY-MM>.jsonl`,\n  [`audit-log-v1`](..\u002F..\u002F..\u002Fdocs\u002Fcontracts\u002Faudit-log-v1.md)) surfaced\n  a repeated phase pattern via\n  [`extract_audit_patterns.ts`](..\u002F..\u002Fscripts\u002Fextract_audit_patterns.ts)\n  — the pattern's `count` ≥ 2 already satisfies the repetition gate\n* A comparative analysis handed over a **`### SEED —` block** from its\n  `## Seeds` section ([`\u002Fanalyze:reference`](..\u002F..\u002Fagent-src\u002Fcommands\u002Fanalyze\u002Freference.md)\n  § 6). An accepted intake shape: the block carries name, kind, target\n  template, one-line description and the `Extends instead?` answer, so step 4's\n  overlap search starts from a stated candidate — it does **not** skip that\n  search, and a seed missing its `Extends instead?` line is incomplete intake,\n  not a shortcut. The repetition gate is met by the anchored ADOPT\u002FADAPT verdict\n  behind the seed, not a recurrence count — a mechanism confirmed once against a\n  named own-repo defect is not the one-off case the gate filters.\n\nDo not use this skill when:\n\n* The learning is one-off and unlikely to repeat\n* The issue is too vague to turn into guidance\n* The content already exists in an equivalent rule or skill\n\n## Goal\n\n* Turn repeated learnings into reusable project guidance\n* Decide correctly between rule, skill, or update to an existing one\n* Prevent the same mistakes from happening again\n* Keep the system small, clear, and non-duplicative\n\n## Preconditions\n\n* A concrete learning, mistake, or successful pattern exists\n* The learning can be stated in one or two sentences\n* Existing rules and skills can be checked for overlap\n\n## Decision matrix\n\n| If the learning is... | Then... | Action |\n|---|---|---|\n| A consumer convention a config or check can carry (formatter, linter, CI step) | **Config \u002F check** | Propose the config diff; never encode it as a rule |\n| An always-true constraint (\"never X\", \"always Y\") | **Rule** | Create\u002Fupdate rule |\n| A repeatable workflow with steps and validation | **Skill** | Create\u002Fupdate skill |\n| A coding convention or reference material | **Guideline** | Create\u002Fupdate guideline |\n| A reusable **fix\u002Frefactor recipe** for a specific problem (problem → before → after → verification) | **Pattern** | Create\u002Fupdate `src\u002Fpatterns\u002F\u003Cslug>.md` (see [`src\u002Fpatterns\u002FREADME.md`](..\u002F..\u002Fpatterns\u002FREADME.md)) |\n| Baseline model knowledge or standard tool usage | **Nothing** | Do not create anything |\n| A refinement of existing guidance | **Update** | Extend the existing file |\n\n### Decision hints\n\n* Same issue appeared at least twice → strongly consider codifying\n* One-off or too narrow → do not create anything yet\n* Standard tool knowledge (jq, docker, git basics) → **Nothing** — the model knows it\n* If unsure between skill and guideline: does it need step-by-step decisions? → Skill. Just conventions? → Guideline\n* If unsure between guideline and pattern: is it *\"how to write code in X\"* (prose convention)? → Guideline. Is it *\"I have problem P — here's the proven recipe + a verification step + how reliable it is\"*? → **Pattern**\n* When a related workflow fires, **surface** a matching `src\u002Fpatterns\u002F` recipe (never auto-apply) — the human decides\n* Learning from a landed commit → `git show \u003Csha>`: diff is evidence, message is intent; one commit never passes Repetition; `source_learning: \u003Csha>`\n\n## Procedure\n\n### 0. Promotion Gate (mandatory)\n\nBefore proceeding, the learning MUST pass all gates:\n\n| Gate | Question |\n|---|---|\n| Repetition | Occurred 2+ times OR clearly generalizable? |\n| Impact | Improves correctness, reliability, or consistency? |\n| Failure pattern | Prevents a real, observed failure? |\n| Non-duplication | No existing rule\u002Fskill\u002Fguideline\u002Fcommand covers this? **Verify via § 4 search protocol — a negative grep alone is not proof.** |\n| Scope fit | Fits rule, skill, or guideline? |\n| Minimal | Update existing preferred over creation? |\n| Weakens its own judge (passes only on **no**) | Does the change weaken anything that judges it — a test, a gate, a threshold, this review? The standard is quoted rather than paraphrased: the implementer never silently weakens an assertion, deletes, skips or xfails a failing test, lowers a threshold, or changes fixture semantics to fit the code. Does this change do any of those? |\n\nIf ANY gate fails → **stop**. Do not create or update anything.\nMemory-entry rejection criteria live in `\u002Fmemory:add` (see § \"When to skip\").\n\n### 1. State the learning clearly\n\nWrite as a concrete sentence.\n\nGood:\n* Nested triple backticks break copyability in generated markdown\n* Route inspection is more reliable via JSON and jq than text parsing\n\nBad:\n* Markdown is annoying\n* Routing was confusing\n\n### 2. Identify the pattern type\n\nClassify by type:\n* Constraint\n* Workflow\n* Anti-pattern\n* Quality check\n* Environment-specific convention\n\nTag with feedback category (for tracking\u002Faggregation):\n* `skill-weakness` — skill gave wrong or incomplete guidance\n* `rule-weakness` — rule was too vague or missed a case\n* `routing-issue` — wrong skill was selected\n* `assumption-issue` — agent made bad assumptions\n* `verification-gap` — verification step was missing or weak\n* `optimization-overreach` — optimize command suggested harmful change\n\n### 3. Decide the target\n\nChoose one:\n* New rule (always-true constraint)\n* Update existing rule\n* New skill (step-by-step workflow)\n* Update existing skill\n* New guideline (coding convention \u002F reference)\n* Update existing guideline\n* **Nothing** (baseline knowledge, standard tool usage, one-off)\n\n### 4. Check for overlap — search protocol (mandatory)\n\nA zero-hit grep is **not** proof of no overlap. Knowledge here spans **five\nsurfaces** — `skills\u002F`, `rules\u002F`, `docs\u002Fguidelines\u002F`, `commands\u002F`,\n`src\u002Fpatterns\u002F`; skip one and recall drops. Run all steps before declaring \"no\noverlap\":\n\n**Step 1 — list all five surfaces.** Directory taxonomy is free evidence:\n\n```bash\nls src\u002Fskills\u002F \\\n   src\u002Frules\u002F \\\n   docs\u002Fguidelines\u002F \\\n   dist\u002Fagent-src\u002Fcommands\u002F \\\n   src\u002Fpatterns\u002F\n```\n\nSub-directories (`docs\u002Fguidelines\u002Fphp\u002Fpatterns\u002F`, `docs\u002Fguidelines\u002Fagent-infra\u002F`,\n…) carry taxonomies a flat scan misses. Always descend one level.\n\n**Step 2 — grep with both vocabularies.** Search **solution-words** *and*\n**problem-words**. Solution-only grep is confirmation bias — the existing\nartifact may name the *symptom*, not the cure.\n\n| Vocabulary | Example for \"agents miss Strategy pattern, write switch chains\" |\n|---|---|\n| Solution-words | `strategy`, `registry`, `polymorph`, `interface` |\n| Problem-words | `discriminator`, `enum.*match`, `switch.*on`, `if.*else.*chain` |\n\n```bash\ngrep -rl -E \"\u003Csolution-words>|\u003Cproblem-words>\" src\u002F docs\u002Fguidelines\u002F\n```\n\n**Step 3 — taxonomy scan.** For a topic with a likely sub-folder\n(`patterns\u002F`, `php\u002F`, `laravel\u002F`, `agent-infra\u002F`), `ls` that folder\n*before* reading any file. The filename often answers the overlap question.\n\n**Step 4 — sample, do not just list.** On *any* keyword overlap from\nsteps 2–3, **open and skim the 3 nearest matches** — § headings, the\n\"When to use\" \u002F \"Overview\" block, the examples. Filenames are not enough;\nsemantic overlap hides behind unrelated keywords.\n\nOnly after all four steps return clean → declare \"no overlap\", proceed.\nCite in the proposal: *\"Reviewed before drafting: \u003Cfiles skimmed>\"* —\nthe audit trail § 0's Non-duplication gate verifies against.\n\n→ When the parent task is \"create a new artifact\", `artifact-drafting-protocol`\nPhase B (Research) requires this same protocol — single source of truth.\n\n### 5. Draft the content\n\nIf rule:\n* Short, durable constraint\n* General, clear, always applicable\n\nIf skill:\n* Focused workflow\n* Include: When to use, Procedure, Output format, Gotchas, Do NOT\n\n### 6. Validate usefulness\n\n* Will this improve future outputs?\n* Specific enough to act on?\n* Different from existing guidance?\n* Likely to matter more than once?\n\n### 7. Keep only the smallest effective change\n\nPrefer:\n* Update over duplicate\n* Small focused skill over broad skill\n* Short rule over long rule\n\n### 8. Write the proposal (if scope ≠ nothing)\n\nThe output of this skill is a **curated proposal** under\n`agents\u002Fproposals\u002F\u003Cproposal_id>.md`, using the template at\n`.augment\u002Ftemplates\u002Fagents\u002Fproposal.example.md` (shipped by the\npackage). This is the input to the five-stage pipeline\n(capture → classify → propose → gate → upstream); see\n[`self-improvement-pipeline`](..\u002F..\u002F..\u002Fdocs\u002Fguidelines\u002Fagent-infra\u002Fself-improvement-pipeline.md).\n\nMandatory fields the draft MUST fill:\n\n* `proposal_id` — stable kebab-case slug, unique in this repo\n* `type` — `rule` | `skill` | `command` | `guideline`\n* `scope` — `project` (stays in `agents\u002Foverrides\u002F`) or `package`\n  (contributed upstream via `upstream-contribute`)\n* `source_learning` — the capturing intake signal, as\n  `agents\u002Fmemory\u002Fintake\u002Fsignals-\u003CYYYY-MM>.jsonl#\u003Cid>`\n* `evidence` — **at least two independent** references (PR, issue,\n  incident, review-comment, test-failure, **or audit-log line ids**\n  per [`audit-log-v1`](..\u002F..\u002F..\u002Fdocs\u002Fcontracts\u002Faudit-log-v1.md));\n  entries that all resolve to the same PR or the same audit-log\n  `run_id` are rejected by the gate (independence floor)\n* `Proposed artefact` (§4) — the full draft body, no `TODO` \u002F `TBD`\n* `Success signal` (§7) — one metric, one baseline, one target, one\n  evaluation date\n\nRun `.\u002Fagent-config proposal:check agents\u002Fproposals\u002F\u003Cid>.md`\nbefore handing to `upstream-contribute`. The\ngate is hard: non-zero exit = the proposal does not move\nto stage `gated`.\n\n### 9. Degrade the source to a pointer (when promoted from a knowledge page)\n\nIf the learning came from an `agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md`\nentry or any other `agents\u002Fknowledge\u002F` page (§ \"Knowledge-candidate\nlearnings\" below), promotion is **not complete** until the source is\ndegraded to a pointer — preventing double-maintenance between page and\nartifact:\n\n```bash\n.\u002Fscripts-run src\u002Fscripts\u002Fdegrade_to_pointer \\\n    --source \"agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md#\u003Ctopic>\" \\\n    --artifact \"\u003Cpromoted-artifact-path>\" \\\n    --date \"\u003CYYYY-MM-DD>\"\n```\n\nThis rewrites the source entry to `Promoted to \u003Cartifact> on \u003Cdate>; see\n\u003Cpath>.` and regenerates `agents\u002Fknowledge\u002FINDEX.md`. Skip it only when\nthe source was NOT a knowledge page (a direct user request, an audit-log\npattern, a one-off observation).\n\n## Output format\n\nFor the **decision step** (what this skill prints to the user):\n\n1. Learning summary\n2. Decision: rule, skill, update, or no action\n3. Rationale in one to three lines\n4. If decision ≠ \"no action\": path of the written proposal\n   (`agents\u002Fproposals\u002F\u003Cproposal_id>.md`) and gate status\n   (`.\u002Fagent-config proposal:check` exit 0 = ready for review)\n\nThe **proposal file itself** follows\n`proposal.example.md` verbatim — all ten sections, YAML frontmatter\ncomplete, draft body in §4.\n\n## Core rules\n\n* Capture repeated patterns, not random observations\n* Prefer updating existing guidance over creating duplicates\n* Rules are for durable constraints\n* Skills are for repeatable workflows\n* Keep new guidance as small and focused as possible\n\n## Gotchas\n\n* Model tends to create new files when a small update is enough\n* Model tends to turn vague frustrations into bad guidance\n* Model may write documentation instead of reusable instructions\n* Over-capturing weak learnings creates noise and reduces quality\n\n## Do NOT\n\n* Do NOT create a rule or skill for one-off problems\n* Do NOT duplicate existing guidance\n* Do NOT create broad \"catch-all\" skills\n* Do NOT write vague learnings without a concrete behavioral consequence\n\n## Auto-trigger keywords\n\n* learning\n* retrospective\n* repeated mistake\n* recurring issue\n* create rule from learning\n* create skill from learning\n* codify this\n* capture this pattern\n* after task\n* what did we learn\n* post-mortem\n* learn from this commit\n\n## Anti-patterns\n\n* Creating a skill for every minor annoyance\n* Rule that says \"be careful\" without concrete constraint\n* Skill that duplicates an existing one with slightly different wording\n* Capturing a learning before it has repeated\n\n## Examples\n\nLearning: \"Nested triple backticks broke markdown copyability twice this week.\"\nDecision: Update existing markdown rule + add markdown-safe skill if none exists.\n\nLearning: \"Route checks keep failing when done via text parsing.\"\nDecision: Create focused skill for Laravel route inspection via JSON and jq.\n\nLearning: \"I forgot to run PHPStan once.\"\nDecision: No action — one-off, already covered by verify-before-complete rule.\n\nLearning: \"We re-invented a per-format PDF extractor in three different\nanalysis skills.\"\nDecision: Update the affected skills to dispatch to\n[`markitdown`](..\u002Fmarkitdown\u002FSKILL.md) instead of writing new\nextractors. Non-text ingestion (PDF \u002F DOCX \u002F XLSX \u002F PPTX \u002F image \u002F\naudio) goes through the upstream `markitdown-mcp` server first; only\nwrite a custom extractor if `markitdown` cannot handle the format and\nthe gap is documented in its skill body.\n\n## Audit-derived learnings (optional source)\n\nWhen the input is a pattern surfaced by\n[`extract_audit_patterns.ts`](..\u002F..\u002Fscripts\u002Fextract_audit_patterns.ts)\nmining `agents\u002Fruntime\u002Fstate\u002Faudit\u002F\u003CYYYY-MM>.jsonl`\n([`audit-log-v1`](..\u002F..\u002F..\u002Fdocs\u002Fcontracts\u002Faudit-log-v1.md)):\n\n1. Treat the script's pattern record as the **State the learning**\n   step input (§1) — `pattern.summary` is the one-sentence\n   statement, `pattern.line_ids` is the evidence.\n2. The repetition gate is already satisfied for `count ≥ 2`. Skip\n   to §3 (decide the target) — overlap check (§4) and proposal\n   draft (§8) remain mandatory.\n3. Independence floor still applies: two line ids from the same\n   `run_id` count as **one** piece of evidence. The mining script\n   already de-duplicates by `run_id`; the gate trusts that output.\n4. Audit-derived proposals MUST set\n   `source_learning: agents\u002Fruntime\u002Fstate\u002Faudit\u002F\u003CYYYY-MM>.jsonl#\u003Cline_ids>`\n   and link the mining-script run id, so the human reviewer can\n   reproduce the pattern from the raw audit log.\n\n## Knowledge-candidate learnings (optional source)\n\nWhen the input is an entry from `agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md`\nthat reached candidate status (≥ 3 mentions across distinct sessions —\nsee `update_skill_candidates.ts` and the\n[`memory-consolidation`](..\u002Fmemory-consolidation\u002FSKILL.md) recurrence\nstep):\n\n1. Treat the candidate's topic as the **State the learning** step\n   input (§1). The repetition gate (§0) is already satisfied by the\n   ≥ 3-mention threshold — skip straight to §3 (decide the target).\n   Overlap check (§4) and proposal draft (§8) remain mandatory.\n2. **Ground the draft in the original session logs, never the\n   consolidated summary alone.** The entry's `Sessions:` list names\n   the session ids the topic recurred in — read them in the host's\n   transcript view, or reconstruct them from the retained continuity\n   records, before drafting. A skill written from the counter summary\n   alone tends to be plausible but wrong; the transcripts carry the\n   detail the summary dropped.\n3. Set `source_learning` to the knowledge-candidate entry\n   (`agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md#\u003Ctopic>`).\n4. **§9 (degrade the source) is mandatory for this source type** —\n   the whole point of the candidate counter is that it stops counting\n   once promoted.\n\n## Environment notes\n\nPrefer updating existing rule\u002Fskill when possible.\nCreate new files only when the learning introduces a clearly distinct pattern.\n","# learning-to-rule-or-skill\n\n## When to use\n\nUse this skill when:\n\n* A repeated mistake appears across multiple tasks\n* A successful pattern should be reused in the future\n* A new constraint or workflow should be captured permanently\n* Reviewing post-task learnings or retrospectives\n* Deciding whether a learning belongs in a rule or a skill\n* After completing a task — reflecting on what worked or caused friction\n* Mining the audit log (`agents\u002Fruntime\u002Fstate\u002Faudit\u002F\u003CYYYY-MM>.jsonl`,\n  [`audit-log-v1`](..\u002F..\u002F..\u002Fdocs\u002Fcontracts\u002Faudit-log-v1.md)) surfaced\n  a repeated phase pattern via\n  [`extract_audit_patterns.ts`](..\u002F..\u002Fscripts\u002Fextract_audit_patterns.ts)\n  — the pattern's `count` ≥ 2 already satisfies the repetition gate\n* A comparative analysis handed over a **`### SEED —` block** from its\n  `## Seeds` section ([`\u002Fanalyze:reference`](..\u002F..\u002Fagent-src\u002Fcommands\u002Fanalyze\u002Freference.md)\n  § 6). An accepted intake shape: the block carries name, kind, target\n  template, one-line description and the `Extends instead?` answer, so step 4's\n  overlap search starts from a stated candidate — it does **not** skip that\n  search, and a seed missing its `Extends instead?` line is incomplete intake,\n  not a shortcut. The repetition gate is met by the anchored ADOPT\u002FADAPT verdict\n  behind the seed, not a recurrence count — a mechanism confirmed once against a\n  named own-repo defect is not the one-off case the gate filters.\n\nDo not use this skill when:\n\n* The learning is one-off and unlikely to repeat\n* The issue is too vague to turn into guidance\n* The content already exists in an equivalent rule or skill\n\n## Goal\n\n* Turn repeated learnings into reusable project guidance\n* Decide correctly between rule, skill, or update to an existing one\n* Prevent the same mistakes from happening again\n* Keep the system small, clear, and non-duplicative\n\n## Preconditions\n\n* A concrete learning, mistake, or successful pattern exists\n* The learning can be stated in one or two sentences\n* Existing rules and skills can be checked for overlap\n\n## Decision matrix\n\n| If the learning is... | Then... | Action |\n|---|---|---|\n| A consumer convention a config or check can carry (formatter, linter, CI step) | **Config \u002F check** | Propose the config diff; never encode it as a rule |\n| An always-true constraint (\"never X\", \"always Y\") | **Rule** | Create\u002Fupdate rule |\n| A repeatable workflow with steps and validation | **Skill** | Create\u002Fupdate skill |\n| A coding convention or reference material | **Guideline** | Create\u002Fupdate guideline |\n| A reusable **fix\u002Frefactor recipe** for a specific problem (problem → before → after → verification) | **Pattern** | Create\u002Fupdate `src\u002Fpatterns\u002F\u003Cslug>.md` (see [`src\u002Fpatterns\u002FREADME.md`](..\u002F..\u002Fpatterns\u002FREADME.md)) |\n| Baseline model knowledge or standard tool usage | **Nothing** | Do not create anything |\n| A refinement of existing guidance | **Update** | Extend the existing file |\n\n### Decision hints\n\n* Same issue appeared at least twice → strongly consider codifying\n* One-off or too narrow → do not create anything yet\n* Standard tool knowledge (jq, docker, git basics) → **Nothing** — the model knows it\n* If unsure between skill and guideline: does it need step-by-step decisions? → Skill. Just conventions? → Guideline\n* If unsure between guideline and pattern: is it *\"how to write code in X\"* (prose convention)? → Guideline. Is it *\"I have problem P — here's the proven recipe + a verification step + how reliable it is\"*? → **Pattern**\n* When a related workflow fires, **surface** a matching `src\u002Fpatterns\u002F` recipe (never auto-apply) — the human decides\n* Learning from a landed commit → `git show \u003Csha>`: diff is evidence, message is intent; one commit never passes Repetition; `source_learning: \u003Csha>`\n\n## Procedure\n\n### 0. Promotion Gate (mandatory)\n\nBefore proceeding, the learning MUST pass all gates:\n\n| Gate | Question |\n|---|---|\n| Repetition | Occurred 2+ times OR clearly generalizable? |\n| Impact | Improves correctness, reliability, or consistency? |\n| Failure pattern | Prevents a real, observed failure? |\n| Non-duplication | No existing rule\u002Fskill\u002Fguideline\u002Fcommand covers this? **Verify via § 4 search protocol — a negative grep alone is not proof.** |\n| Scope fit | Fits rule, skill, or guideline? |\n| Minimal | Update existing preferred over creation? |\n| Weakens its own judge (passes only on **no**) | Does the change weaken anything that judges it — a test, a gate, a threshold, this review? The standard is quoted rather than paraphrased: the implementer never silently weakens an assertion, deletes, skips or xfails a failing test, lowers a threshold, or changes fixture semantics to fit the code. Does this change do any of those? |\n\nIf ANY gate fails → **stop**. Do not create or update anything.\nMemory-entry rejection criteria live in `\u002Fmemory:add` (see § \"When to skip\").\n\n### 1. State the learning clearly\n\nWrite as a concrete sentence.\n\nGood:\n* Nested triple backticks break copyability in generated markdown\n* Route inspection is more reliable via JSON and jq than text parsing\n\nBad:\n* Markdown is annoying\n* Routing was confusing\n\n### 2. Identify the pattern type\n\nClassify by type:\n* Constraint\n* Workflow\n* Anti-pattern\n* Quality check\n* Environment-specific convention\n\nTag with feedback category (for tracking\u002Faggregation):\n* `skill-weakness` — skill gave wrong or incomplete guidance\n* `rule-weakness` — rule was too vague or missed a case\n* `routing-issue` — wrong skill was selected\n* `assumption-issue` — agent made bad assumptions\n* `verification-gap` — verification step was missing or weak\n* `optimization-overreach` — optimize command suggested harmful change\n\n### 3. Decide the target\n\nChoose one:\n* New rule (always-true constraint)\n* Update existing rule\n* New skill (step-by-step workflow)\n* Update existing skill\n* New guideline (coding convention \u002F reference)\n* Update existing guideline\n* **Nothing** (baseline knowledge, standard tool usage, one-off)\n\n### 4. Check for overlap — search protocol (mandatory)\n\nA zero-hit grep is **not** proof of no overlap. Knowledge here spans **five\nsurfaces** — `skills\u002F`, `rules\u002F`, `docs\u002Fguidelines\u002F`, `commands\u002F`,\n`src\u002Fpatterns\u002F`; skip one and recall drops. Run all steps before declaring \"no\noverlap\":\n\n**Step 1 — list all five surfaces.** Directory taxonomy is free evidence:\n\n```bash\nls src\u002Fskills\u002F \\\n   src\u002Frules\u002F \\\n   docs\u002Fguidelines\u002F \\\n   dist\u002Fagent-src\u002Fcommands\u002F \\\n   src\u002Fpatterns\u002F\n```\n\nSub-directories (`docs\u002Fguidelines\u002Fphp\u002Fpatterns\u002F`, `docs\u002Fguidelines\u002Fagent-infra\u002F`,\n…) carry taxonomies a flat scan misses. Always descend one level.\n\n**Step 2 — grep with both vocabularies.** Search **solution-words** *and*\n**problem-words**. Solution-only grep is confirmation bias — the existing\nartifact may name the *symptom*, not the cure.\n\n| Vocabulary | Example for \"agents miss Strategy pattern, write switch chains\" |\n|---|---|\n| Solution-words | `strategy`, `registry`, `polymorph`, `interface` |\n| Problem-words | `discriminator`, `enum.*match`, `switch.*on`, `if.*else.*chain` |\n\n```bash\ngrep -rl -E \"\u003Csolution-words>|\u003Cproblem-words>\" src\u002F docs\u002Fguidelines\u002F\n```\n\n**Step 3 — taxonomy scan.** For a topic with a likely sub-folder\n(`patterns\u002F`, `php\u002F`, `laravel\u002F`, `agent-infra\u002F`), `ls` that folder\n*before* reading any file. The filename often answers the overlap question.\n\n**Step 4 — sample, do not just list.** On *any* keyword overlap from\nsteps 2–3, **open and skim the 3 nearest matches** — § headings, the\n\"When to use\" \u002F \"Overview\" block, the examples. Filenames are not enough;\nsemantic overlap hides behind unrelated keywords.\n\nOnly after all four steps return clean → declare \"no overlap\", proceed.\nCite in the proposal: *\"Reviewed before drafting: \u003Cfiles skimmed>\"* —\nthe audit trail § 0's Non-duplication gate verifies against.\n\n→ When the parent task is \"create a new artifact\", `artifact-drafting-protocol`\nPhase B (Research) requires this same protocol — single source of truth.\n\n### 5. Draft the content\n\nIf rule:\n* Short, durable constraint\n* General, clear, always applicable\n\nIf skill:\n* Focused workflow\n* Include: When to use, Procedure, Output format, Gotchas, Do NOT\n\n### 6. Validate usefulness\n\n* Will this improve future outputs?\n* Specific enough to act on?\n* Different from existing guidance?\n* Likely to matter more than once?\n\n### 7. Keep only the smallest effective change\n\nPrefer:\n* Update over duplicate\n* Small focused skill over broad skill\n* Short rule over long rule\n\n### 8. Write the proposal (if scope ≠ nothing)\n\nThe output of this skill is a **curated proposal** under\n`agents\u002Fproposals\u002F\u003Cproposal_id>.md`, using the template at\n`.augment\u002Ftemplates\u002Fagents\u002Fproposal.example.md` (shipped by the\npackage). This is the input to the five-stage pipeline\n(capture → classify → propose → gate → upstream); see\n[`self-improvement-pipeline`](..\u002F..\u002F..\u002Fdocs\u002Fguidelines\u002Fagent-infra\u002Fself-improvement-pipeline.md).\n\nMandatory fields the draft MUST fill:\n\n* `proposal_id` — stable kebab-case slug, unique in this repo\n* `type` — `rule` | `skill` | `command` | `guideline`\n* `scope` — `project` (stays in `agents\u002Foverrides\u002F`) or `package`\n  (contributed upstream via `upstream-contribute`)\n* `source_learning` — the capturing intake signal, as\n  `agents\u002Fmemory\u002Fintake\u002Fsignals-\u003CYYYY-MM>.jsonl#\u003Cid>`\n* `evidence` — **at least two independent** references (PR, issue,\n  incident, review-comment, test-failure, **or audit-log line ids**\n  per [`audit-log-v1`](..\u002F..\u002F..\u002Fdocs\u002Fcontracts\u002Faudit-log-v1.md));\n  entries that all resolve to the same PR or the same audit-log\n  `run_id` are rejected by the gate (independence floor)\n* `Proposed artefact` (§4) — the full draft body, no `TODO` \u002F `TBD`\n* `Success signal` (§7) — one metric, one baseline, one target, one\n  evaluation date\n\nRun `.\u002Fagent-config proposal:check agents\u002Fproposals\u002F\u003Cid>.md`\nbefore handing to `upstream-contribute`. The\ngate is hard: non-zero exit = the proposal does not move\nto stage `gated`.\n\n### 9. Degrade the source to a pointer (when promoted from a knowledge page)\n\nIf the learning came from an `agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md`\nentry or any other `agents\u002Fknowledge\u002F` page (§ \"Knowledge-candidate\nlearnings\" below), promotion is **not complete** until the source is\ndegraded to a pointer — preventing double-maintenance between page and\nartifact:\n\n```bash\n.\u002Fscripts-run src\u002Fscripts\u002Fdegrade_to_pointer \\\n    --source \"agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md#\u003Ctopic>\" \\\n    --artifact \"\u003Cpromoted-artifact-path>\" \\\n    --date \"\u003CYYYY-MM-DD>\"\n```\n\nThis rewrites the source entry to `Promoted to \u003Cartifact> on \u003Cdate>; see\n\u003Cpath>.` and regenerates `agents\u002Fknowledge\u002FINDEX.md`. Skip it only when\nthe source was NOT a knowledge page (a direct user request, an audit-log\npattern, a one-off observation).\n\n## Output format\n\nFor the **decision step** (what this skill prints to the user):\n\n1. Learning summary\n2. Decision: rule, skill, update, or no action\n3. Rationale in one to three lines\n4. If decision ≠ \"no action\": path of the written proposal\n   (`agents\u002Fproposals\u002F\u003Cproposal_id>.md`) and gate status\n   (`.\u002Fagent-config proposal:check` exit 0 = ready for review)\n\nThe **proposal file itself** follows\n`proposal.example.md` verbatim — all ten sections, YAML frontmatter\ncomplete, draft body in §4.\n\n## Core rules\n\n* Capture repeated patterns, not random observations\n* Prefer updating existing guidance over creating duplicates\n* Rules are for durable constraints\n* Skills are for repeatable workflows\n* Keep new guidance as small and focused as possible\n\n## Gotchas\n\n* Model tends to create new files when a small update is enough\n* Model tends to turn vague frustrations into bad guidance\n* Model may write documentation instead of reusable instructions\n* Over-capturing weak learnings creates noise and reduces quality\n\n## Do NOT\n\n* Do NOT create a rule or skill for one-off problems\n* Do NOT duplicate existing guidance\n* Do NOT create broad \"catch-all\" skills\n* Do NOT write vague learnings without a concrete behavioral consequence\n\n## Auto-trigger keywords\n\n* learning\n* retrospective\n* repeated mistake\n* recurring issue\n* create rule from learning\n* create skill from learning\n* codify this\n* capture this pattern\n* after task\n* what did we learn\n* post-mortem\n* learn from this commit\n\n## Anti-patterns\n\n* Creating a skill for every minor annoyance\n* Rule that says \"be careful\" without concrete constraint\n* Skill that duplicates an existing one with slightly different wording\n* Capturing a learning before it has repeated\n\n## Examples\n\nLearning: \"Nested triple backticks broke markdown copyability twice this week.\"\nDecision: Update existing markdown rule + add markdown-safe skill if none exists.\n\nLearning: \"Route checks keep failing when done via text parsing.\"\nDecision: Create focused skill for Laravel route inspection via JSON and jq.\n\nLearning: \"I forgot to run PHPStan once.\"\nDecision: No action — one-off, already covered by verify-before-complete rule.\n\nLearning: \"We re-invented a per-format PDF extractor in three different\nanalysis skills.\"\nDecision: Update the affected skills to dispatch to\n[`markitdown`](..\u002Fmarkitdown\u002FSKILL.md) instead of writing new\nextractors. Non-text ingestion (PDF \u002F DOCX \u002F XLSX \u002F PPTX \u002F image \u002F\naudio) goes through the upstream `markitdown-mcp` server first; only\nwrite a custom extractor if `markitdown` cannot handle the format and\nthe gap is documented in its skill body.\n\n## Audit-derived learnings (optional source)\n\nWhen the input is a pattern surfaced by\n[`extract_audit_patterns.ts`](..\u002F..\u002Fscripts\u002Fextract_audit_patterns.ts)\nmining `agents\u002Fruntime\u002Fstate\u002Faudit\u002F\u003CYYYY-MM>.jsonl`\n([`audit-log-v1`](..\u002F..\u002F..\u002Fdocs\u002Fcontracts\u002Faudit-log-v1.md)):\n\n1. Treat the script's pattern record as the **State the learning**\n   step input (§1) — `pattern.summary` is the one-sentence\n   statement, `pattern.line_ids` is the evidence.\n2. The repetition gate is already satisfied for `count ≥ 2`. Skip\n   to §3 (decide the target) — overlap check (§4) and proposal\n   draft (§8) remain mandatory.\n3. Independence floor still applies: two line ids from the same\n   `run_id` count as **one** piece of evidence. The mining script\n   already de-duplicates by `run_id`; the gate trusts that output.\n4. Audit-derived proposals MUST set\n   `source_learning: agents\u002Fruntime\u002Fstate\u002Faudit\u002F\u003CYYYY-MM>.jsonl#\u003Cline_ids>`\n   and link the mining-script run id, so the human reviewer can\n   reproduce the pattern from the raw audit log.\n\n## Knowledge-candidate learnings (optional source)\n\nWhen the input is an entry from `agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md`\nthat reached candidate status (≥ 3 mentions across distinct sessions —\nsee `update_skill_candidates.ts` and the\n[`memory-consolidation`](..\u002Fmemory-consolidation\u002FSKILL.md) recurrence\nstep):\n\n1. Treat the candidate's topic as the **State the learning** step\n   input (§1). The repetition gate (§0) is already satisfied by the\n   ≥ 3-mention threshold — skip straight to §3 (decide the target).\n   Overlap check (§4) and proposal draft (§8) remain mandatory.\n2. **Ground the draft in the original session logs, never the\n   consolidated summary alone.** The entry's `Sessions:` list names\n   the session ids the topic recurred in — read them in the host's\n   transcript view, or reconstruct them from the retained continuity\n   records, before drafting. A skill written from the counter summary\n   alone tends to be plausible but wrong; the transcripts carry the\n   detail the summary dropped.\n3. Set `source_learning` to the knowledge-candidate entry\n   (`agents\u002Fknowledge\u002Fprocedures\u002Fskill-candidates.md#\u003Ctopic>`).\n4. **§9 (degrade the source) is mandatory for this source type** —\n   the whole point of the candidate counter is that it stops counting\n   once promoted.\n\n## Environment notes\n\nPrefer updating existing rule\u002Fskill when possible.\nCreate new files only when the learning introduces a clearly distinct pattern.\n",{"name":5,"packs":45,"scope":47,"domain":50,"source":30,"execution":51,"model_tier":55,"workspaces":56,"description":7},[46],"meta",{"write":48,"verification_reason":49},[],"execution.handler is internal, so this skill spawns no subprocess — writes happen through the agent's declared allowed_tools. No command can prove a scope the skill never executes.","process",{"type":52,"handler":53,"allowed_tools":54},"assisted","internal",[],"inherit",[57],"agent-config-maintainer","main","12bd765ce1d800501d45dfb8232102793af01290","src\u002Fskills\u002Flearning-to-rule-or-skill",1,"https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config","https:\u002F\u002Fevent4u.app","https:\u002F\u002Fgithub.com\u002Fevent4u-app","Your events in your hand","2026-11-14 02:29:41",{"source":8,"skillName":5,"commands":68,"prompt":78,"zipAvailable":79},[69,72,75],{"tool":70,"command":71},"npx","npx skills add event4u-app\u002Fagent-config --skill learning-to-rule-or-skill",{"tool":73,"command":74},"bunx","bunx skills add event4u-app\u002Fagent-config --skill learning-to-rule-or-skill",{"tool":76,"command":77},"pnpm","pnpm dlx skills add event4u-app\u002Fagent-config --skill learning-to-rule-or-skill","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Flearning-to-rule-or-skill\u002FSKILL.md",true,[81],{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"evals\u002Ftriggers.json","REFERENCE","参考文档",3333,"https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Fsrc\u002Fskills\u002Flearning-to-rule-or-skill\u002Fevals\u002Ftriggers.json",[88,101,113,124,135,144],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":40},"01M6X84PK96XBPENXH66JCTSD1","unknown-key-fixture","Declares a key the schema does not know.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Fscripts\u002Ffixtures\u002Fbody-portable\u002Funknown-key\u002FSKILL.md",[],[95,96,97,98,99,100],"unknown key fixture","Unknown key","fixture","unknown","schema","package",{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":40},"01M6X84HW7NAHZ7GZMQ9RXK1XJ","portable-fixture","Declares only semantics the MCP-lite carrier transports whole.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Fscripts\u002Ffixtures\u002Fbody-portable\u002Fportable\u002FSKILL.md",[],[97,108,109,110,111,100,112],"portable","portable fixture","engineer","only","MCP",{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":40},"01M6X84F29FE0RGGZ1ZTFGZTX2","non-portable-fixture","Declares a runtime semantic the carrier drops.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Fscripts\u002Ffixtures\u002Fbody-portable\u002Fnon-portable\u002FSKILL.md",[],[109,120,108,97,121,122,123,100],"non portable fixture","semantic","high","runtime",{"skillNo":125,"name":126,"nameZh":6,"description":127,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":40},"01M6X848F706PT9MDCX75JKJ6B","candidate-zero-width","A candidate whose prose carries an invisible joiner.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskill-scout-candidates\u002Fzero-width-injection\u002FSKILL.md",[],[131,132,133,134],"candidate zero width","candidate","ZeRO","prose",{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":40},"01M6X841SSC2T31VDF41SA6DG1","candidate-disclosure-suppression","A candidate whose prose tells the agent to withhold from the user.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskill-scout-candidates\u002Fdisclosure-suppression\u002FSKILL.md",[],[142,132,134,143],"candidate disclosure suppression","user",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":40},"01M6X83TFS5AGPBPVTQNWP0BB3","candidate-dangerous-frontmatter","A candidate claiming an unscoped tool grant and a permission bypass.","https:\u002F\u002Fgithub.com\u002Fevent4u-app\u002Fagent-config\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskill-scout-candidates\u002Fdangerous-frontmatter\u002FSKILL.md",[],[151,132,152,153,154,155],"candidate dangerous frontmatter","frontmatter","shell","permission","tool"]