remove-model-field

Remove NetBox model fields across API, UI, GraphQL, tests, and migrations.

21.3k|3.1k|Updated Feb 29, 2016
One-click install
npx skills add https://github.com/netbox-community/netbox --skill remove-model-field
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: remove-model-field
Source: https://github.com/netbox-community/netbox/tree/main/.claude/skills/remove-model-field
Command: npx skills add https://github.com/netbox-community/netbox --skill remove-model-field

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Removing a model field in NetBox is risky because the field is referenced across models, migrations, serializers, forms, filters, tables, GraphQL, search indexing, tests, and documentation.

Core Features & Use Cases

  • End-to-end removal checklist: Provides a step-by-step workflow that removes outer consumers (API, UI, GraphQL, tests, docs) before updating the model itself.
  • Covers NetBox-specific touch points: Includes explicit guidance for filtersets, serializers, UI panels/templates, GraphQL filters.py and types.py, search.py indexing, and tables.
  • Migration guidance with guardrails: Instructs to generate the migration via makemigrations (not manual edits) and verify it contains only the intended RemoveField operation.

Quick Start

Follow the checklist to remove the specified field from every NetBox integration point, then run the recommended makemigrations and migrate steps to apply the change safely.

Frequently Asked Questions about remove-model-field

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely remove a model field in Django without breaking NetBox serializers and filtersets?

Removing a NetBox model field requires updating tests, documentation, GraphQL, API serializers, forms, filtersets, tables, and search indexing first. This prevents runtime FieldErrors and import failures by ensuring no broken references remain before deleting the model field itself.

What's the best way to handle GraphQL types and filters when deleting a NetBox model field?

When deleting a NetBox model field, clean the GraphQL filter and type declarations in filters.py and types.py. You must also remove both the FK and FK_id companions from FilterSets to prevent GraphQL schema errors.

Do I need to manually edit Django migrations when removing a field from a NetBox model?

No, you should generate the Django migration using makemigrations rather than manual edits. After removing the NetBox model field, verify the generated migration file contains only the intended RemoveField operation before applying it.

Why does removing a foreign key field from a NetBox model cause import failures?

Import failures occur because foreign key fields are referenced across multiple NetBox components including filtersets, tables, and search indexing. Removing a field without cleaning its FK and FK_id companions leaves broken references that trigger Django runtime FieldErrors.

What NetBox components need updating to delete a model field without runtime FieldErrors?

You must update API serializer Meta.fields, filtersets, forms, tables, UI panels, search indexing, tests, and documentation. Verifying that database constraints, indexes, and orderings no longer reference the field is also required to prevent runtime FieldErrors.