Communitygithub.com

Code Health MCP

CodeScene 기반의 실시간 코드 구조 건강도를 제공하여, 편집 전 검토, 변경 후 점수 차이 확인, 커밋 및 PR 게이팅에 활용할 수 있도록 도와줍니다. 코드 품질 검토, 리팩터링, AI 변경으로 인한 코드 저하 확인 시 또는 커밋/PR 전에 사용하세요.

Code Health MCP란 무엇인가요?

이 스킬은 AI 기반 코딩 과정에서 구조적 유지보수성 피드백을 제공하는 CodeScene MCP(Code Health MCP)입니다. 기존의 스타일/린트 스킬을 보완하여 설계 수준의 건강 점수 및 회귀 게이트를 제공합니다. 주요 기능으로는 파일 수정 전 구조 분석(code_health_review), 변경 후 점수 확인(code_health_score), 커밋 전 건강 게이팅(pre_commit_code_health_safeguard), 브랜치 수준 PR 전 검사(analyze_change_set) 등이 있습니다. 점수는 1~10점 범위로 평가되며, 9.0 이상은 건강, 4.0~8.9는 주의, 1.0~3.9는 심각한 부채 상태를 의미합니다. 모든 MCP 기능은 로컬 저장소에서 실행되며, 별도의 CodeScene 유료 플랫폼 계정 없이도 무료 스탠드얼론 토큰으로 사용 가능합니다. ECC(Enhanced Coding Capabilities) 환경에서는 verification-loop, tdd-workflow, /quality-gate 등 다른 스킬과 함께 구조적 검사 도구로 활용될 수 있습니다.

지원 대상✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/codehealth-mcp

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

Code Health MCP (CodeScene)

AI 기반 코딩을 위한 구조적 유지보수성 피드백. 스타일/린트 스킬(coding-standards, plankton-code-quality)을 설계 수준의 건강 점수 및 회귀 게이트로 보완합니다.

상위 저장소: codescene-oss/codescene-mcp-server 패키지: @codescene/codehealth-mcp (stdio via npx)

보안 및 경계

옵트인 (ECC): mcp-configs/mcp-servers.json의 codescene 블록은 템플릿일 뿐입니다. ECC 플러그인 설치는 번들된 MCP 서버를 자동 활성화하지 않습니다. 원하는 경우에만 해당 항목을 설정에 복사하세요. ECC_DISABLED_MCPS=codescene,...를 사용하여 ECC 설치/동기화 중에 제외할 수 있습니다.

자격 증명: 번들 토큰이 없습니다. CS_ACCESS_TOKEN을 직접 설정하세요 (상위 저장소의 getting-a-personal-access-token.md 참조). 토큰을 저장소에 커밋하지 마세요.

도구가 읽는 대상: 호출 시 도구는 로컬 저장소 내의 파일 및 git 상태를 분석합니다 (전달한 경로, analyze_change_set의 브랜치 컨텍스트 포함). 자체적으로 실행되지 않습니다. 독립 실행 모드의 경우 상위 저장소의 개인정보 보호 문서(codescene-mcp-server README 및 CodeScene 정책)를 따르세요. 분석을 원하지 않는 비밀, 자격 증명 또는 경로에 대해 이 스킬을 사용하지 마세요.

MCP를 사용할 수 없는 경우 (오프라인, 잘못된 토큰, 서버 충돌): Code Health 점수를 임의로 생성하지 마세요. 검사가 건너뛰어졌음을 사용자에게 알리세요. 명시적인 사용자 승인이 있을 때만 계속 진행하세요. MCP가 다운되었을 때 게이팅을 위해 lint/테스트/확인 루프를 우선 사용하세요. 서버가 연결되면 검사를 다시 활성화하세요.

사용 시기

  • 사용자가 코드 품질 검토, 파일 리팩터링, 또는 AI 변경으로 인한 유지보수성 저하 확인을 요청할 때
  • 핫스팟, 레거시 모듈 또는 익숙하지 않은 파일을 편집하기 전
  • 유지보수성 안전 장치가 필요할 때 커밋 또는 풀 리퀘스트 전
  • 대규모 에이전트 작성 diff 후: Code Health가 퇴보하지 않았는지 확인
  • 구조적 검사로 verification-loop, tdd-workflow 또는 /quality-gate와 함께 사용 (테스트/lint를 대체하지 않음)

활성화 시기

위의 사용 시기와 동일한 트리거입니다. 이 헤딩은 ECC가 스킬 자동 활성화에 사용합니다.

작동 방식

1. MCP 서버 연결

mcp-configs/mcp-servers.json에서 codescene 항목을 사용 중인 하네스 MCP 설정에 복사하세요.

Claude Code (~/.claude.json → mcpServers):

"codescene": {
  "command": "npx",
  "args": ["-y", "@codescene/codehealth-mcp"],
  "env": {
    "CS_ACCESS_TOKEN": "YOUR_CS_ACCESS_TOKEN_HERE"
  }
}

프로젝트 범위: 동일한 블록을 저장소 루트의 .mcp.json에 병합하세요.

토큰 설정은 상위 저장소(위 링크)에 문서화되어 있습니다. 독립 실행 모드는 아래 나열된 네 가지 도구에 대해 유료 CodeScene 플랫폼 계정이 필요하지 않습니다. 세션을 다시 시작하고 점수에 의존하기 전에 codescene 서버가 연결되었는지 확인하세요.

2. 독립 실행 도구만 호출

도구사용 시기
code_health_review파일을 수정하기 전 전체 구조 분석
code_health_score각 변경 후 빠른 숫자 점수 (델타 확인)
pre_commit_code_health_safeguardCode Health 회귀를 도입하는 커밋 차단
analyze_change_setPR을 열기 전 브랜치 수준 확인

플랫폼 전용 도구(예: 저장소 전체 기술 부채 핫스팟 목록)는 호출하지 마세요. delta_analysis를 참조하지 마세요. 독립 실행 모드에서는 사용할 수 없습니다.

3. 점수 해석 (1–10)

범위의미에이전트 동작
9.0–10.0초록색 — 건강함확장하기 더 안전하지만 여전히 세로 슬라이스를 선호
4.0–8.9노란색 — 부채 있음조심히 다루기; 무분별한 리팩터링 금지
1.0–3.9빨간색 — 심각한 부채범위를 좁게만 유지

4. 피드백 루프 실행

파일을 건드리기 전

  1. 대상 경로에서 code_health_review를 실행하세요.
  2. 기준 점수와 나열된 코드 스멜을 기록하세요.
  3. 작업을 해결하는 가장 작은 변경을 계획하세요.

점수별 범위: 5 미만 — 최소 diff만; 5–7 — 광범위한 리팩터링 금지; 7 초과 — 리팩터링하기 더 안전하지만, 각 편집 후에도 확인하세요.

각 변경 후

  1. 동일한 파일에서 code_health_score를 실행하세요.
  2. code_health_review의 기준 점수와 비교하세요.
  3. 점수가 퇴보했다면 계속하기 전에 수정하세요. 시작할 때보다 점수가 낮은 상태로 작업을 완료 처리하지 마세요.

모든 커밋 전 — 저장소 경로에서 pre_commit_code_health_safeguard를 실행하세요.

PR 전 — 기준 브랜치(예: main)에 대해 analyze_change_set을 실행하세요.

예제

예제: Flask 유지보수성 개선

pallets/flask에서 독립 실행 도구만 사용하는 에이전트 루프:

  1. 대상 모듈에서 code_health_review (기준 4.82)
  2. 나열된 스멜을 해결하는 목표 지향적 리팩터링
  3. 각 편집 후 code_health_score
  4. 커밋 전 pre_commit_code_health_safeguard
  5. PR 전 analyze_change_set

결과: Code Health 4.82 → 9.1 (무료 독립 실행 토큰만 사용).

예제: AGENTS.md 강제 블록

프로젝트 AGENTS.md 또는 CLAUDE.md에 붙여넣기:

## Code Health (CodeScene MCP)

파일을 수정하기 전: `code_health_review`를 실행하고 점수와 문제점을 기록하세요.

- 점수가 5 미만: 문제가 있는 범위 — 변경 범위를 좁게 유지하세요.
- 점수 5–7: 경고 범위 — 광범위한 리팩터링을 하지 마세요.

각 변경 후: `code_health_score`를 실행하여 델타를 확인하세요.

- 점수가 퇴보했다면: 계속하기 전에 수정하세요. 점수가 떨어진 상태에서 완료를 선언하지 마세요.

모든 커밋 전: `pre_commit_code_health_safeguard`를 실행하세요.

PR 전: `analyze_change_set`을 실행하세요.

예제: 안티패턴 vs 올바른 루프

# 나쁨: 먼저 편집하고 나중에 확인
[code_health_review 없이 대규모 리팩터링]

# 나쁨: 점수 하락 무시
"테스트 통과" → Code Health가 감소했지만 작업 완료 처리

# 나쁨: 빨간색 점수(5 미만) 파일에서 광범위한 리팩터링
모듈 전체에 걸친 무분별한 정리

# 좋음: 검토 → 작은 변경 → 점수 → 커밋 안전 장치 → analyze_change_set

ECC와의 페어링

ECC 스킬 / 흐름Code Health MCP 역할
coding-standards스타일/명명; Code Health = 구조/복잡도
plankton-code-quality작성 시 lint/포맷; Code Health = 편집 전/후 구조 게이트
verification-loop / /quality-gate"완료" 전에 구조적 회귀 검사 추가
security-review보안 vs 유지보수성 — 관련 있을 때 둘 다 사용
tdd-workflow테스트 통과 ≠ 건강한 설계 — 리팩터링 후 점수 확인

컨텍스트 팁: ECC는 MCP 수를 적게 유지하는 것을 권장합니다. 실질적인 편집을 할 때 codescene을 활성화하고 필요하지 않을 때 비활성화하세요.

관련 스킬

  • coding-standards — 기본 규칙
  • plankton-code-quality — 작성 시 lint/포맷 훅
  • verification-loop — 빌드/테스트/lint 게이트
  • tdd-workflow — 테스트 우선 개발
  • security-review — 보안 체크리스트
  • documentation-lookup — Context7을 통한 라이브러리 문서 (직교)

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

관련 스킬