Music theory
Today people who want to compose will study music theory, perhaps at college or university school of music.  In a conservatory program, they study harmony and counterpoint as well as form; in other programs, they spend less time on the theories of the past. They will be taught “rules”. These rules are not laws, they simply mean: the way that most great composers wrote music in the past. These rules describe what composers of the past did, rather than telling composers of today what to do -- in fact, music composed today can have completely different rules than the music of the past.