inherit-legacy-style
Skill8 starsChanged 3 months agoMITView on GitHub
Legacy-project style inheritance skill. Use when the user types /inherit-legacy-style, or when onboarding an AI coding agent onto a hand-written legacy project and you need to prevent "style drift" (the model imposing its pretrained mainstream idioms onto the project). Language- and framework-agnostic — it aligns meta-architecture only, not syntax. Once run, it becomes a behavioral constraint on all subsequent coding tasks. Do NOT use for pure research or one-off questions unrelated to code-style alignment.
4 other projects use a version of this, 2 of them edited.
Adopted by
Most recently taken up by
- AndresArreguy/ecc-pi-portedited, first seen Nov 16, 2026
- renepf/claude-skillsword for word, first seen Oct 25, 2026
- SamuelNDCE/claude-super-skill-libraryedited, first seen Aug 1, 2026
- linsywu/inherit-legacy-styletheir own version, first seen May 31, 2026
Other versions4 projects use a version of this.
Word for word · 1
- renepf/claude-skills★ 0100% same
Edited · 2
- AndresArreguy/ecc-pi-port★ 195% same
- SamuelNDCE/claude-super-skill-library★ 1100% same
Wrote their own version · 1
- linsywu/inherit-legacy-style★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository273 other files it gives its agents.
- accessibilitySkill
- agent-architecture-auditSkill
- agent-evalSkill
- agent-harness-constructionSkill
- agentic-engineeringSkill
- agentic-osSkill
- agent-introspection-debuggingSkill
- agent-payment-x402Skill
- agent-self-evaluationSkill
- agent-sortSkill
- ai-first-engineeringSkill
- ai-regression-testingSkill
- android-clean-architectureSkill
- angular-developerSkill
- api-connector-builderSkill
- api-designSkill
- architecture-decision-recordsSkill
- article-writingSkill
- automation-audit-opsSkill
- autonomous-agent-harnessSkill
- autonomous-loopsSkill
- backend-patternsSkill
- benchmark-methodologySkill
- benchmark-optimization-loopSkill
- benchmarkSkill
- blender-motion-state-inspectionSkill
- blueprintSkill
- brand-discoverySkill
- brand-voiceSkill
- browser-qaSkill
- bun-runtimeSkill
- canary-watchSkill
- carrier-relationship-managementSkill
- cisco-ios-patternsSkill
- ckSkill
- claude-devfleetSkill
- clickhouse-ioSkill
- click-path-auditSkill
- codebase-onboardingSkill
- codehealth-mcpSkill
- code-tourSkill
- coding-standardsSkill
- competitive-platform-analysisSkill
- competitive-report-structureSkill
- compose-multiplatform-patternsSkill
- config-gcSkill
- configure-eccSkill
- connections-optimizerSkill
- content-engineSkill
- content-hash-cache-patternSkill
- context-budgetSkill
- continuous-agent-loopSkill
- contract-firstSkill
- cost-aware-llm-pipelineSkill
- cost-trackingSkill
- council-multi-modelSkill
- councilSkill
- cpp-coding-standardsSkill
- cpp-testingSkill
- crosspostSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. 4 are common, 0 are distinctive, and 4 are very specific to this project.
4
Common
Most of the 3 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Common: line 22
Use this skill when you need to preserve legacy project style and prevent AI-generated style drift.
- Very specific: line 27
Read/Write access to the project root (generates .ai-style-rules.md and optionally CLAUDE.md)
- Common: line 65
Before interrupting the user, evaluate signal strength:
- Very specific: line 88
Ask the user for enforcement strength (use AskUserQuestion):
- Very specific: line 98
Read existing .ai-style-rules.md.
- Common: line 99
Read recent Git changes (git log -3 --stat → inspect suspect files on demand)
- Very specific: line 106
When .ai-style-rules.md is in context (loaded via CLAUDE.md), every code-writing task must open with a compliance declaration in the …
- Common: line 136
When in doubt about signal strength, lean toward asking
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 .ai-style-rules.md. Fully language- and framework-agnostic.
When to Activate
- User types
/inherit-legacy-style - 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 preserve legacy project style and prevent AI-generated style drift. See When to Activate above for trigger conditions.
Prerequisites
- Git (recommended; non-Git projects fall back to file timestamps for incremental mode)
- Read/Write access to the project root (generates
.ai-style-rules.mdand optionallyCLAUDE.md)
Workflow
Step 0 — Auto-Detect Mode
Silently check for .ai-style-rules.md at the project root:
| File exists? | Mode |
| No | Branch A — First-time Full-Scan |
| Yes | Branch B — Incremental Sniff |
Announce the mode in one line and proceed — never ask the user to pick.
Branch A — First-time Full-Scan
1. Measure scale, pick a scanning tier
git ls-files | grep -cE '\.(js|ts|jsx|tsx|vue|py|go|rs|java|kt|rb|php|cs|swift|c|cpp|h)$'| Tier | Source files | Strategy |
| Small | ≲ 50 | Full close-read every source |
| Medium | 50–500 | Infra layer = full read; business layer = sample 2–3 per dimension |
| Large | ≳ 500 | Strict sampling + budget cap; --stat summary first, then targeted reads |
2. Scan along 4 dimensions
- File Anatomy — in-file declaration order (imports → types → main logic → helpers → export)
- State & Control Flow — naming conventions for async state, pagination, flags
- Infrastructure — where cross-cutting utils live (interceptors, formatters, middleware)
- Error Handling — try/catch vs global interceptor vs Result return; null-check habits
3. Apply signal-threshold noise reduction
Before interrupting the user, evaluate signal strength:
- Weak signal → auto-suppress: minority <5% AND count <10 → majority wins, minority goes to DONTs
- Strong signal → grill: near-even split, or semantic fork on a core dimension
- Small-project exception: sources ≲50, "3 vs 2" is NOT a majority → grill it
4. Resolve conflicts one at a time (Grilling Protocol)
For each strong-signal conflict, present exactly ONE question with 4 options:
Evidence:
pathAuses style X,pathBuses style Y WARNING: Risk: mixing both fractures the project style Choose:1follow X2follow Y3this is evolution, update rules4I have a new rule
Suspend until the user answers, then proceed to the next conflict. Never stack questions.
5. Generate .ai-style-rules.md with three mandatory sections:
- [Golden Files] — real exemplar paths annotated with what they demonstrate
- [Naming & State-Control Rules] — concrete, checkable conventions
- [DONTs] — anti-patterns that must not propagate
6. Install the persistent hook
Ask the user for enforcement strength (use AskUserQuestion):
| Option | Mechanism |
| 1 Soft hook (recommended) | Write @.ai-style-rules.md reference into project CLAUDE.md |
| 2 Hard hook | Soft hook + PreToolUse[Write|Edit|MultiEdit] Hook in settings.json |
| 3 No hook | Keep the rules file; user references manually |
Branch B — Incremental Sniff
- Read existing
.ai-style-rules.md; if it has a commit fingerprint,git diff <last_hash> HEAD --statto pinpoint delta - Read recent Git changes (
git log -3 --stat→ inspect suspect files on demand) - For oversized diffs (>hundreds of files):
--statsummary only + sample the largest changes - Compare new code against recorded rules → conflicts go through Grilling Protocol
- Append evolution log at the end of
.ai-style-rules.md(never overwrite old rules)
Per-Turn Enforcement
When .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.
How It Works
This skill auto-detects whether it's a first-time or incremental run via .ai-style-rules.md presence:
- 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.mdwith Golden Files / Naming Rules / DONTs, and offers optional enforcement hooks. - 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.
- 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.
Output Specification
.ai-style-rules.mdat project root (with commit fingerprint + scale tier in header)- Optionally
CLAUDE.mdwith@.ai-style-rules.mdreference - Evolution logs appended as
### [YYYY-MM-DD] Style Evolution Logentries
Anti-Patterns
- FAIL: Do NOT skip the scale measurement step — sampling a 30-file project "starves" it; full-scanning a 5,000-file repo blows up
- FAIL: Do NOT stack multiple conflict questions at once — grilling is strictly one-at-a-time
- FAIL: Do NOT overwrite old rules in incremental mode — always append evolution logs
- FAIL: Do NOT default to "hard hook" without asking — enforcement strength is the user's call
- FAIL: Do NOT judge syntax or tech-stack quality — this skill aligns meta-architecture only
- FAIL: Do NOT copy bugs from exemplar files — reuse structure, flag defects
Best Practices
- Announce the detected mode (first-time vs incremental) and scale tier in one line before scanning
- For large projects, read
--statsummaries first, then targetedReadon suspect files - Let the signal threshold handle noise — a 843-vs-8 naming split should auto-resolve without user interruption
- When in doubt about signal strength, lean toward asking
- The CLAUDE.md soft hook (
@.ai-style-rules.md) is usually sufficient; hard hook only if the user wants mechanical enforcement
Related Skills
init— initialize a new CLAUDE.md with codebase documentationcode-review— review diffs for correctness and style issuessimplify— review code for reuse and simplification opportunities
Examples
- First-time onboarding
- User: "Help me onboard AI to this older codebase without changing its style."
- Action: Run Branch A full-scan → measure scale → scan 4 dimensions → grill conflicts → generate
.ai-style-rules.md→ offer hook strength (soft/hard/none).
- Incremental update after team changes
- User: "We added a new module; keep existing style rules intact."
- Action: Run Branch B incremental sniff → compare Git deltas to recorded rules → grill any new conflicts → append evolution log without overwriting.
- Enforcing DONTs via CLAUDE.md
- User: "Make sure all new code stays consistent with the project's rules."
- Action: Soft hook installed →
.ai-style-rules.mdauto-loaded every session → every code-writing task opens with compliance declaration, reusing exemplar patterns and avoiding DONTs.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

