360 Secure SkillHub
360 安全技能中心

Code Smells

该技能用于在重构前诊断现有前端代码的结构维护性问题:先界定范围并收集结构与变更耦合证据,匹配24种坏味道目录,执行误报检查,输出包含位置、证据、坏味道、影响、置信度、候选重构和优先级的发现报告;默认只诊断,不修改业务代码。适合需要评估重构切入点、避免误判和自动改码的场景。

bovinphang
bovinphang
热度 7.62
最近更新 2026-09-26 22:55:50
分类:开发依赖:读写文件应用场景:代码审查 / 报告撰写

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add fec-code-smells
Metadata
name
fec-code-smells
description
Use when diagnosing structural maintainability problems in existing frontend code before deciding how to refactor it, especially when evidence, false-positive checks, and candidate transformations are needed without editing business code.

Code Smell Diagnosis

Overview

Diagnose structural problems from concrete evidence. A smell is a prompt to investigate, not proof that code must change.

Procedure

  1. Establish the requested scope and project facts.
  2. Collect concrete structural and change-coupling evidence.
  3. Match evidence against the smell catalog.
  4. Apply false-positive checks.
  5. Report confidence, impact, and candidates from the mapping guide.
  6. If the request is diagnosis-only, do not modify business code.

Finding Contract

Every finding states location, evidence, smell ID/name, impact, confidence (HIGH, MEDIUM, LOW), candidate refactorings, priority, and material false-positive considerations. LOW confidence is never an automatic-edit signal.

Quick Reference

Need Reference
Standard 24-smell model Smell catalog
Evidence and false positives Detection guide
Candidate refactorings Smell-to-refactoring map

Common Mistakes

  • Treating a metric threshold as proof.
  • Reporting a smell without a file/symbol and evidence.
  • Treating every loop, switch, comment, wrapper, or pipeline as defective.
  • Editing code when the user asked for diagnosis only.