Inherit Legacy Style Prevents AI code style drift in legacy projects by scanning the codebase for implicit conventions across 4 meta-architecture dimensions, resolving conflicts with the user one at a time, and crystallizing the consensus into an enforceable . Fully language- and framework-agnostic. When to Activate - User types - User mentions onboarding AI onto a hand-written legacy project - User is worried about AI-generated code "drifting" from existing project conventions - User wants to extract and codify their project's implicit coding rules When to Use Use this skill when you need to…

\n```\n\n| Tier | Source files | Strategy |\n|---|---|---|\n| Small | ≲ 50 | Full close-read every source |\n| Medium | 50–500 | Infra layer = full read; business layer = sample 2–3 per dimension |\n| Large | ≳ 500 | Strict sampling + budget cap; `--stat` summary first, then targeted reads |\n\n**2. Scan along 4 dimensions**\n\n1. **File Anatomy** — in-file declaration order (imports → types → main logic → helpers → export)\n2. **State & Control Flow** — naming conventions for async state, pagination, flags\n3. **Infrastructure** — where cross-cutting utils live (interceptors, formatters, middleware)\n4. **Error Handling** — try/catch vs global interceptor vs Result return; null-check habits\n\n**3. Apply signal-threshold noise reduction**\n\nBefore interrupting the user, evaluate signal strength:\n\n- **Weak signal** → auto-suppress: minority \u003c5% AND count \u003c10 → majority wins, minority goes to DONTs\n- **Strong signal** → grill: near-even split, or semantic fork on a core dimension\n- **Small-project exception**: sources ≲50, \"3 vs 2\" is NOT a majority → grill it\n\n**4. Resolve conflicts one at a time (Grilling Protocol)**\n\nFor each strong-signal conflict, present exactly ONE question with 4 options:\n\n> Evidence: `pathA` uses style X, `pathB` uses style Y\n> WARNING: Risk: mixing both fractures the project style\n> Choose: `1` follow X `2` follow Y `3` this is evolution, update rules `4` I have a new rule\n\nSuspend until the user answers, then proceed to the next conflict. Never stack questions.\n\n**5. Generate `.ai-style-rules.md`** with three mandatory sections:\n- **[Golden Files]** — real exemplar paths annotated with what they demonstrate\n- **[Naming & State-Control Rules]** — concrete, checkable conventions\n- **[DONTs]** — anti-patterns that must not propagate\n\n**6. Install the persistent hook**\n\nAsk the user for enforcement strength (use `AskUserQuestion`):\n\n| Option | Mechanism |\n|---|---|\n| **1** Soft hook (recommended) | Write `@.ai-style-rules.md` reference into project `CLAUDE.md` |\n| **2** Hard hook | Soft hook + `PreToolUse[Write\\|Edit\\|MultiEdit]` Hook in `settings.json` |\n| **3** No hook | Keep the rules file; user references manually |\n\n### Branch B — Incremental Sniff\n\n1. Read existing `.ai-style-rules.md`; if it has a commit fingerprint, `git diff \u003clast_hash> HEAD --stat` to pinpoint delta\n2. Read recent Git changes (`git log -3 --stat` → inspect suspect files on demand)\n3. For oversized diffs (>hundreds of files): `--stat` summary only + sample the largest changes\n4. Compare new code against recorded rules → conflicts go through Grilling Protocol\n5. Append evolution log at the end of `.ai-style-rules.md` (never overwrite old rules)\n\n### Per-Turn Enforcement\n\nWhen `.ai-style-rules.md` is in context (loaded via CLAUDE.md), every code-writing task must open with a **compliance declaration** in the reasoning chain, naming the exemplar being followed and the DONTs being avoided.\n\n## How It Works\n\nThis skill auto-detects whether it's a first-time or incremental run via `.ai-style-rules.md` presence:\n\n- **First-time (Branch A)** — Measures project scale, scans codebase across 4 meta-architecture dimensions (File Anatomy, State & Control Flow, Infrastructure, Error Handling), applies signal-threshold noise reduction to suppress weak conflicts, resolves strong-signal conflicts one-at-a-time with the user, generates `.ai-style-rules.md` with Golden Files / Naming Rules / DONTs, and offers optional enforcement hooks.\n- **Incremental (Branch B)** — Reads existing rules, checks recent Git diffs for new or conflicting patterns, runs the same one-at-a-time grilling protocol for any conflicts found, and appends evolution logs without overwriting existing rules.\n- **Per-Turn Enforcement** — When hooked via `CLAUDE.md`, every code-writing task opens with a compliance declaration naming the exemplar followed and the DONTs avoided.\n\n## Output Specification\n\n- `.ai-style-rules.md` at project root (with commit fingerprint + scale tier in header)\n- Optionally `CLAUDE.md` with `@.ai-style-rules.md` reference\n- Evolution logs appended as `### [YYYY-MM-DD] Style Evolution Log` entries\n\n## Anti-Patterns\n\n- FAIL: Do NOT skip the scale measurement step — sampling a 30-file project \"starves\" it; full-scanning a 5,000-file repo blows up\n- FAIL: Do NOT stack multiple conflict questions at once — grilling is strictly one-at-a-time\n- FAIL: Do NOT overwrite old rules in incremental mode — always append evolution logs\n- FAIL: Do NOT default to \"hard hook\" without asking — enforcement strength is the user's call\n- FAIL: Do NOT judge syntax or tech-stack quality — this skill aligns meta-architecture only\n- FAIL: Do NOT copy bugs from exemplar files — reuse structure, flag defects\n\n## Best Practices\n\n- Announce the detected mode (first-time vs incremental) and scale tier in one line before scanning\n- For large projects, read `--stat` summaries first, then targeted `Read` on suspect files\n- Let the signal threshold handle noise — a 843-vs-8 naming split should auto-resolve without user interruption\n- When in doubt about signal strength, lean toward asking\n- The CLAUDE.md soft hook (`@.ai-style-rules.md`) is usually sufficient; hard hook only if the user wants mechanical enforcement\n\n## Related Skills\n\n- `init` — initialize a new CLAUDE.md with codebase documentation\n- `code-review` — review diffs for correctness and style issues\n- `simplify` — review code for reuse and simplification opportunities\n\n## Examples\n\n1. **First-time onboarding**\n - User: \"Help me onboard AI to this older codebase without changing its style.\"\n - Action: Run Branch A full-scan → measure scale → scan 4 dimensions → grill conflicts → generate `.ai-style-rules.md` → offer hook strength (soft/hard/none).\n\n2. **Incremental update after team changes**\n - User: \"We added a new module; keep existing style rules intact.\"\n - Action: Run Branch B incremental sniff → compare Git deltas to recorded rules → grill any new conflicts → append evolution log without overwriting.\n\n3. **Enforcing DONTs via CLAUDE.md**\n - User: \"Make sure all new code stays consistent with the project's rules.\"\n - Action: Soft hook installed → `.ai-style-rules.md` auto-loaded every session → every code-writing task opens with compliance declaration, reusing exemplar patterns and avoiding DONTs.","attachment_filenames":[],"attachments":[],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Inherit Legacy Style","type":"text"}]},{"type":"paragraph","content":[{"text":"Prevents AI code style drift in legacy projects by scanning the codebase for implicit conventions across 4 meta-architecture dimensions, resolving conflicts with the user one at a time, and crystallizing the consensus into an enforceable ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":". Fully language- and framework-agnostic.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Activate","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User types ","type":"text"},{"text":"/inherit-legacy-style","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User mentions onboarding AI onto a hand-written legacy project","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User is worried about AI-generated code \"drifting\" from existing project conventions","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User wants to extract and codify their project's implicit coding rules","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When to Use","type":"text"}]},{"type":"paragraph","content":[{"text":"Use this skill when you need to preserve legacy project style and prevent AI-generated style drift. See ","type":"text"},{"text":"When to Activate","type":"text","marks":[{"type":"strong"}]},{"text":" above for trigger conditions.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Prerequisites","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Git (recommended; non-Git projects fall back to file timestamps for incremental mode)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Read/Write access to the project root (generates ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" and optionally ","type":"text"},{"text":"CLAUDE.md","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Workflow","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 0 — Auto-Detect Mode","type":"text"}]},{"type":"paragraph","content":[{"text":"Silently check for ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" at the project root:","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"File exists?","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Mode","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"No","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Branch A — First-time Full-Scan","type":"text","marks":[{"type":"strong"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Yes","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Branch B — Incremental Sniff","type":"text","marks":[{"type":"strong"}]}]}]}]}]},{"type":"paragraph","content":[{"text":"Announce the mode in one line and proceed — never ask the user to pick.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Branch A — First-time Full-Scan","type":"text"}]},{"type":"paragraph","content":[{"text":"1. Measure scale, pick a scanning tier","type":"text","marks":[{"type":"strong"}]}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git ls-files | grep -cE '\\.(js|ts|jsx|tsx|vue|py|go|rs|java|kt|rb|php|cs|swift|c|cpp|h)

Inherit Legacy Style Prevents AI code style drift in legacy projects by scanning the codebase for implicit conventions across 4 meta-architecture dimensions, resolving conflicts with the user one at a time, and crystallizing the consensus into an enforceable . Fully language- and framework-agnostic. When to Activate - User types - User mentions onboarding AI onto a hand-written legacy project - User is worried about AI-generated code "drifting" from existing project conventions - User wants to extract and codify their project's implicit coding rules When to Use Use this skill when you need to…

","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Tier","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Source files","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Strategy","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Small","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"≲ 50","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Full close-read every source","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Medium","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"50–500","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Infra layer = full read; business layer = sample 2–3 per dimension","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Large","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"≳ 500","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Strict sampling + budget cap; ","type":"text"},{"text":"--stat","type":"text","marks":[{"type":"code_inline"}]},{"text":" summary first, then targeted reads","type":"text"}]}]}]}]},{"type":"paragraph","content":[{"text":"2. Scan along 4 dimensions","type":"text","marks":[{"type":"strong"}]}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"File Anatomy","type":"text","marks":[{"type":"strong"}]},{"text":" — in-file declaration order (imports → types → main logic → helpers → export)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"State & Control Flow","type":"text","marks":[{"type":"strong"}]},{"text":" — naming conventions for async state, pagination, flags","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Infrastructure","type":"text","marks":[{"type":"strong"}]},{"text":" — where cross-cutting utils live (interceptors, formatters, middleware)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Error Handling","type":"text","marks":[{"type":"strong"}]},{"text":" — try/catch vs global interceptor vs Result return; null-check habits","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"3. Apply signal-threshold noise reduction","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"Before interrupting the user, evaluate signal strength:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Weak signal","type":"text","marks":[{"type":"strong"}]},{"text":" → auto-suppress: minority \u003c5% AND count \u003c10 → majority wins, minority goes to DONTs","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Strong signal","type":"text","marks":[{"type":"strong"}]},{"text":" → grill: near-even split, or semantic fork on a core dimension","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Small-project exception","type":"text","marks":[{"type":"strong"}]},{"text":": sources ≲50, \"3 vs 2\" is NOT a majority → grill it","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"4. Resolve conflicts one at a time (Grilling Protocol)","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"For each strong-signal conflict, present exactly ONE question with 4 options:","type":"text"}]},{"type":"blockquote","content":[{"type":"paragraph","content":[{"text":"Evidence: ","type":"text"},{"text":"pathA","type":"text","marks":[{"type":"code_inline"}]},{"text":" uses style X, ","type":"text"},{"text":"pathB","type":"text","marks":[{"type":"code_inline"}]},{"text":" uses style Y WARNING: Risk: mixing both fractures the project style Choose: ","type":"text"},{"text":"1","type":"text","marks":[{"type":"code_inline"}]},{"text":" follow X ","type":"text"},{"text":"2","type":"text","marks":[{"type":"code_inline"}]},{"text":" follow Y ","type":"text"},{"text":"3","type":"text","marks":[{"type":"code_inline"}]},{"text":" this is evolution, update rules ","type":"text"},{"text":"4","type":"text","marks":[{"type":"code_inline"}]},{"text":" I have a new rule","type":"text"}]}]},{"type":"paragraph","content":[{"text":"Suspend until the user answers, then proceed to the next conflict. Never stack questions.","type":"text"}]},{"type":"paragraph","content":[{"text":"5. Generate ","type":"text","marks":[{"type":"strong"}]},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":" with three mandatory sections:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"[Golden Files]","type":"text","marks":[{"type":"strong"}]},{"text":" — real exemplar paths annotated with what they demonstrate","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"[Naming & State-Control Rules]","type":"text","marks":[{"type":"strong"}]},{"text":" — concrete, checkable conventions","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"[DONTs]","type":"text","marks":[{"type":"strong"}]},{"text":" — anti-patterns that must not propagate","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"6. Install the persistent hook","type":"text","marks":[{"type":"strong"}]}]},{"type":"paragraph","content":[{"text":"Ask the user for enforcement strength (use ","type":"text"},{"text":"AskUserQuestion","type":"text","marks":[{"type":"code_inline"}]},{"text":"):","type":"text"}]},{"type":"table","attrs":{"layout":null},"content":[{"type":"tr","content":[{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Option","type":"text"}]}]},{"type":"th","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Mechanism","type":"text"}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"1","type":"text","marks":[{"type":"strong"}]},{"text":" Soft hook (recommended)","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Write ","type":"text"},{"text":"@.ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" reference into project ","type":"text"},{"text":"CLAUDE.md","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"2","type":"text","marks":[{"type":"strong"}]},{"text":" Hard hook","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Soft hook + ","type":"text"},{"text":"PreToolUse[Write|Edit|MultiEdit]","type":"text","marks":[{"type":"code_inline"}]},{"text":" Hook in ","type":"text"},{"text":"settings.json","type":"text","marks":[{"type":"code_inline"}]}]}]}]},{"type":"tr","content":[{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"3","type":"text","marks":[{"type":"strong"}]},{"text":" No hook","type":"text"}]}]},{"type":"td","attrs":{"colspan":1,"rowspan":1,"colwidth":null,"alignment":""},"content":[{"type":"paragraph","content":[{"text":"Keep the rules file; user references manually","type":"text"}]}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Branch B — Incremental Sniff","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Read existing ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":"; if it has a commit fingerprint, ","type":"text"},{"text":"git diff \u003clast_hash> HEAD --stat","type":"text","marks":[{"type":"code_inline"}]},{"text":" to pinpoint delta","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Read recent Git changes (","type":"text"},{"text":"git log -3 --stat","type":"text","marks":[{"type":"code_inline"}]},{"text":" → inspect suspect files on demand)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"For oversized diffs (>hundreds of files): ","type":"text"},{"text":"--stat","type":"text","marks":[{"type":"code_inline"}]},{"text":" summary only + sample the largest changes","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Compare new code against recorded rules → conflicts go through Grilling Protocol","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Append evolution log at the end of ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" (never overwrite old rules)","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Per-Turn Enforcement","type":"text"}]},{"type":"paragraph","content":[{"text":"When ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" is in context (loaded via CLAUDE.md), every code-writing task must open with a ","type":"text"},{"text":"compliance declaration","type":"text","marks":[{"type":"strong"}]},{"text":" in the reasoning chain, naming the exemplar being followed and the DONTs being avoided.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"How It Works","type":"text"}]},{"type":"paragraph","content":[{"text":"This skill auto-detects whether it's a first-time or incremental run via ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" presence:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"First-time (Branch A)","type":"text","marks":[{"type":"strong"}]},{"text":" — Measures project scale, scans codebase across 4 meta-architecture dimensions (File Anatomy, State & Control Flow, Infrastructure, Error Handling), applies signal-threshold noise reduction to suppress weak conflicts, resolves strong-signal conflicts one-at-a-time with the user, generates ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" with Golden Files / Naming Rules / DONTs, and offers optional enforcement hooks.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Incremental (Branch B)","type":"text","marks":[{"type":"strong"}]},{"text":" — Reads existing rules, checks recent Git diffs for new or conflicting patterns, runs the same one-at-a-time grilling protocol for any conflicts found, and appends evolution logs without overwriting existing rules.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Per-Turn Enforcement","type":"text","marks":[{"type":"strong"}]},{"text":" — When hooked via ","type":"text"},{"text":"CLAUDE.md","type":"text","marks":[{"type":"code_inline"}]},{"text":", every code-writing task opens with a compliance declaration naming the exemplar followed and the DONTs avoided.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Output Specification","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" at project root (with commit fingerprint + scale tier in header)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Optionally ","type":"text"},{"text":"CLAUDE.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" with ","type":"text"},{"text":"@.ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" reference","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Evolution logs appended as ","type":"text"},{"text":"### [YYYY-MM-DD] Style Evolution Log","type":"text","marks":[{"type":"code_inline"}]},{"text":" entries","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Anti-Patterns","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"FAIL: Do NOT skip the scale measurement step — sampling a 30-file project \"starves\" it; full-scanning a 5,000-file repo blows up","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"FAIL: Do NOT stack multiple conflict questions at once — grilling is strictly one-at-a-time","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"FAIL: Do NOT overwrite old rules in incremental mode — always append evolution logs","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"FAIL: Do NOT default to \"hard hook\" without asking — enforcement strength is the user's call","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"FAIL: Do NOT judge syntax or tech-stack quality — this skill aligns meta-architecture only","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"FAIL: Do NOT copy bugs from exemplar files — reuse structure, flag defects","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Best Practices","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Announce the detected mode (first-time vs incremental) and scale tier in one line before scanning","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"For large projects, read ","type":"text"},{"text":"--stat","type":"text","marks":[{"type":"code_inline"}]},{"text":" summaries first, then targeted ","type":"text"},{"text":"Read","type":"text","marks":[{"type":"code_inline"}]},{"text":" on suspect files","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Let the signal threshold handle noise — a 843-vs-8 naming split should auto-resolve without user interruption","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"When in doubt about signal strength, lean toward asking","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"The CLAUDE.md soft hook (","type":"text"},{"text":"@.ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":") is usually sufficient; hard hook only if the user wants mechanical enforcement","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Related Skills","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"init","type":"text","marks":[{"type":"code_inline"}]},{"text":" — initialize a new CLAUDE.md with codebase documentation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"code-review","type":"text","marks":[{"type":"code_inline"}]},{"text":" — review diffs for correctness and style issues","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"simplify","type":"text","marks":[{"type":"code_inline"}]},{"text":" — review code for reuse and simplification opportunities","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Examples","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"First-time onboarding","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User: \"Help me onboard AI to this older codebase without changing its style.\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Action: Run Branch A full-scan → measure scale → scan 4 dimensions → grill conflicts → generate ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" → offer hook strength (soft/hard/none).","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Incremental update after team changes","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User: \"We added a new module; keep existing style rules intact.\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Action: Run Branch B incremental sniff → compare Git deltas to recorded rules → grill any new conflicts → append evolution log without overwriting.","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Enforcing DONTs via CLAUDE.md","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User: \"Make sure all new code stays consistent with the project's rules.\"","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Action: Soft hook installed → ","type":"text"},{"text":".ai-style-rules.md","type":"text","marks":[{"type":"code_inline"}]},{"text":" auto-loaded every session → every code-writing task opens with compliance declaration, reusing exemplar patterns and avoiding DONTs.","type":"text"}]}]}]}]}]}]},"metadata":{"date":"2026-11-02","name":"inherit-legacy-style","author":"@skillopedia","source":{"stars":295436,"repo_name":"ECC","origin_url":"https://github.com/affaan-m/ECC/blob/HEAD/skills/inherit-legacy-style/SKILL.md","repo_owner":"affaan-m","body_sha256":"ccce44b6240e346e2d564a035f45abf01842cfc03f4c0253050b8304c505f709","cluster_key":"6d0dcd5b0ddd50e0bfe6e7bdbf82203c603eae6e02888cf305715b8fd88f20ea","clean_bundle":{"format":"clean-skill-bundle-v1","source":"affaan-m/ECC/skills/inherit-legacy-style/SKILL.md","text_bytes":0,"source_commit":"b38be6a7f6350964d59328b52f0624e1d1d552d1","skills_sh_rank":4119,"attachment_count":0,"text_attachments":0,"attachment_storage":"skill_attachments","binary_attachments":0},"cluster_size":1,"skill_md_path":"skills/inherit-legacy-style/SKILL.md","import_metadata":{"date":"2026-11-02","author":"@skillopedia","version":"v1","category":"software-engineering","category_label":"Engineering"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"software-engineering","metadata":{"origin":"community"},"import_tag":"skills-sh-top20k-2026-11","description":"Prevent AI style drift on legacy projects by scanning the codebase for implicit conventions, resolving conflicts with the operator one at a time, and writing an enforceable .ai-style-rules.md (Golden Files, naming rules, DONTs) plus an optional CLAUDE.md hook. Use when onboarding an AI agent onto a hand-written legacy codebase or extracting a project's unwritten coding rules.","allowed-tools":"Read, Glob, Grep, Bash, Edit, Write, AskUserQuestion"}},"renderedAt":1793666682403}

Inherit Legacy Style Prevents AI code style drift in legacy projects by scanning the codebase for implicit conventions across 4 meta-architecture dimensions, resolving conflicts with the user one at a time, and crystallizing the consensus into an enforceable . Fully language- and framework-agnostic. When to Activate - User types - User mentions onboarding AI onto a hand-written legacy project - User is worried about AI-generated code "drifting" from existing project conventions - User wants to extract and codify their project's implicit coding rules When to Use Use this skill when you need to…