(How) do you write technical specifications when adding complex new features?

When adding a complex new feature, how do you plane it in advance? Do you write a technical specification? What level of detail do you go into? How do you document how the new feature interacts with existing code?
If you write technical specs for an open source software, or your company is willing to make a technical spec public, I’d love to see it.

Link: https://dev.to//_bigblind/how-do-you-write-technical-specifications-when-adding-complex-new-features-19db