Claude-skill-registry field-consistency-check

检查前后端字段名一致性。自动比较后端 Entity 与前端 Interface 的所有字段,发现缺失或不一致的字段。使用此 Skill 确保数据模型统一。

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/field-consistency-check" ~/.claude/skills/majiayu000-claude-skill-registry-field-consistency-check && rm -rf "$T"
manifest: skills/data/field-consistency-check/SKILL.md
source content

字段一致性检查 Skill

Entity/Interface 映射表

后端 Entity前端文件Interface 名
CustomercustomerApiClient.tsCustomer
SuppliersupplierApiClient.tsSupplier
UseruserApiClient.tsUserDTO
FactoryplatformApiClient.tsFactoryDTO
FactoryEquipmentequipmentApiClient.tsEquipment
MaterialBatchmaterialBatchApiClient.tsMaterialBatch
RawMaterialTypematerialTypeApiClient.tsMaterialType
ProductTypeproductTypeApiClient.tsProductType
QualityInspectionqualityInspectionApiClient.tsQualityInspection
ShipmentRecordshipmentApiClient.tsShipmentRecord
DisposalRecorddisposalRecordApiClient.tsDisposalRecord

快速检查命令

cd /Users/jietaoxie/my-prototype-logistics

# 提取后端字段
grep -E "private (String|Long|Boolean|Integer|BigDecimal|LocalDateTime)" \
  backend-java/src/main/java/com/cretas/aims/entity/Customer.java | \
  grep -v "//" | awk '{print $3}' | sed 's/;//' | sort

# 提取前端字段
awk '/export interface Customer \{/,/^\}/' \
  frontend/CretasFoodTrace/src/services/api/customerApiClient.ts | \
  grep -E "^\s+\w+[\?:]" | awk '{print $1}' | sed 's/[?:]//' | sort

# 对比差异
comm -23 /tmp/be.txt /tmp/fe.txt  # 只在后端
comm -13 /tmp/be.txt /tmp/fe.txt  # 只在前端

字段命名差异表

Entity电话字段地址字段
FactorycontactPhoneaddress
SuppliercontactPhone + phoneaddress
CustomercontactPhone + phoneshippingAddress + billingAddress
Userphone-

修复流程

  1. 查看后端字段:
    grep -E "private" entity/XXX.java
  2. 更新前端 Interface 与后端一致
  3. 编译检查:
    npx tsc --noEmit --skipLibCheck

相关路径

  • 后端 Entity:
    backend-java/src/main/java/com/cretas/aims/entity/
  • 前端 API:
    frontend/CretasFoodTrace/src/services/api/