I'm reading a proof of Lemma 8.2. from this lecture note.
Lemma 8.3. Let $M$ be an $m$-manifold, $W$ an open set in $M$, and $f: W \to \mathbb{R}$ a smooth function. Suppose that $x \in W$. Then there is a smooth function $g: M \longrightarrow \mathbb{R}$ which agrees with $f$ on some neighbourhood of $x$ in $W$.
Proof. We need the following result, i.e.,
Lemma 8.2. There is a smooth function $\theta: M \longrightarrow[0,1]$ such that $\theta =0$ on $M \setminus W$ and that $\theta = 1$ on some neighbourhood of $x$.
Let $\theta: M \longrightarrow[0,1]$ be the function given by Lemma 8.2, and set $g(y)=f(y) \theta(x)$ for $y \in W$ and $g(y)=0$ for $x \notin W$. $$\tag*{$\blacksquare$}$$
My understanding If $y \in W$ then $g$ is smooth at $y$ by chain rule. Now let $y \notin W$. If $y \in M \setminus \overline W$, then $g$ is smooth at $y$ because there is some neighborhood $O$ of $y$ in $M \setminus \overline W$ such that $\theta = 0$ on $O$.
Could you explain how to prove that $g$ is smooth at $y \in \partial W$?
The original author makes a little mistake in their argument: they never require for $\theta$ to have compact support in $W$. Therefore, $\theta f$ could be undefined on $\partial W$, for instance, if $f$ blows up faster than $\theta$ crashes there. However, this is not a big mistake and this can be fixed easily, by taking $\theta$ with compact support in $W$ (same proof than that of lemma 8.2, replacing $W$ with $W'\subset W$ precompact).