In the Jensen-Kunen manuscript on combinatorial principles, they define the notion of a subtle cardinal:
Definition. A regular cardinal $\kappa$ is subtle if for all $C$ club, $(A_\alpha)_{\alpha\in C}$ a sequence such that $A_\alpha\subseteq\alpha$ for all $\alpha$, there exists $\alpha,\beta\in C$ such that $\alpha<\beta$ and $A_\alpha=\alpha\cap A_\beta$.
They then proceed to show that $\lozenge(\kappa)$ holds for $\kappa$ subtle with the following argument:
By induction on limit $\alpha<\kappa$ define $(S_\alpha,C_\alpha)$ such that $S_\alpha\subseteq \alpha$, $C_\alpha$ club in $\alpha$ and $\forall\gamma\in C_\alpha\;S_\gamma\ne\gamma\cap S_\alpha$ if possible.
Claim: Let $S\subseteq\kappa$, then $\{\alpha<\kappa\;\vert\;S\cap\alpha=S_\alpha\}$ is stationary.
Proof: Suppose not. Then there is a pair $(S,C)$, $C$ club in $\kappa$ and $\forall\alpha\in C\;S_\alpha\ne\alpha\cap S$.
Let $C^*$ be the set of limit points in $C$. Then $a\in C^*\to\forall\gamma\in C_\alpha\;S_\gamma\ne\gamma\cap S_\alpha$.
By the subtlety of $\kappa$, however, there are $\alpha,\beta\in C^*$ such that $\alpha<\beta$, $C_\alpha=\alpha\cap C_\beta$, $S_\alpha=\alpha\cap S_\beta$. Hence $\alpha\in C_\beta$. Contradiction!
I'm trying to understand this proof but have a few questions. First of all, how do we know that $C_\alpha$ and $C_\beta$ are defined? The definition of $(S_\alpha,C_\alpha)$ says "if possible" so what if at $\alpha,\beta$ it is not possible to find these sets?
Secondly, the definition gives us a way to find $\alpha,\beta$ such that $A_\alpha=\alpha\cap A_\beta$, but how does one do this for $(S_\alpha,C_\alpha)$ simultaneously as in the proof? Would it be necessary to code $\kappa\times\kappa$ with $\kappa$ by some bijection?
Regarding your first question: Say that we've constructed $((S_\alpha, C_\alpha) \mid \alpha < \beta)$ for some $\beta < \kappa$. There are two cases:
$(\dagger)$If there is some $S \subseteq \alpha$ such that $\{ \beta < \alpha \mid S_\beta \neq S \cap \beta \}$ is non-stationary, we may fix a club $C \subseteq \alpha$ such that for all $\beta \in C \colon S_\beta \neq S \cap \beta$. In this case let $C_\alpha := C$ and $S_\alpha := S$. (We need some choice to pick these $C$'s and $S$'s at every stage.)
Otherwise let $C_\alpha := S_\alpha := \alpha$.
Before we repeat the proof with more details, let us verify the following:
Lemma. Let $\kappa$ be subtle. Then for every club $C \subseteq \kappa$ and for every sequence $( (A_\alpha, B_\alpha) \mid \alpha < \kappa)$ such that $A_\alpha, B_\alpha \subseteq \alpha$ there exist $\alpha < \beta$ such that $\alpha, \beta \in C$, $A_\alpha = A_\beta \cap \alpha$ and $B_\alpha = B_\beta \cap \alpha$.
Proof. For each $\alpha < \kappa$ let $C_\alpha := \{ \langle x, y \rangle \mid x \in A_\alpha, y \in B_\alpha \} \cap \alpha$, where $\langle ., . \rangle \colon \operatorname{Ord} \times \operatorname{Ord} \to \operatorname{Ord}$ is the Gödel pairing function. Fix a club $D \subseteq \kappa$ such that for all $\alpha \in D$ we have $x,y < \alpha \to \langle x,y \rangle < \alpha$. (Since $\kappa$ is regular, such a club exists. You can use the normal function theorem to prove this.)
Now $E := D \cap C$ is a club and since $\kappa$ is subtle, there exist $\alpha < \beta$ such that $\alpha, \beta \in E$ and $C_\alpha = C_\beta \cap \alpha$. Since $\alpha$ is closed under the Gödel pairing function, we may recover all of $A_\alpha$ and all of $B_\alpha$ from $C_\alpha$. In fact, we have $$ A_\alpha = \{ x < \alpha \mid \exists y < \alpha \colon \langle x,y \rangle \in C_\alpha \} $$ and similarly for $B_\alpha, A_\beta, B_\beta$.
Hence $A_\alpha = A_\beta \cap \alpha$ and $B_\alpha \cap B_\beta \cap \alpha$. Q.E.D.
Let $((S_\alpha, C_\alpha) \mid \alpha < \kappa)$ be the sequence that we've constructed above.
Claim. $(S_\alpha \mid \alpha < \kappa)$ witnesses $\Diamond_\kappa$.
Proof. Suppose not. Then there is some $A \subseteq \kappa$ such that $\{ \alpha < \kappa \mid S_\alpha = A \cap \alpha \}$ is not stationary. Fix a club $C \subseteq \kappa$ such that for all $\alpha \in C \colon A \cap \alpha \neq S_\alpha$ and let $C^*$ be the club of all limit points of $C$. If $\alpha \in C^*$, then $C \cap \alpha$ is a club in $\alpha$ and for all $\beta \in C \cap \alpha \colon A \cap \beta \neq S_\beta$. Therefore, in our construction, we could have picked $C_\alpha := C \cap \alpha$ and $S_\alpha := A \cap \alpha$. In particular, for all $\alpha \in C^*$ we are in the "first case" $(\dagger)$ of our construction.
By the Lemma above, we may now pick $\alpha < \beta$, $ \alpha, \beta \in C^*$ such that $C_\alpha = C_\beta \cap \alpha$ and $S_\alpha = S_\beta \cap \alpha$. Since $C_\alpha$ is unbounded in $\alpha$ and $C_\beta$ is closed, we have $\alpha \in C_\beta$. But $S_\beta \cap \alpha = S_\alpha$ - contradicting the fact that we have been in the "first case" $(\dagger)$ of our construction at stage $\beta$. Q.E.D.