360 Secure SkillHub
360 安全技能中心

Missing Imports

该 Skill 提供排查代码中未导入符号或从模块导入不存在符号的指导,列出常见症状与处理步骤,例如核对每个符号的导入、验证模块实际导出、阅读包导出配置,并建议在改动后运行静态检查器。它面向 ImportError、NameError、ReferenceError 的调试,不包含自动修复或工具实现。

mvogt99
mvogt99
热度 41.22
最近更新 2026-05-11 17:46:01
分类:开发依赖:纯提示词应用场景:代码审查 / 调试排错

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add missing-imports
Metadata
name
missing-imports
description
Code uses a symbol that isn't imported, or imports a symbol that doesn't exist in the source module.
emoji
📦
metadata
{"clawdis":{"os":["macos","linux","windows"]}}

missing-imports

The generated code uses a name that hasn't been brought into scope, or imports from a module that doesn't export the named symbol. A guaranteed runtime NameError / ReferenceError / ImportError.

Symptoms

  • Code uses Foo but Foo is never imported.
  • from mod import X where mod exists but does not export X.
  • import { x } from "pkg" with no matching named export.
  • Static analysis flags unused-import alongside undefined-name — common when the agent copy-pastes between files.

What to do

  • For every symbol used in the diff, confirm there is a corresponding import in the same file or that the symbol is defined locally.
  • For every new import, verify the target module actually exports that name. Open the module if needed.
  • Don't guess at package layout. When unsure, read the package's package.json exports, __init__.py, or equivalent.
  • Run the static checker (tsc, mypy, pyright, etc.) after every non-trivial change. Missing imports almost always surface there.
  • Remove unused imports in the same change so the surface stays honest — stale imports mask real failures.