Date: 202009
Local time of day: 0001-0600
Location: ZZZ.TRACON, US
Flight conditions: IMC
Aircraft: Commercial Fixed Wing
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Mission: Passenger
Flight phase: Climb
Airspace: Class B ZZZ
ATC / advisory: Tower ZZZ
Reporter organization: Air Carrier
Reporter function: Pilot Not Flying; Captain
Reporter qualification: Flight Crew Multiengine; Flight Crew Instrument; Flight Crew Air Transport Pilot (ATP)
Human factors: Training / Qualification; Situational Awareness
Second reporter function: First Officer; Pilot Flying
Anomaly: Deviation - Track / Heading All Types; Deviation / Discrepancy - Procedural Clearance
Detector: Person Flight Crew
When detected: In-flight
Result: Flight Crew Returned To Clearance
Contributing factors: Procedure; Human Factors; Environment - Non Weather Related
Primary problem: Human Factors

Narrative: I am writing this narrative in regards to a possible pilot deviation from earlier today date at ZZZ around XA:45 local time. My ZZZ1 based First Officer (FO) and I (ZZZ2 based Captain) were working Aircraft X to ZZZ3 and were cleared to depart Runway XX L with a climb via the ZZZZZ2. This SID has an initial heading of 356 and a slight right turn to 013 before reaching the first fix of ZZZZZ1. With that said; the event went as follows: we were cleared to takeoff; RNAV to ZZZZZ1; FO executed a standard ALT-To takeoff and rotated at VR. At acceleration altitude; (around 1;400 feet MSL or 800 AGL); I was given a frequency change to departure and we entered IMC 100 feet later at 900 AGL. I switched; but the wrong frequency was programmed in so I went back to my chart to locate the proper one. I also completed the after takeoff flow and noticed a drift to the right of the course. The Departure Controller was talking to another airplane and then started to call our call sign instructing us to fly a heading of north. First Officer was still hand flying and complied. The Controller stated that we were within a few miles of Aircraft Y climbing off Runway XY at ZZZ4. Neither of us got an RA but we did get a TA. The rest of the departure was uneventful and we landed just under an hour later in ZZZ3. My FO was following the flight director. I did verify that the correct runway and SID was programmed in the FMS. I believe FO started to drift and when the flight director made the right turn for the SID FO overreacted not fully realizing we were already to the right of the course. According to the track log; we got to a heading of 085 at 2300 feet MSL (1;600 AGL) before we started correcting back to the north. This entire event lasted under 45 seconds from takeoff. My FO is trying to complete hours for consolidation; was the pilot flying. FO was hired last year but didn't fly enough to consolidate; plus COVID hit and the base was closed for several months. FO had flown three legs prior in the sequence and FO's flying was up to standards. This was [the] FO's first real encounter with IMC conditions below a couple thousand feet. I think everything was moving faster than FO expected and just started to drift then over shot the turn due to the flight director's abrupt movement.It's my opinion that FO should really focus on maintaining the directions on the SID and to double check before making turns when hand flying a SID.


Second narrative: I was pilot flying; this was the second leg of the day and also my second leg of pilot flying for the day. Everything had been programmed; verified; and confirmed for the ZZZZZ 2 RNAV departure off of Runway XXL. As we were climbing out I knew to expect a right hand turn to 013. Meanwhile; the Captain was heads down programming the Departure Frequency. The profile was flown correctly and as I called for the after takeoff checklist; the flight director started to make the right hand turn; I followed the flight director and then realized that I was going off course to the right and was on a heading of 050 and needed to correct to the left; and as I was going to ask the Captain to verify that I needed to not follow the flight director; ATC called to give us a heading of 360. I immediately complied with that heading and then we received a traffic advisory within 5 miles and 1;000 feet. I believe it was 1;000 feet below. This all happened in a matter of 30 to 45 seconds in Instrument Meteorological Conditions. After the heading of 360 we complied with the next heading of 085 and then direct to a fix. Even after the event we went back to verify; once again; that the correct departure was in with the correct sequencing and courses and it was. I am a low time pilot. I only have XYZ hours in the aircraft and XX hours towards the second round of consolidation at the completion of this day. I was released from IOE on date. I then sat airport standby for almost 2 months straight with little actual flying. I was scheduled for consolidation flying in March and with approximately XX hours in the airframe flew with a crewmember who tested positive for COVID-19. I was then removed from duty to quarantine for 14 days. I was unable to complete consolidation and was sent to recurrent/retraining training in May. Due to the COVID-19 pandemic I did not fly an aircraft again until July. Since then I have just over XX more hours in the airframe and seat.I believe the cause is lack of flying time; and over reliance on automation. I was flying the flight director but it was giving erroneous readings. Suggestions for erroneous flight director guidance in simulator scenarios.


Synopsis: Air carrier flight crew reported a track heading deviation and cited First Officer's lack of flying as a contributing factor.