inherit-legacy-style
Fungsinya
Alat ini membantu menjaga gaya penulisan kode yang konsisten pada proyek lama. Alat ini menganalisis kode yang ada untuk menemukan aturan pemrograman yang belum pernah ditulis secara resmi, menyelesaikan konflik bersama Anda, lalu membuat file berisi aturan tersebut untuk diikuti oleh AI.
Kapan dipakai
- โSaat memperkenalkan AI ke proyek lama yang ditulis oleh manusia.
- โSaat Anda ingin memastikan kode yang dihasilkan AI tidak menyimpang dari gaya proyek saat ini.
- โUntuk mengubah aturan penulisan kode yang tidak tertulis dari sebuah proyek menjadi dokumen resmi.
Link skill
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/inherit-legacy-style/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
โSaya ingin AI mempelajari gaya proyek lama ini agar kode yang dihasilkannya konsisten.โ
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Alat ini pertama-tama memeriksa apakah file aturan sudah ada. Jika belum, alat akan memindai kode untuk mencari pola-pola umum di berbagai area (seperti pengaturan file, penamaan variabel, dan penanganan error). Konflik ditampilkan satu per satu agar Anda dapat memutuskannya, lalu aturan final disimpan dalam sebuah file.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
โฆ
Pertanyaan umum
Apa itu 'implicit conventions'?
Ini adalah konvensi dan gaya penulisan kode yang secara alami digunakan oleh para pengembang dalam sebuah proyek, tetapi tidak pernah didokumentasikan secara resmi.
Apa itu file `.ai-style-rules.md`?
Ini adalah dokumen yang dibuat oleh alat ini, berisi aturan gaya proyek, contoh kode yang baik ('Golden Files'), dan hal-hal yang harus dihindari ('DONTs').
Apakah alat ini bisa digunakan untuk bahasa pemrograman apa pun?
Bisa. Alat ini tidak terikat pada bahasa atau framework tertentu dan berfokus pada pola-pola kode itu sendiri.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 280k
- Peringkat
- #189
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- โฆ
Skill lain dari repositori ini
accessibility
280kMembantu agent Anda membuat antarmuka yang ramah untuk semua orang. Memastikan website dan aplikasi tetap bisa dipakai penyandang disabilitas, seperti tunanetra.
agent-architecture-audit
280kMembuat agent Anda memeriksa apakah semuanya berjalan dengan benar. Agent akan menemukan dan memperbaiki masalah pada sistem AI agar bekerja sesuai harapan.
agent-eval
280kMembantu agent Anda membandingkan berbagai alat coding AI. Mengukur mana yang lebih cepat, lebih murah, dan lebih andal untuk tugas tertentu.
agent-harness-construction
280kMembuat agent Anda lebih memahami cara menyelesaikan tugas. Agent mengoptimalkan alat dan instruksi yang digunakan agar peluang berhasilnya lebih besar.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.