@Override
    public Model onRemove(ModelTransformer transformer, Collection<Shape> shapes, Model model) {
        // Find all shapes with the "@trait" trait to ensure references to it are removed
        // from other shapes.
        Set<ShapeId> removedTraits = shapes.stream()
                .filter(shape -> shape.hasTrait(TraitDefinition.ID))
                .map(Shape::getId)
                .collect(Collectors.toSet());

        if (removedTraits.isEmpty()) {
            return model;
        } else {
            LOGGER.fine(() -> String.format("Detected the following removed traits: %s", removedTraits));
            return transformer.replaceShapes(model, determineShapesToUpdate(model, removedTraits));
        }
    }
Removes traits from shapes when trait definitions are removed.
smithy-model/src/main/java/software/amazon/smithy/model/transform/plugins/RemoveTraits.java