본문으로 건너뛰기
Skillpedia
일반 코딩280k · #189

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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/affaan-m/ECC/blob/main/pi/core/skills/inherit-legacy-style/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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.md and optionally CLAUDE.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

  1. File Anatomy — in-file declaration order (imports → types → main logic → helpers → export)
  2. State & Control Flow — naming conventions for async state, pagination, flags
  3. Infrastructure — where cross-cutting utils live (interceptors, formatters, middleware)
  4. 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: pathA uses style X, pathB uses style Y WARNING: Risk: mixing both fractures the project style Choose: 1 follow X 2 follow Y 3 this is evolution, update rules 4 I 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

  1. Read existing .ai-style-rules.md; if it has a commit fingerprint, git diff <last_hash> HEAD --stat to pinpoint delta
  2. Read recent Git changes (git log -3 --stat → inspect suspect files on demand)
  3. For oversized diffs (>hundreds of files): --stat summary only + sample the largest changes
  4. Compare new code against recorded rules → conflicts go through Grilling Protocol
  5. 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬