Track your days in Puerto Rico for the Bona Fide Residency presence test. Being present in Puerto Rico for at least 183 days during the tax year is one way to satisfy the presence test. You must also meet the tax home and closer connection requirements to qualify as a bona fide resident. Other presence-test alternatives may apply.
IRS Publication 570 — Tax Guide for Individuals With Income From U.S. Territories: https://www.irs.gov/publications/p570