跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
开发与测试

code-confidence-map

Assesses code comprehensibility and maintainability risk. Use when the user asks about code confidence, risk, maintainability, tech debt, code health, or whether code is safe to change. Also use when the user asks to analyze code quality, scan for risks, check if code is messy or complex, audit code, do a code checkup, find weak spots, assess what needs refactoring, or asks about code trust, hidden risks, gotchas, or onboarding to a codebase.

reskill · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add kanyun-inc/reskill --skill code-confidence-map

技能说明


name: code-confidence-map description: Assesses code comprehensibility and maintainability risk. Use when the user asks about code confidence, risk, maintainability, tech debt, code health, or whether code is safe to change. Also use when the user asks to analyze code quality, scan for risks, check if code is messy or complex, audit code, do a code checkup, find weak spots, assess what needs refactoring, or asks about code trust, hidden risks, gotchas, or onboarding to a codebase. version: 0.1.0 author: reskill tags:

  • code-quality
  • maintainability
  • risk-assessment
  • tech-debt

Code Confidence Map

Helps AI agents answer a core question: "If this code breaks tomorrow, how well-equipped are we to understand and fix it?"

This is NOT a linter or code quality tool. It measures comprehensibility risk — the gap between code complexity and human understanding. The AI's unique advantage over static analysis tools is semantic judgment: it can tell that processData does 5 unrelated things, that tests only cover happy paths, or that // don't touch this is a red flag.

When to Use This Skill

Use this skill when the user:

  • Asks about code confidence, risk, or maintainability
  • Says "is this code safe to change?" or "how risky is this module?"
  • Is onboarding to a new codebase and wants to understand the landscape
  • Wants to know where the tech debt or weak spots are
  • Asks "which parts of the codebase are well-tested?"
  • Says "scan this directory" or "check this file's health"
  • Is planning a refactor and wants to assess risk first
  • Asks about code quality, code health, or how solid a module is

Core Concept: What "Confidence" Means

Confidence is the answer to: "If something goes wrong here, can we understand and fix it?"

It is NOT:

  • A judgment on code quality (LOW confidence is a risk signal, not a verdict)
  • A measure of cleverness or elegance
  • An indicator of who wrote the code or when

Confidence levels:

LevelMeaning
HIGHWell-tested, readable, good error handling — safe to work with
MEDIUMPartially covered — some gaps in tests, docs, or error handling
LOWSignificant gaps — risky to modify without additional preparation

Do NOT use percentages (e.g., "73.2%"). They imply false precision for what is fundamentally a judgment call.

Overall level rule: The overall confidence level equals the lowest dimension level. If any single dimension is LOW, the overall is LOW — one critical gap is enough to make code risky to work with.

What We Explicitly Do NOT Measure

  • Time since last edit — Stable code is fine. Code that hasn't been touched in years may be the most reliable in the project.
  • Lines of code as a standalone metric — More code does not mean worse code.
  • Number of contributors — Team dynamics vary too much to draw conclusions.
  • Whether code was AI-generated — Irrelevant. What matters is whether the code is understood, regardless of who or what wrote it.

Confidence Dimensions

Core Dimensions (4)

These are evaluated for every file in Phase 2 / Single File Mode:

1. Test Safety Net

Are there tests? Do they test the right things?

  • Read the test file(s) for the target module
  • Check: do tests cover error paths and edge cases, or only happy paths?
  • Check: are tests meaningful (not just expect(true).toBe(true))?
  • A file with no test file at all is an immediate risk signal

Why it matters: Tests are executable documentation of intent. If there are no tests, nobody has formally defined what this code is supposed to do.

2. Self-Expressed Uncertainty

Does the code itself say "I'm not confident"?

Look for these markers (via grep or reading the file):

MarkerWhat It Means
TODOAcknowledged incomplete work
FIXMEKnown bug or issue
HACK, WORKAROUND, XXXIntentional shortcut or band-aid
@ts-ignoreTypeScript safety bypassed
eslint-disableLinting rules intentionally bypassed
Empty catch {} blocksErrors silently swallowed

Why it matters: The code is literally telling you where the risk is.

3. Comprehensibility

Can a newcomer understand this code?

This requires reading the code and making a semantic judgment:

  • Naming quality: Are variables, functions, and classes named descriptively? Or are there names like data, temp, x, processStuff?
  • Comment-to-complexity ratio: Complex logic (regex, algorithms, state machines) should have proportionally more comments. Simple code needs fewer.
  • Function size and nesting: Functions over ~50 lines or with 4+ levels of nesting are harder to follow.
  • Single responsibility: Does each function/module do one thing, or is it a grab-bag?

Why it matters: If nobody can read it, nobody can fix it.

4. Error Handling

When things go wrong, do we get useful information?

  • Empty catch blocks: Errors caught but silently swallowed — the worst pattern
  • Generic error messages: throw new Error("failed") gives zero debugging context
  • Unhandled edge cases: What happens with null, undefined, empty arrays, concurrent access?
  • Error propagation: Are errors properly propagated or lost in the call chain?

Why it matters: Bad error handling turns a 5-minute fix into a 5-hour hunt.

Optional Dimension (1)

5. Dependency Risk (project-level only)

Are we building on shaky ground?

This dimension is only evaluated when scanning at the project level (not per-file). Read package.json and check:

  • Floati
阅读完整来源 ↗