It is up to the user.
Run it on battery whenever necessary and keep it plugged in whenever possible.
When CPU/GPU heavy tasks are run, always plug it in.
Shut the Mac down, when you move the computer or cleaning it.
Section: Tips for MacBooks
https://www.apple.com/uk/batteries/maximizing-performance/
macOS manages battery health now.
How battery health management helps
Quote:
The battery health management feature in macOS 10.15.5
is designed to improve your battery's lifespan by reducing the rate at which it chemically ages.
The feature does this by monitoring your battery's temperature history and its charging patterns.
Based on the measurements that it collects, battery health management may reduce
your battery's maximum charge when in this mode.
This happens as needed to ensure that your battery charges to a level that's optimized for your usage
—reducing wear on the battery, and slowing its chemical aging.
Battery health management also uses the measurements to calculate when your battery needs service.
https://support.apple.com/en-us/HT211094?cid=mc-ols-energy_saver-article_ht211094-macos_ui-04022020
Battery condition
You can check the health of your battery in Battery preferences or the Battery status menu:
Quote:
You'll see one of the following status indicators:
- Normal: The battery is functioning normally.
- Service Recommended: The battery's ability to hold charge is less than when it was new or it isn't functioning normally. You can safely continue to use your Mac but you should take it to an Apple Store or Apple-authorized service provider to get your battery evaluated.
https://support.apple.com/en-us/HT204054
About battery cycles
https://support.apple.com/en-us/HT201585
Battery troubleshooting steps:
If your Mac battery won’t charge
If your Mac battery runs out of charge quickly
If your Mac battery status is “Not Charging”
https://support.apple.com/guide/mac-help/if-your-battery-wont-charge-completely-mchlbfb7e12a/mac