Rinse and drain black beans; mince. Drain clams, reserving 3/4 cup juice.
In a 5- to 6-quart pan over high heat, bring 3 quarts water to a boil. Add spaghetti and cook, stirring occasionally, until tender to bite, 7 to 9 minutes; drain. Rinse in cold water.
In the same pan, heat oil over medium-high heat. Add black beans, garlic, and, if desired, chili flakes; stir until fragrant, 1 to 2 minutes. Add clams, reserved clam juice, and wine. Bring to a boil and cook for 1 minute. Stir in spaghetti and cook until heated through, 1 to 2 minutes. Pour into a serving bowl and sprinkle with cilantro.