360 Secure SkillHub
360 安全技能中心

Refactoring Api

该技能用于保持行为不变的前端重构,聚焦函数 API 形态、标志、依赖、可变性、构造方式与命令/函数取舍。内置 10 种规范技术,含意图、适用信号、禁用条件、操作步骤、保护检查点,并提供 JS/TS/React/Vue 适配与示例。使用流程为:先确认前置条件与影响行为,一次只应用一种技术并立即验证,避免单次改动混合多种意图。适合需安全演进公共契约或内部 API 的场景。

bovinphang
bovinphang
热度 16.60
最近更新 2026-09-26 23:17:52
分类:开发依赖:读写文件 / 代码执行应用场景:代码生成 / 代码审查

安装技能

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

执行命令安装此 skill: npx secure-skills-cli add fec-refactoring-api
Metadata
name
fec-refactoring-api
description
Use when behavior-preserving frontend refactoring focuses on function API shape, flags, dependencies, mutability, construction, or command/function trade-offs, and the selected technique needs family-specific mechanics, risks, and JavaScript/TypeScript/React/Vue adaptation.

API Refactorings

Overview

Use this family after evidence identifies a fitting structural transformation. Apply one primary technique at a time and verify immediately.

Procedure

  1. Confirm the selected technique and its preconditions in API Refactorings.
  2. Record affected behavior and a diff budget.
  3. Apply only the selected technique's smallest viable step.
  4. Verify the step before composing another transformation.
  5. Stop and reassess when public contracts, lifecycle, state identity, or actual scope exceed expectations.

Quick Reference

The family reference contains 10 canonical techniques with intent, signals, avoid conditions, mechanics, preservation checkpoints, smell links, composition hints, JavaScript/TypeScript notes, React/Vue notes, adaptation guidance, and original frontend examples.

Common Mistakes

  • Choosing a technique by name without checking its preconditions.
  • Combining several structural intentions in one diff.
  • Assuming a classical class-based form is mandatory in modern frontend code.
  • Treating passing tests as proof when the relevant behavior is not covered.