How to add field to already existing form through code

I have a form in erpnext Stock > Item.
Now I want to add field in this form using code.

Add a new field in existing doctype of ERPNext (Through Customization):
https://erpnext.com/docs/user/manual/en/customize-erpnext/custom-field

Add a new field in your own doctype:
https://frappe.io/docs/user/en/tutorial/doctypes