Why do we pass to fraction fields of domains of residue? To look at an arbitrary commutative ring $R$ as a ring of continuous functions on its spectrum, we define the evaluation map $R\rightarrow R/\mathfrak p\rightarrow \kappa(x)$ for $x=\mathfrak p\in\operatorname{Spec}R$ and say the value of some $f\in R$ at a prime ideal $\mathfrak p$ is the image of its coset in $\kappa (x)$. 
Why do we move into the field of fractions $\kappa(x)$ instead of just staying in the domain $R/\mathfrak p$? Is it just a matter of convenience?
 A: a) You are right, it would seem more reasonable to say that for $f\in R$ its value at $\mathfrak p$ is $f[\mathfrak p]=f \operatorname {mod}\mathfrak p\in R/\mathfrak p \:$, but the problem is that this definition cannot be generalized to a non-affine scheme $X$:  
b) If $f\in \mathcal O(X)$ and $x\in X$ the value at $x$ of $f$ must be defined as $$f[x]=f_x \operatorname {mod}\mathfrak m_x\in \mathcal O_{X,x}/\mathfrak m_x=\kappa(x)$$ Indeed there is no ring $R$ in sight to which we  can apply the "reasonable" definition: $x$ has many open affine neighbourhoods of the form $U=\operatorname {Spec}(R)$ but no canonical choice presents itself, so we have to adopt the displayed definition avoiding mention of a ring $R$.  
c) Fortunately in the affine case $X=\operatorname {Spec}(R), x=[\mathfrak p]$ we have $\mathcal O_{X,x}=R_\mathfrak p,\;\mathfrak m_x= \mathfrak p R_\mathfrak p$ so that   $$\mathcal O_{X,x}/\mathfrak m_x=R_\mathfrak p/\mathfrak p R_\mathfrak p$$   The pleasant canonical isomorphism $$R_\mathfrak p/\mathfrak p R_\mathfrak p=\operatorname {Frac}(R/\mathfrak p)$$ permits us to conclude that $$\mathcal O_{X,x}/\mathfrak m_x=\operatorname {Frac}(R/\mathfrak p)$$ Hence the definition in the general case coincides with that in the affine case if one is willing to consider that $f[\mathfrak p]$ lives in $\operatorname {Frac}(R/\mathfrak p)$ rather than in $R/\mathfrak p$: a small price to pay for obtaining a generalization to completely general schemes.
