inherit-legacy-style
하는 일
이 도구는 오래된 프로젝트에서 일관된 코딩 스타일을 유지하도록 돕습니다. 기존 코드를 분석해 문서로 정리되지 않은 프로그래밍 규칙을 찾아내고, 충돌하는 부분은 사용자와 함께 정리한 뒤, AI가 따를 수 있도록 규칙을 파일로 만듭니다.
사용하는 경우
- ✓사람이 작성한 오래된 프로젝트에 AI를 처음 참여시킬 때.
- ✓AI가 만든 코드가 프로젝트의 현재 스타일에서 벗어나지 않게 하고 싶을 때.
- ✓프로젝트의 문서화되지 않은 코딩 규칙을 문서로 정리하고 싶을 때.
스킬 링크
https://github.com/affaan-m/ECC/blob/main/pi/core/skills/inherit-legacy-style/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“이 오래된 프로젝트의 스타일을 AI가 배워서, 생성하는 코드가 일관되도록 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
이 도구는 먼저 규칙 파일이 이미 있는지 확인합니다. 없다면 파일 구성, 변수 이름 짓기, 오류 처리 같은 여러 영역에서 반복되는 패턴을 코드에서 찾습니다. 충돌하는 내용은 하나씩 보여 주어 사용자가 결정하게 하며, 최종 규칙은 파일로 저장됩니다.
기술 내용 (원본 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
…
자주 묻는 질문
‘암묵적인 관례’란 무엇인가요?
사람인 개발자들이 프로젝트에서 자연스럽게 따르지만, 공식적으로 문서화된 적은 없는 코딩 관례와 스타일을 말합니다.
‘.ai-style-rules.md’ 파일은 무엇인가요?
이 도구가 만드는 문서로, 프로젝트의 스타일 규칙, 좋은 코드 예시(‘골든 파일’), 피해야 할 방식이 들어 있습니다.
이 도구는 모든 프로그래밍 언어에서 작동하나요?
네. 이 도구는 특정 언어나 프레임워크에 얽매이지 않고 코드의 패턴 자체에 집중하므로 어떤 언어에서도 사용할 수 있습니다.
상세 정보
작성자의 원본 설명
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
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
accessibility
280k에이전트가 모든 사람이 쓸 수 있는 인터페이스를 만들도록 돕습니다. 시각 장애나 운동 장애가 있는 사람도 쓸 수 있게 합니다.
agent-architecture-audit
280k에이전트가 모든 것이 올바르게 작동하는지 점검하도록 돕습니다. AI 시스템의 문제를 찾아 고쳐서 기대대로 작동하게 합니다.
agent-eval
280k에이전트가 서로 다른 AI 코딩 도구를 비교하도록 돕습니다. 특정 작업에서 어느 도구가 더 빠르고, 저렴하고, 믿을 만한지 측정합니다.
agent-harness-construction
280k에이전트가 작업을 더 잘 이해하도록 돕습니다. 에이전트가 쓰는 도구와 지시문을 최적화해 성공 가능성을 높입니다.