---
title: "Run one check of everything before every · Agent Wranglers"
url: https://agentwranglers.se/playbook/engineering/rules-as-code/run-one-check-before-every-deploy
updated: 2026-10-20
licence: "All rights reserved"
---

# Run one check of everything before every deploy

By Erik Bergstedt, Agent Wranglers. Updated 2026-10-20.

- Level: Required
- Chapter: [Rules as code](https://agentwranglers.se/playbook/engineering/rules-as-code)
- Rule: Run every check against the whole project with one command, and let the deploy go ahead only when all of them pass.
- How: Keep one script that runs the unit tests, the build gates, the linters and type checker, and the end-to-end tests. For a website, add a browser run over every page in the sitemap. Print one PASS or FAIL line per check, keep the logs, and exit with a code other than zero if any check fails. Call the script at the top of the deploy script and in continuous integration. Give the check its own copy of the build, so a rebuild during the run cannot cause false failures.
- Check: Run the script on a clean build. It prints PASS for every check and exits with zero. Whenever you change how the script runs steps, plant a failure on purpose. The run must report it and exit with a code other than zero.

Example:

```sh
#!/usr/bin/env bash
# check.sh: every rule, the whole project, pass or fail
set -uo pipefail
failed=0
check() { name=$1; shift; if "$@" >/tmp/check.log 2>&1; then echo "PASS  $name"; else echo "FAIL  $name"; tail -20 /tmp/check.log; failed=1; fi; }
check "Lint and types" npm run lint
check "Unit tests" npm test
check "Build gates" npm run build
check "End-to-end tests" npm run e2e
check "Browser lab: accessibility and layout" npm run lab
exit $failed
```

```text
PASS  Lint and types
PASS  Unit tests
PASS  Build gates
PASS  End-to-end tests
PASS  Browser lab: accessibility and layout
```

**For agents:** if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in `Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/rules-as-code/run-one-check-before-every-deploy`.

- Previous: [Check every rule in code](https://agentwranglers.se/playbook/engineering/rules-as-code/check-every-rule-in-code)
- Next: [Fail the build on broken rules](https://agentwranglers.se/playbook/engineering/rules-as-code/build-gates)
- [Rules as code](https://agentwranglers.se/playbook/engineering/rules-as-code)
