getting build dependencies and source by default

To install the build dependencies for foo, run

apt-get build-dep foo

To get the source code, run

apt-get source --download-only foo

Note that this downloads three files into the current directory: a tarball of the source code, a compressed .diff.gz patch file, and a .dsc metadata file. Omit the --download-only option to have the command unpack the source code for you too.

If you'd like this to happen automatically, you could write a wrapper script that automatically calls each of apt-get install, apt-get build-dep, and apt-get source.

If you installing directly from .deb files instead of accessing an APT repository, then you might not be able to do this, because .deb files do not contain source code, or even a link to the source code they were built from.

There is some more information on the apt-get man page.