I want to improve my code quality, how can I train to achieve this?

That’s a good and important question, and I think there is no easy answer, but here are some thoughts.

  • Respecting language idioms and project conventions requires that you have all those idioms and conventions at hand. Yes, that means learning them by heart, but this does not need to happen all at once.
  • Passing linter checks can be achieved by, well, running linters on your code and adjusting the code as required. This is a technical problem with a technical solution. No one expects that your code is perfect on the very first linter run.
  • The remaining two bullet points, SOLID and high-quality code, are certainly the toughest ones. I guess you cannot take shortcuts here but have to
    • read a lot of other people’s code, ideally that others already have reviewed and tagged as high- or low-quality (and provided reasons for their judgement).
    • write a lot of code and have it reviewed by experienced devs. Don’t be embarrassed by bad code that you wrote, you can always refactor it.
    • learn to write good tests. Quality is measured in numbers of bugs and robustness in the face of rare edge cases, so if you know how to test your code well, you know how to maintain quality.
2 Likes