Shackell converted a Kieran Trippier corner shortly before the half hour to put the Tykes ahead at Oakwell on Saturday, and Hammill wrapped up the points late on after Boro had wasted a number of chances.
The visitors created far more than in their previous game - a 1-0 victory over Sheffield United - but were made to pay for their lack of composure in front of goal.
The Teessiders have managed just two goals in their opening four league fixtures and must improve significantly if they are to justify their tag as pre-season promotion favourites.
Barnsley boss Robins named an unchanged starting XI, with summer signing Jim O'Brien named among the substitutes after overcoming a thigh problem.
Matthew Bates and Kris Boyd were recalled to the Middlesbrough side in place of Justin Hoyte and Leroy Lita.
Trippier spurned an early opportunity for the hosts when he failed to trouble Jason Steele with a shot from inside the penalty area.
But it was Boro who looked the more likely to open the scoring early on and they came agonisingly close in the 13th minute as Scott McDonald headed against the post from a Barry Robson free-kick.
Tarmo Kink fired narrowly wide soon after as the visitors continued to threaten.
And Barnsley goalkeeper Luke Steele had to make a fine save to deny Boyd after the striker had unleashed a low shot on the turn.
Boro were undoubtedly in the ascendancy, yet it was Barnsley who went ahead in the 28th minute as Shackell headed home from Trippier's left-wing corner.
Hammill fired over and Goran Lovre forced a useful save from Boro stopper Jason Steele as the Teessiders struggled to respond to the setback.
However, Gordon Strachan's side almost pulled level 10 minutes before the break as Boyd's clever lob forced the back-pedalling Luke Steele to save at full-stretch.
Barnsley carved out another chance of their own on the stroke of half-time, but Hugo Colace was unable to keep his header down after being picked out by Lovre.
The lively Hammill brought another save from Jason Steele and curled a second effort over the bar as the Tykes started the second period strongly.
Boro retained an attacking threat of their own but Boyd and Kink were unable to hit the target when presented with opportunities.
Barnsley goalscorer Shackell was forced off in the 59th minute, with O'Brien coming on in his place.
Kink then forced Luke Steele into action on two occasions with shots from distance, but they proved to be the Estonia forward's final contributions as he picked up an injury and was replaced by Andy Halliday.
Luke Steele reacted well again in the 66th minute to tip away a curling free-kick from Barry Robson, before namesake Jason was called into action to deny Hammill at the other end.
Boro huffed and puffed in search of a leveller in the closing stages, but they were unable to find a way past a resilient home defence.
And Hammill rubbed salt in the Teessiders' wounds in stoppage time as he broke clear before firing a low shot beyond Jason Steele.