For context, I've been playing chess for around two years now, and my rating on Lichess is ~1850.
When I first started playing, I learned a lot of heuristics for playing well, e.g. rooks are better than knights/bishops, castling is good (maybe better than you think, as a beginner), trade down when you're up in material. As I got better I started learning exceptions to these rules -- a strong knight might be better than a passive rook, the king is better uncastled in the endgame, don't make "even trades" when they're not really even (e.g. if you have to make concessions to your pawn structure).
For all of these examples my intuition eventually caught up to the rules I was following blindly. To a beginner all rooks are better than all knights, because it's hard to judge when pieces are strong -- this instinct only came after watching many more in-depth analyses of games where one player sacrificed the exchange.
But there is one rule that I never learned to break, and that is "never play f3/f6" (at least, when I'm castled kingside). To me it's clear why I shouldn't --, sinc it often often creates weaknesses in front of my king, and there have been many games in my past where pushing the f-pawn was the losing move. But it's never obvious when I should -- for. For example, in some of my game analyses the engine says that f3/f6 was the best move, but I can't see the idea behind it. (When it's the only move to prevent getting mated or forked, it's a bit clearer, so I guess I'm asking about the positional ideas behind it.)
So --, when doshould I play f3/f6? I'm specifically asking this without reference to any opening, as a rule of thumb akin to the ones I brought up above.
EDIT: It'sNote that it is also easier for me to move my f-pawn when it gives me another clear positional advantage. For example I might not mind the weaknesses that arise from capturing an e-pawn because I build a stronger center. This is a bit of a contradiction with the opening-agnostic viewpoint I'm trying to have, but I guess I am asking specifically about the case of "dry" positions with a lot of meandering and no clear path.