Chuyển đến nội dung
Skillpedia
Lập trình chung280k · #278

codehealth-mcp

Skill này làm gì

Công cụ này phân tích “sức khỏe” cấu trúc của code, tức là cách code được tổ chức bên trong. Nó cho điểm từ 1 đến 10 để bạn biết code dễ bảo trì hay cần cải thiện.

Khi nào nên dùng

  • ✓Khi xem xét chất lượng code trước khi chỉnh sửa.
  • ✓Trước khi bắt đầu tái cấu trúc (cải thiện cách tổ chức) một tệp.
  • ✓Khi muốn kiểm tra xem thay đổi do AI thực hiện có làm code tệ đi không.

Liên kết skill

https://github.com/affaan-m/ECC/blob/main/skills/codehealth-mcp/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/affaan-m/ECC/blob/main/skills/codehealth-mcp/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Kiểm tra sức khỏe code của tệp này trước khi tôi bắt đầu chỉnh sửa.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ kết nối với một máy chủ phân tích code ngay trên máy của bạn. Nó kiểm tra cấu trúc code và đưa ra điểm số, giúp phát hiện vấn đề tổ chức trước khi chúng trở nên lớn hơn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Code Health MCP (CodeScene)

Structural maintainability feedback for AI-assisted coding. Complements style/lint skills (coding-standards, plankton-code-quality) with design-level health scores and regression gates.

Upstream: codescene-oss/codescene-mcp-server Package: @codescene/codehealth-mcp (stdio via npx)

Security and boundaries

Opt-in (ECC): The codescene block in mcp-configs/mcp-servers.json is a template only. ECC plugin installs do not auto-enable bundled MCP servers. Copy the entry into your config only if you want it. You can exclude it during ECC install/sync with ECC_DISABLED_MCPS=codescene,....

Credentials: No bundled token. Set CS_ACCESS_TOKEN yourself (see getting-a-personal-access-token.md in the upstream repo). Never commit tokens to the repo.

What the tools read: When invoked, tools analyze files and git state in the local repository you point them at (paths you pass, plus branch context for analyze_change_set). They do not run by themselves. For standalone mode, follow upstream privacy docs: codescene-mcp-server README and CodeScene policies. Do not use this skill for secrets, credentials, or paths you do not want analyzed.

If the MCP is unavailable (offline, bad token, server crash): Do not invent Code Health scores. Tell the user the check was skipped. Continue only with explicit user approval. Prefer lint/tests/verification-loop for gating when MCP is down. Re-enable checks once the server connects.

When to Use

  • User asks to review code quality, refactor a file, or check if AI changes degraded maintainability
  • Before editing a hotspot, legacy module, or unfamiliar file
  • Before commit or pull request when you need a maintainability safeguard
  • After a large agent-written diff — verify Code Health did not regress
  • Pair with verification-loop, tdd-workflow, or /quality-gate as a structural check (not a replacement for tests/lint)

When to Activate

Same triggers as When to Use above — this heading is what ECC uses for skill auto-activation.

How It Works

1. Connect the MCP server

Copy the codescene entry from mcp-configs/mcp-servers.json into your harness MCP config.

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

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

Project-scoped: merge the same block into .mcp.json at the repo root.

Token setup is documented in the upstream repo (link above). Standalone mode does not require a paid CodeScene platform account for the four tools listed below. Restart the session and confirm the codescene server is connected before relying on scores.

2. Call standalone tools only

Tool When to use
code_health_review Full structural analysis before modifying a file
code_health_score Quick numeric score after each change (delta check)
pre_commit_code_health_safeguard Block commits that introduce Code Health regressions
analyze_change_set Branch-level check before opening a PR

Do not call platform-only tools (e.g. repository-wide technical debt hotspot lists). Do not reference delta_analysis — not available on standalone.

3. Interpret scores (1–10)

Range Meaning Agent behavior
9.0–10.0 Green — healthy Safer to extend; still prefer vertical slices
4.0–8.9 Yellow — debt Tread carefully; no drive-by refactors
1.0–3.9 Red — severe debt Narrow scope only

4. Run the feedback loop

Before touching a file

  1. Run code_health_review on the target path.
  2. Record baseline score and listed code smells.
  3. Plan the smallest change that addresses the task.

Scope by score: below 5 — minimal diff only; 5–7 — no broad refactors; above 7 — safer to refactor, still verify after each edit.

After each change

  1. Run code_health_score on the same file.
  2. Compare to the baseline from code_health_review.

…

Câu hỏi thường gặp

Làm sao để thiết lập công cụ?

Bạn cần cấu hình một access token và chỉ định địa chỉ máy chủ. Hướng dẫn chi tiết có trong tài liệu của công cụ.

Điểm số có nghĩa là gì?

Điểm từ 9 đến 10 là tốt (màu xanh lá), từ 4 đến 8,9 cần cẩn trọng (màu vàng), còn từ 1 đến 3,9 cho thấy vấn đề nghiêm trọng (màu đỏ).

Điều gì xảy ra nếu máy chủ không khả dụng?

Công cụ sẽ thông báo rằng việc kiểm tra đã bị bỏ qua và hỏi bạn có đồng ý tiếp tục không. Tốt hơn là dùng các kiểm tra khác như test hoặc lint.

Chi tiết

Mô tả gốc của tác giả

Real-time structural Code Health via CodeScene MCP — review before edits, verify score deltas after changes, gate commits and PRs. Use when reviewing code quality, refactoring, checking if AI changes degraded a file, or before commit/PR.

repo: affaan-m/ECC

Độ phổ biến

Sao GitHub
280k
Vị trí xếp hạng
#278
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự