[proofplan]
We construct an explicit antiderivative on the star-shaped domain by integrating along straight-line segments from the star centre. The triangle version of Cauchy's theorem guarantees path-independence of this construction, and the standard difference-quotient argument shows the antiderivative is holomorphic with derivative equal to $f$. The [Fundamental Theorem of Contour Integration](/theorems/339) then gives vanishing of all closed-path integrals.
[/proofplan]
[step:Define the antiderivative by integrating from the star centre]
Let $a_0 \in U$ be a star centre of $U$. For each $z \in U$, the segment $[a_0, z]$ lies entirely in $U$ by the star-shaped property. Define
\begin{align*}
F: U &\to \mathbb{C} \\
z &\mapsto \int_{[a_0, z]} f(w) \, dw.
\end{align*}
[/step]
[step:Show $F$ is holomorphic with $F' = f$ using the triangle theorem]
Fix $z \in U$ and choose $\varepsilon > 0$ such that $B(z, \varepsilon) \subseteq U$. For $|h| < \varepsilon$, the three segments $[a_0, z]$, $[z, z+h]$, and $[z+h, a_0]$ each lie in $U$ by star-shapedness ($a_0$ sees both $z$ and $z+h$, and $[z, z+h] \subseteq B(z, \varepsilon) \subseteq U$). The convex hull of $\{a_0, z, z+h\}$ is a triangle contained in $U$. By [Cauchy's theorem for triangles](/theorems/341):
\begin{align*}
\int_{[a_0, z]} f(w) \, dw + \int_{[z, z+h]} f(w) \, dw + \int_{[z+h, a_0]} f(w) \, dw = 0.
\end{align*}
Rearranging: $F(z+h) - F(z) = \int_{[z, z+h]} f(w) \, dw$. Parametrise $[z, z+h]$ by $w = z + th$, $t \in [0,1]$, so $dw = h \, dt$:
\begin{align*}
\frac{F(z+h) - F(z)}{h} = \int_0^1 f(z + th) \, dt.
\end{align*}
As $h \to 0$, the integrand $f(z + th)$ converges uniformly in $t \in [0,1]$ to $f(z)$ (since $f$ is continuous). Therefore $F'(z) = f(z)$.
[guided]
The key geometric observation is that for any $z \in U$ and $h$ small enough, the triangle with vertices $a_0, z, z+h$ lies entirely in $U$.
This uses two facts:
(i)
$a_0$ sees every point of $U$ via a straight line (star-shapedness), so $[a_0, z]$ and $[a_0, z+h]$ lie in $U$; (ii)
$[z, z+h]$ lies in $B(z, \varepsilon) \subseteq U$.
The triangle's convex hull is contained in $U$ because $U$ is star-shaped with centre $a_0$.
Applying [Cauchy's theorem for triangles](/theorems/341) to this triangle shows that the integral around the boundary vanishes.
Since the boundary consists of $[a_0, z] + [z, z+h] + [z+h, a_0]$, and $F(z) = \int_{[a_0,z]} f$ while $F(z+h) = \int_{[a_0,z+h]} f = -\int_{[z+h,a_0]} f$, we get $F(z+h) - F(z) = \int_{[z,z+h]} f$.
The difference quotient then reduces to $\int_0^1 f(z+th) \, dt$ via the parametrisation $w = z+th$.
Since $f$ is continuous, $|f(z+th) - f(z)| < \delta$ uniformly in $t$ for $|h|$ small, so the integral converges to $f(z)$.
[/guided]
[/step]
[step:Conclude vanishing of all closed-path integrals via the Fundamental Theorem]
Since $F$ is an antiderivative of $f$ on $U$ (that is, $F$ is holomorphic with $F' = f$), the [Fundamental Theorem of Contour Integration](/theorems/339) gives
\begin{align*}
\int_\gamma f(z) \, dz = F(\gamma(b)) - F(\gamma(a)) = 0
\end{align*}
for every closed piecewise $C^1$ path $\gamma: [a, b] \to U$ (since $\gamma(a) = \gamma(b)$).
[/step]