pre-push
Run pre-push checks including tests and linting to ensure code is clean and ready to push. Automatically detects project type and available scripts. Runs independent checks in parallel using agents.
How do I install this agent skill?
npx skills add https://github.com/morphet81/cheat-sheets --skill pre-pushIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The pre-push skill automates code quality checks by detecting project types and running linting, testing, and building tools. While performing legitimate development tasks, it executes scripts defined in project configuration files, which presents a surface for indirect prompt injection if those files originate from an untrusted source.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- ZeroLeakspass
Score: 93/100 · 2 sections analyzed
What does this agent skill do?
Run pre-push checks to ensure code quality before pushing to remote.
Usage:
/pre-push- Run all pre-push checks for the current project
Instructions:
-
Check for npm pre-push script:
- Look for
package.jsonin the current directory - If found, check if it has a
pre-pushscript in thescriptssection - If the script exists, run
npm run pre-pushand report the results - If successful, inform the user and STOP here
- Look for
-
If no pre-push script exists, auto-detect and run checks in parallel:
a. Identify project type:
- Check for
package.json(Node.js/JavaScript/TypeScript project) - Check for
pyproject.toml,setup.py,requirements.txt(Python project) - Check for
Cargo.toml(Rust project) - Check for
go.mod(Go project) - Check for other language-specific files
b. Detect available checks (linting, tests, build) for the project type. Then run independent checks in parallel using the
Tasktool (subagent_type: general-purpose) withrun_in_background: true:- Spawn one agent per independent check category (e.g., linting agent, test agent, build agent)
- Checks that don't depend on each other should run concurrently — typically linting and tests are independent, while build may depend on type-checking
c. Linting checks:
-
Node.js/JavaScript/TypeScript:
- Check for ESLint:
eslintin package.json scripts or.eslintrc*file - Check for Prettier:
prettierin package.json scripts or.prettierrc*file - Check for TypeScript:
tscin package.json scripts ortsconfig.jsonfile - Run:
npm run lintornpx eslint .ornpm run type-checkornpx tsc --noEmit
- Check for ESLint:
-
Python:
- Check for:
pylint,flake8,black,mypy,ruff - Run available linters (e.g.,
pylint src/,flake8 .,black --check .,mypy .)
- Check for:
-
Rust:
- Run:
cargo fmt --checkandcargo clippy
- Run:
-
Go:
- Run:
go fmt ./...andgolint ./...orgo vet ./...
- Run:
d. Test checks:
-
Node.js: Check for test scripts in package.json
- Run:
npm testornpm run test:ci(if available)
- Run:
-
Python:
- Check for:
pytest,unittest,nose2 - Run:
pytestorpython -m pytestorpython -m unittest discover
- Check for:
-
Rust:
- Run:
cargo test
- Run:
-
Go:
- Run:
go test ./...
- Run:
e. Build checks:
- If applicable, try building the project to ensure no compilation errors
- Node.js:
npm run build(if script exists) - Rust:
cargo build - Go:
go build ./...
- Check for
-
Report results:
- Wait for all parallel agents to complete and aggregate their results
- Provide a clear summary of all checks performed
- Report pass/fail status for each check
- If any checks fail, show the errors and suggest fixes
- Include the commands that were run for transparency
- If all checks pass, confirm the code is ready to push
-
Handle edge cases:
- If no tests or linting tools are detected, warn the user and ask if they want to proceed without checks
- If commands fail due to missing dependencies, suggest installation commands
- If in a monorepo or workspace, detect and handle appropriately
Example output format:
## Pre-Push Checks
### Linting
ESLint passed
Prettier check passed
TypeScript compilation passed
### Testing
All tests passed (24 tests, 0 failures)
### Build
Build successful
---
All pre-push checks passed! Code is ready to push.
Commands run:
- npm run lint
- npm test
- npm run build
On failure:
## Pre-Push Checks
### Linting
ESLint failed
Error in src/components/Button.tsx:
15:7 error 'onClick' is missing in props validation react/prop-types
### Testing
All tests passed
---
Pre-push checks failed. Please fix the issues above before pushing.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/morphet81/cheat-sheets/pre-push">View pre-push on skillZs</a>