What does Nietzsche mean by the words ' philosophizing with a hammer"?
I believe he uses the phrase "philosophizing with a hammer" to illustrate the process of checking whether idols are 'sound' or 'hallow', whether they are deserving of their status as an idol, such as the strong-willed Dostoevsky and Napoleon, or undeserving weak-willed, 'false idols' like Victor Hugo and Richard Wagner.
For more on what constitutes the strong and weak or how to test an idol, perhaps pose another question.
Evidence: Because this is a fairly well accepted notion of philosophizing with a hammer I will not go into great detail providing evidence for my claim. Nietzsche is a very straight forward philosopher and his words in the preface of the book, The Twilight of Idols, Or Philosophizing with a Hammer, typically speak for themselves.
Another mode of convalescence (in certain situations even more to my liking) is sounding >out idols. There are more idols than realities in the world: that is my "evil eye" upon >this world; that is also my "evil ear." Finally to pose questions with a hammer, and >sometimes to hear as a reply that famous hollow sound that can only come from bloated >entrails — what a delight for one who has ears even behind his ears, for me, an old >psychologist and pied piper before whom just that which would remain silent must finally >speak out....
Here Nietzsche describes his feeling about idols - most are not real (idols illustrate or claim a particular reality, but they cannot all be correct. In their number they provide too many different, contradicting claims).
This little essay is a great declaration of war; and regarding the sounding out of idols, >this time they are not just idols of the age, but eternal idols, which are here touched >with a hammer as with a tuning fork: there are no idols that are older, more assured, more >puffed-up — and none more hollow.
In metaphor, Nietzsche describes how the hammer is used, like a 'tuning fork' to examine idols naturally looked upon for many years or centuries and evaluate their quality. Humanity's idols who are truly strong should be timeless, and not merely a coincidence of their time. Rather than take for granted that historic figures heralded today are indeed great, Nietzcshe believes we should investigate and assess them more closely.
Here is another example of the hammer's role, in a section from Thus Spoke Zarathustra's poem "The Hammer Speaks"
Why so hard?" the kitchen coal once said to the diamond. "After all, are we not close kin?"
Why so soft? O my brothers, thus I ask you: are you not after all my brothers?...
Blessedness to write on the will of millennia as on bronze — harder than bronze, nobler >than bronze. Only the noblest is altogether hard.
Finally, Nietzsche often references Napoleon, Dostoevsky, Victor Hugo, and Richard Wagner throughout his works and discusses the former two's strength and the latter's weaknesses. For instance, in the Twilight of Idols and within the chapter "Skirmishes of an Untimely Man," paragraph/aphorism 1 titled, "My impossible Ones" Nietzsche lists several writers and thinkers including Victor Hugo and reduces each to a negative quip, often about their foolish romanticism or logic. In paragraph/aphorism 44, "My conception of Genius," he discuss Napoleon and his genius that was allowed to emerge because of particular moment in time.
His meaning was two-fold: 1) Neglect the traditional subtleties associated with 'polite debate'/'fencing' and instead go for the kill-shot (fencing is simply a type of self-deception and strokes one's ego in favor of defeating one's opponent) and 2) The hammer can completely and quickly destroy an opponent's argument (idol) when the strike is forceful and focused upon a flaw (imperfection present on the idol) i.e., one could destroy a very large Idol (Christisnity) with a very small hammer if the hammer strike lands upon a critical flaw (pick any contradiction presented within the Bible, couple this with the promoted 'infalibility' of the Bible) on the surface of a monumental Idol. There is one caveat regarding force and the size of the hammer--he also argues that sometimes, a very small hammer, can softly strike an imperfection on the surface of an Idol, one that appears to be unbreakable, and completely destroy the Idol.