After you have learned all the notes of the chromatic scale, you have covered all the starting notes for every scale and arpeggio used in music. Therefore, once you know the formula and fingerings for any scale or arpeggio, you should easily be able to play it in any key (as long as you know all the notes on the fretboard properly).
To be a good musician, it is essential to be able to play equally well in all keys, because throughout the course of your musical life you will be required to play in them all, and often at a moments notice. If you are playing with a singer, you will have to play songs in whatever key suits their particular voice. That could be F# or Db for example. Keyboard players tend to like the keys of C, F and G, while E and A are fairly common keys for guitar. Horn players like flat keys such as F, Bb and Eb. So you can see why it is essential to learn to play equally well in every key.
A good way to learn to play in all keys is to use the key cycle (also called the cycle of 5ths or cycle of 4ths) as a reference. It contains the names of all the keys and is fairly easy to memorize.
Think of the key cycle like a clock. Just as there are 12 points on the clock, there are also 12 keys. C is at the top and it contains no sharps or flats. Moving around clockwise you will find the next key is G, which contains one sharp (F#). The next key is D, which contains two sharps (F# and C#). Progressing further through the sharp keys each key contains an extra sharp, with the new sharp being the 7th note of the new key, the other sharps being any which were contained in the previous key. Therefore the key of A would automatically contain F# and C# which were in the key of D, plus G# which is the 7th note of the A major scale. As you progress around the cycle, each key introduces a new sharp. When you get to F# (at 6 o’clock), the new sharp is called E# which is enharmonically the same as F. Remember that enharmonic means two different ways of writing the same note. Another example of enharmonic spelling would be F# and Gb. This means that Gb could become the name of the key of F#. The key of F# contains six sharps, while the key of Gb contains six flats.
If you start at C again at the top of the cycle and go counterclockwise you will progress through the flat keys. The key of F contains one flat (Bb), which then becomes the name of the next key around the cycle. In flat keys, the new flat is always the 4th degree of the new key. Continuing around the cycle, the key of Bb contains two flats (Bb and Eb) and so on.