I need help writing a shader for a 2D URP game

I really don’t know where to begin, I am self taught with C# and know more than the average user and can probably do most things but shaders are stressful and hard for me to grasp so writing one is proving difficult. I need to write a lit 2D shader that writes to the depth buffer so unitys post processing DoF will work.

Not sure how to be more descriptive than that, I’ve tried some things but cannot get unity to write to the depth buffer and don’t have any clue what I am doing. I wrote a shader with the math I need to get the objects depth by using the math stated in the docs for the remap node of shader graph to insert the objects world position z coordinates. I am trying to now write that to the depth buffer. Not sure where top go from there.

My code so far

Do I need to write a custom SRP render feature? Can I do what I am needing to do in just a single shader pass like I’ve been trying? I tried real hard to get what I’ve got so far without errors and it writes the alpha in a crazy way that looks all kinds of messed up but I can still play around with the DoF and I see no change it still blurs everything evenly.