Why Your Team Needs a Custom Coding Standard cover image

Why Your Team Needs a Custom Coding Standard

Scott Keck-Warren • July 7, 2025

One of the biggest challenges of working on a development team is that everyone writes code a little (or a lot) differently. One of my favorite examples of this is how many ways you can format an if statement. Take the following:

if ($condition)
    echo "thing";

if ($condition) {
    echo "thing";
}

if ($condition)
{
    echo "thing";
}

Some teammates didn't use braces, others put braces on the same line, and some put them on a new line. All of these choices are syntactically correct, so none of them are technically wrong, but they do add up to something that can truly derail a team: inconsistency.

When a team has inconsistent code, it becomes harder to read, harder to maintain, and harder to onboard new developers. Every file you open looks slightly different, so you spend time deciphering style instead of understanding logic, if not silently fuming that someone picked the "wrong" standard. That is where a coding standard comes in.

When your team picks a coding standard, you have three options:

  1. Use an existing standard like PSR-12, Pear, or Zend
  2. Create your own from scratch
  3. Start with an existing standard and then add or remove rules

I prefer the third option because it allows your team’s coding standard to reflect how your team wants to work and can be set up to prevent bugs and errors in your code. I generally suggest you use the PSR-12 standard as a base, as it makes most of the "hard" decisions for us.

For example, maybe your team hates "unnecessary variables" and can add rules to prevent this, or you require types everywhere (and you should). These preferences are what make up your custom coding standard.

Having a custom coding standard does a few things for your team:

  1. Reduces mental load. Developers no longer have to wonder “Should I write it like this or that?” because the standard decides for them.
  2. Improves code reviews. Code reviews can focus on actual logic and architectural decisions instead of nitpicking formatting issues.
  3. Creates team ownership. A standard built by the team is more likely to be followed. If you simply impose a generic standard, people will ignore it when they feel like it. But if the team has discussed and agreed upon each rule, everyone buys in.
  4. Makes onboarding easier. New developers can quickly adapt to your codebase because the standards are documented and enforced, and don't require a lengthy training process.

The key to a successful custom standard is making sure it is written down and automatically enforced. By writing down your coding standard, you prevent any miscommunication about what's enforced (a process made easier by starting with an existing standard). By making sure your coding standard is automatically enforced (using tools like PHP_CodeSniffer) you don't need to worry about people relying on memory alone. Let the tools catch formatting violations early so that developers can focus on what matters and not nitpick formatting inside the pull request process.

It's important to know that your coding standard is not set in stone. You should revisit it regularly as your team grows and learns to match how you work today, not how you worked last year. You may bring on a new teammate who creates some new "edge case" in your coding standard that you haven't discussed, so your standard will need to be adapted and improved to handle the case.

In the end, the main benefit of a custom coding standard is not just prettier code. It creates a shared understanding across your team, reducing friction and freeing up mental energy for solving actual problems. Although not arguing about where to put braces is a huge plus.

So if your team has been relying on unwritten rules or “what feels right,” it is time to sit down and create a standard you can all stand behind. Your future self (and teammates) will thank you for it.

The next couple of blog posts will cover this, so feel free to subscribe to our newsletter to get more information.

This was originally published at https://phpdeveloperstv.substack.com/p/why-your-team-needs-a-custom-coding