Answer:
The epidermis, which serves as the body's primary defense against water and infection, and the dermis, which effectively links the epidermis to the rest of the body, are the two major layers that make up the skin.
The stratum germinativum, the bottommost layer, produces layers of cells that make up the epidermis. Cell division is in its active phase at this point. The cells gradually go up into the various levels, where they make associations with neighboring cells based on whatever layer they are in. The skin's waterproofing and ability to withstand infection by pathogens are both a result of the migration and bonding of keratin proteins and lipids.
The stratum is the highest layer that the cells reach.
How does the body identify a pathogen?
To start with, your immune system has several kinds of cells as well as other stuff like proteins floating around. There are two major types of immunity: innate and adaptive and they work together to help you identify and fight infection. Of the different types of white blood cells we have, there are a specific subgroup called lymphocytes that are involved specifically in adaptive immunity.
So the first step in innate immunity is physical barriers. Your skin and your intestines (which are technically 'outside' of your body - think of us as an elongated donut where our guts are the hole of the donut) are examples of such barriers. We're all good with having lots of bacteria on the outside (meaning on our skin and in our digestive tract). Problems happen when the outside stuff gets inside.
So then the next question is how to identify something foreign coming in. Turns out that structurally most living cells (and viruses) have proteins on their outsides. Some of these are receptors, others are structural, and yet others are covered in sugars etc. The thing is, these proteins and sugars are different between different things. So bacteria will have chemicals on them that are different than any chemical we have in our own body. When lymphocytes are growing up in the thymus, they are basically exposed to our normal proteins, sugars, and other molecules so they know to ignore them. If this process doesn't happen properly you can run into problems with things like autoimmune diseases.
Now you mentioned antibodies. Antibodies are actually made in a very fascinating way. Antibodies are essentially proteins with a certain part that can hook onto other molecules that fit the correct shape. Think of the analogy of a bunch of different shapes floating around and having the antibodies have holes for specific shapes, so they can only really attach to that specific shape (or antigen). But you ask, how do they know what shapes to try to attach to or recognize? Well, proteins are coded for by DNA and what happens in B-cells, the makers of antibodies is that there's tons of genetic recombination. We basically scramble DNA in different B-cells to be able to make up completely new and novel protein types that can then attach to other things that we have never been exposed to before.
So innately, we have the ability to recognize almost anything that's small enough and has some kind of outside texture or shapes to hook on to. Each B-cell makes a specific antibody to one shape and we specifically kill the cells that recognize shapes that are present in our own body. Furthermore, those peripheral cells that recognized general features common to many pathogens such as weird sugars or capsules swallow and chew up the things they encounter and present the little bits to immune cells like B-cells to see if they match the right shape for the type of cell. If they do, that cell now starts dividing and making tons of that type of antibody so that you get a good antibody response.
And finally, to remember that you've been exposed to a certain antigen, you have T-cells which basically serve to coordinate this whole process with hormones such as interleukins. When they see something they recognize, they also divide, but the cool thing about T-cells is that they basically live your entire life. Once they've seen something, those T-cells stick around pretty much forever, which is why things like vaccines work.
There are also other parts of our innate immune system, including compounds and proteins in our blood called the complement system. It can be a completely non-cellular method of killing bacteria based purely on antibodies and other proteins.