Before you leave, close out your documents, money, and daily-life accounts: get a separation certificate and (if needed) a work permit cancellation certificate, withdraw your housing fund and social insurance balance, settle your taxes, and cancel your phone number, lease, and broadband.
Nationwide (all cities)
Three groups of items
The Guangming District government in Shenzhen lists what a foreigner needs to do before leaving China for good. The items fall into three groups: documents, money, and daily-life accounts.
Documents
On documents: ask your employer for a separation certificate (also called a work experience letter), which states your name, passport number, working period, and position, with the company seal. If your last working day is far from your work permit's expiry date, you must also cancel the work permit and obtain a cancellation certificate from the Bureau of Foreign Experts Affairs; if the two dates are close, cancellation is not required. After the work permit is cancelled, you can apply at the exit-entry department for a 30-day stay visa to cover your remaining time.
Money
On money: if your company contributed to a housing fund, withdraw the remaining balance before leaving. You can also apply to withdraw your social insurance balance, but only after your company has stopped paying your social insurance on your behalf. Before leaving, check your individual income tax records to confirm your employer has fully withheld and paid tax; unpaid tax can lead to late fees, penalties, and damage to your credit in China.
Daily-life accounts
On daily-life accounts: cancel your phone number and SIM card, settle your lease and deposit with your landlord, and cancel your broadband. The Liwan District government in Guangzhou notes that an un-cancelled phone number may be recycled and resold, and un-cancelled broadband keeps charging.
City differences
Note that this is a Shenzhen-oriented checklist from the Guangming District government. Items such as housing fund, social insurance, and tax rules may differ slightly by city; check with the local office in the city where you work.