pre-push
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.
More from morphet81/cheat-sheets
localise
Generate an HTML translation helper page for Lokalise. Use when the user provides English text (singular/plural) and wants translations across all 23 supported languages, rendered as an interactive HTML page with copy buttons. Triggers on phrases like "translate for Lokalise", "generate translations", "translation table", or when the user provides English strings and mentions languages/i18n/localization.
67translate-pdf
Translate a PDF document from one language to another. Extracts text to structured Markdown, translates it, and builds a new translated PDF. Requires a Python environment with pymupdf, markdown, and weasyprint.
67create-jira-ticket
Create a JIRA ticket from user instructions via acli. Uses project from the current branch when possible, lists project epics, recommends the best epic, asks confirmation before creating, uses ADF descriptions, and can attach Figma designs via the Jira integration.
67adb
Use ADB to interact with an Android device or emulator. Takes a screenshot, understands the screen, performs actions (tap, swipe, type, navigate), and loops until the mission is complete.
66update-jira-ticket
Compare the JIRA ticket description to changes made in the current branch and propose description edits and/or comments to keep the ticket accurate and well-documented.
66verify-test-cases
Verify test cases in all test files modified since branching out from base branch. Checks that test cases make sense, have no duplications, and provide meaningful coverage. Spawns parallel agents for multi-file analysis. After the user confirms test-case changes, runs coverage (npm test:coverage or Jest/Vitest fallback) and fixes tests until coverage passes.
66