What affects coffee quality? When I go to a coffee shop, I see many different coffees. There are these cheap powdered coffees that don't taste too good, ground coffee, and whole coffee beans. On the internet or in specialty shops, you can find even more types of coffee. What could help me judge coffee quality? For example, I know that with tea the rule of thumb is that bigger, looser leaves are of better quality. Moreover, the first harvest is the most precious one. Do similar rules apply to coffee? What are other general rules that signify better coffee?
This is a fairly general question, so pardon me for a slightly generic answer.

First thing you'll want to consider is the quality of the coffee itself.  Typically, the more expensive a coffee is, the higher quality it will be.  It's the age old phrase, 'You get what you pay for".

Secondly, the less steps from it being picked to it being in your cup, the better.  Packaged, ground coffee has more steps (Packaging, grinding) before being brewed.  Whole bean coffee has less.

Third, the longer it's been ground, the longer it has had to degrade.  You'll want to grind your whole-bean coffee as close to the time of brew as possible.  Oxygen will erode the flavor of the coffee over time.  Ground coffee has more surface area to be exposed to oxygen.

I hope this addresses what you were asking properly.