inherit-legacy-style
यह क्या करती है
यह tool पुराने projects में कोड लिखने का एक जैसा style बनाए रखने में मदद करता है। यह मौजूदा कोड को देखकर वे नियम ढूँढता है जो कभी लिखे नहीं गए, उनमें आई उलझनें आपसे पूछकर सुलझाता है, और फिर AI के लिए उन नियमों की एक file बनाता है।
कब इस्तेमाल करें
- ✓जब किसी पुराने, इंसानों के लिखे project पर AI को काम पर लगाना हो।
- ✓जब चाहते हों कि AI से बना कोड project के मौजूदा style से अलग न हो।
- ✓जब project के अनलिखे coding नियमों को एक document में लिखना हो।
Skill का लिंक
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/inherit-legacy-style/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“मैं चाहता हूँ कि AI इस पुराने project का style सीख ले ताकि उसका बनाया कोड एक जैसा लगे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
tool पहले देखता है कि नियमों वाली file पहले से है या नहीं। अगर नहीं है, तो यह कोड में अलग-अलग हिस्सों (जैसे file व्यवस्था, variable naming, error handling) के आम patterns खोजता है। उलझनें एक-एक करके आपके सामने रखी जाती हैं ताकि आप फैसला करें, और आख़िरी नियम एक file में सेव हो जाते हैं।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।
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
…
अक्सर पूछे जाने वाले सवाल
'implicit conventions' क्या हैं?
ये वे coding नियम और style हैं जिन्हें project के developers स्वाभाविक रूप से मानते हैं, लेकिन कभी औपचारिक रूप से लिखे नहीं गए।
`.ai-style-rules.md` file क्या है?
यह एक document है जिसे tool बनाता है। इसमें project के style नियम, अच्छे कोड के उदाहरण ('Golden Files') और किन बातों से बचना है ('DONTs') लिखे होते हैं।
क्या यह tool किसी भी programming language के लिए काम करता है?
हाँ, यह tool language और framework पर निर्भर नहीं है, यह कोड के patterns पर ध्यान देता है।
जानकारी
लेखक का मूल विवरण
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.
repo: affaan-m/ECC
लोकप्रियता
- GitHub स्टार
- 280k
- रैंकिंग में स्थान
- #189
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
accessibility
280kयह आपके एजेंट को ऐसे इंटरफ़ेस बनाने में मदद करता है जिन्हें हर कोई इस्तेमाल कर सके। यह पक्का करता है कि वेबसाइट और ऐप दिव्यांग लोगों के लिए भी अच्छे से काम करें, जैसे नेत्रहीन या जिन्हें चलने-फिरने में दिक्कत होती है।
agent-architecture-audit
280kयह आपके एजेंट को जाँचने देता है कि सब कुछ सही से चल रहा है। यह AI सिस्टम में समस्याएँ ढूँढकर ठीक करता है, ताकि वे उम्मीद के मुताबिक काम करें।
agent-eval
280kयह आपके एजेंट को अलग-अलग AI coding tools की तुलना करने में मदद करता है। यह मापता है कि किसी खास काम के लिए कौन सा टूल ज़्यादा तेज़, सस्ता और भरोसेमंद है।
agent-harness-construction
280kयह आपके एजेंट को काम कैसे करना है, यह बेहतर समझने में मदद करता है। यह उन tools और instructions को बेहतर बनाता है जिनका एजेंट इस्तेमाल करता है, ताकि उसकी सफलता की संभावना बढ़े।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।