Create Before-Push Validation Script

VerifiedSafe

Creates a comprehensive before-push validation script (b4push) for any project by analyzing the project structure, identifying check steps (quality, build, test, doc, e2e), and generating the script, package.json entry, and a Claude skill. Automates the setup of pre-push checks to catch issues before committing.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#b4push#validation#pre-push#project-setup#ci

Recommended for

Automated summary

Generates a comprehensive before-push validation script for a project, including quality checks, builds, tests, and documentation verification.

Strengths

  • Automates pre-push checks comprehensively
  • Adapts to the project's specific structure (package.json, directories)
  • Integrates smoothly with Claude Code as a reusable skill
  • Provides a detailed summary with elapsed time and failure list

Limitations

  • Requires the project to use package.json and follow certain conventions
  • May need manual adjustments for unconventional setups
  • Setting up e2e tests can be complex if a server needs to be managed
When to use it

Use this skill when setting up a new project or standardizing pre-push validation in an existing project.

When not to use it

Avoid using it for projects with no build or test steps, or when the team prefers CI-only validation.

Security analysis

Safe
Quality score90/100

The skill generates a development validation script and does not perform destructive actions, exfiltrate data, or use obfuscated payloads. It only runs project-specific commands like pnpm scripts, all under user control.

No concerns found

How this analysis is made

Examples

Create b4push for current project
Create a before-push validation script for this project.
Add b4push with e2e tests
Add a b4push script that includes e2e tests with Playwright.
Update existing b4push
Update the b4push script to include documentation checks.

name: dev-create-b4push-script description: >- Create a comprehensive before-push validation script (b4push) and project-level b4push skill for any project. Analyzes the project structure, identifies check steps (quality, build, test, doc site, e2e), generates scripts/run-b4push.sh, adds package.json entry, and creates .claude/skills/b4push/skill.md. Use when: (1) User says 'create b4push', 'add b4push', 'before push script', (2) Setting up a new project's CI/validation workflow, (3) User wants comprehensive pre-push checks for a project. user-invocable: true allowed-tools:

  • Bash
  • Read
  • Write
  • Edit
  • Glob
  • Grep

Create B4Push Script

Generate a comprehensive before-push validation script for the current project.

Workflow

1. Analyze the project

Read package.json to understand:

  • Package manager (pnpm/npm/yarn) - check lockfiles
  • Available scripts: check, build, test, lint, format, typecheck
  • Whether there's a doc site (look for doc/, docs/, website/ directories with their own package.json)
  • Whether there are e2e tests (playwright, cypress)
  • Whether there are data generation scripts (e.g., generate-* scripts in doc)

2. Determine steps

Common step patterns (adapt to project):

| Step | Command | When to include | | --- | --- | --- | | Code quality | pnpm check or pnpm lint && pnpm format | Always | | TypeScript build | pnpm build | If build script exists | | Unit tests | pnpm test | If test script exists | | Doc data generation | cd doc && pnpm run generate-* | If doc site has generate scripts | | Doc quality checks | cd doc && pnpm run check | If doc site has check script | | Doc site build | cd doc && pnpm build | If doc site exists | | E2E tests | Start server + run playwright | If e2e tests exist |

For projects with e2e tests, add server lifecycle management (start, wait for ready, run tests, kill).

3. Create the shell script

Create scripts/run-b4push.sh based on the template in assets/run-b4push-template.sh.

Key patterns:

  • set -euo pipefail for strict error handling
  • FAILURES=() array - continues all steps even if some fail
  • step(), pass(), fail() helper functions
  • Subshell execution (cd "$DIR" && command) to isolate directory changes
  • ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" for reliable path resolution
  • Summary section with elapsed time and failure list
  • Exit 0 on success, exit 1 on any failure

Make the script executable: chmod +x scripts/run-b4push.sh

4. Add package.json script

Add to package.json:

{
  "scripts": {
    "b4push": "./scripts/run-b4push.sh"
  }
}

5. Create project-level b4push skill

Create .claude/skills/b4push/skill.md based on assets/b4push-skill-template.md.

Customize:

  • Step list with project-specific descriptions
  • Estimated duration
  • Fix commands specific to the project (e.g., pnpm check:fix, cd doc && pnpm check:fix)

The skill should have user-invocable: true and allowed-tools: [Bash]. The description must include triggers for automatic invocation on big changes, PR completion, etc.

6. Test

Run pnpm b4push to verify all steps execute correctly. Fix any issues found.

Reference projects

These projects have working b4push setups:

  • mdx-formatter: 6 steps (quality, build, test, doc data, doc quality, doc build), ~40s
  • zmod: 9 steps including e2e with production server, ~3-4 min
  • zpanels: Dual-track (quick 3 steps ~3-5 min, full 6+ steps with e2e ~10-15 min)

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/create-before-push-validation-script-mm8o522x/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/create-before-push-validation-script-mm8o522x' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/create-before-push-validation-script-mm8o522x/download' --output '.skill-downloads/create-before-push-validation-script-mm8o522x/SKILL.md.part' && mv '.skill-downloads/create-before-push-validation-script-mm8o522x/SKILL.md.part' '.skill-downloads/create-before-push-validation-script-mm8o522x/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/create-before-push-validation-script-mm8o522x/SKILL.md' && test -s '.skill-downloads/create-before-push-validation-script-mm8o522x/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/dev-create-b4push-script' && cp -R '.skill-downloads/create-before-push-validation-script-mm8o522x' '.claude/skills/dev-create-b4push-script'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/create-before-push-validation-script-mm8o522x'

openskills read 'create-before-push-validation-script-mm8o522x'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/create-before-push-validation-script-mm8o522x/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills