I have to prove of disprove the following fact:
Let $(X,d)$ be a metric space and $f: X \rightarrow \mathbb{R}$ be a continuous function. Then $f$ extends continuously to the completion $(\bar{X},\bar{d})$, i.e., there is a continuous map $\bar{f}: \bar{X} \rightarrow \mathbb{R}$ such that $\bar{f} \mid_X=f$.
I think this is not true and to disprove I though of giving this counter example. Take $f(x)= \frac{1}{x}$. Clearly $f(x)$ is continuous on $\mathbb{R}\setminus \{0\}$. And also $\mathbb{R}\setminus \{0\}$ is not complete since the sequence $a_n= \frac{1}{n}$ is a Cauchy sequence but doesn't converge on $\mathbb{R}\setminus \{0\}$. The completion of $\mathbb{R}\setminus \{0\}$ is $\mathbb{R}$ but $f(x)$ is not continuous on $\mathbb{R}$, so we get our desired contradiction.
Is my solution right?
Yes, your example is correct...