How to safely edit the code?

Hello!, how to safely edit the code .py .js .json without harm to the system so that when the system is updated it does not break?

Thank!