Most of the time, when I am working in PostgreSQL, I am in DBeaver or DataGrip. Both are useful interfaces for working with many database products. Here is an example from DataGrip, where we are looking at a function definition.

Occasionally I find myself inside a psql prompt without access to my usual tools. PostgreSQL has commands that display database object definitions directly in psql. For functions, I use pg_get_functiondef:
-- Display a function definition in PostgreSQL.
SELECT pg_get_functiondef('function_name_here'::regproc);
The command displays the function definition using its name.

pg_get_functiondef is a useful addition to your PostgreSQL toolbox. The original example is also on GitHub Gist.