Flight Crew Instrument; Flight Crew Multiengine; Flight Crew Air Transport Pilot (ATP)
Communication Breakdown; Confusion; Situational Awareness
Conflict NMAC; Deviation - Altitude Excursion From Assigned Altitude; Deviation / Discrepancy - Procedural Published Material / Policy; Deviation / Discrepancy - Procedural Clearance
Air Traffic Control Separated Traffic; Flight Crew Took Evasive Action
Procedure; Human Factors
This event was in my opinion a near miss. We were at 3;000 feet on a visual approach to runway XXR. Saw on TCAS a target 100 feet below us off left side of Aircraft. ATC said traffic alert turn right 150. Just then we got TCAS RA alert descend; descend now immediately followed by climb climb now. Followed SOP and complied with alert we never visually acquired traffic. After talking with ATC supervisor; he informed me it was Aircraft Y transitioning Class B to ZZZ2.  He was at 2;500 feet initially; then for some reason as he approached us he pulled up to 2;800 feet (our TCAS showed him at 2;900 feet; 100 feet below us) once he saw us he descended back down to 2;200 feet and turned west. I do not know if this classifies as a near miss; but it was way too close for my comfort.  Aircraft Y never entered Class B; so now [no] rules were broken; but I think the other pilot used questionable judgement being so close to arriving ZZZ traffic and climbing to within 100 to 200 feet of Class B airspace.There must be another area to transition to ZZZ1 from the west that doesn't involve flying so close to ZZZ arriving aircraft.  Maybe a 2;000 feet ceiling under the approach corridor for ZZZ?
Pilot reported evasive action to avoid another aircraft identified by the aircraft TCAS system.