Step 1: Spray the slow cooker with cooking spray or lightly grease it. Place chicken breasts or thighs in the slow cooker.
Step 2: Add chopped onion, minced garlic, chicken broth, salt, black pepper, and dried Italian herbs if using. Stir gently to combine.
Step 3: Cover and cook on low for 3–4 hours or on high for 2–3 hours, until chicken is fully cooked and tender.
Step 4: Remove chicken from the slow cooker and shred with two forks. Return shredded chicken to the slow cooker.
Step 5: Add pasta, heavy cream, and pesto sauce to the slow cooker. Stir to combine and ensure pasta is mostly submerged in liquid.
Step 6: Cover and cook on high for 15–20 minutes, stirring occasionally, until pasta is tender and creamy.
Step 7: Stir in shredded mozzarella and grated Parmesan cheese until melted and fully incorporated. Taste and adjust seasoning with salt and pepper.
Step 8: Garnish with fresh basil or parsley and serve immediately.