Always remember it this way: they must match in number, gender and case. But they could have different endings, especially if they are in different declensions.
Agricola bonus -- the good farmer. Those two words match in number (singular), gender (masculine) and case (nominative), but "Agricola" is first declension, and the masculine form of "bonus" has to appear in the second declension.
The same coudl be said of Miles bonus, the good soldier, miles being third declension nominative masculine singular.
Or, for example, Miles fortis (the strong soldier) features a third declension noun and adjective, both nominative masculine singular. Yet the endings are still not the same because not all third declension words form their nominative the same way.