pr-ready

📁 anamtechjay/cowboy-v2 📅 11 days ago
4
总安装量
2
周安装量
#53140
全站排名
安装命令
npx skills add https://github.com/anamtechjay/cowboy-v2 --skill pr-ready

Agent 安装分布

cursor 2
claude-code 2

Skill 文档

PR Readiness Checker

Validates that code is ready for a pull request by running automated checks (type checking, linting, tests) and reviewing changes.

Quick Start

Run the unified PR readiness script:

bash "$SKILL_DIR/scripts/check-deploy-ready.sh"

Or run individual checks:

# Type checking only
bash "$SKILL_DIR/scripts/check-types.sh"

# Linting only
bash "$SKILL_DIR/scripts/check-lint.sh"

# Tests only
bash "$SKILL_DIR/scripts/check-tests.sh"

# Git diff for code review
bash "$SKILL_DIR/scripts/git-diff-for-review.sh" --stdout

What Gets Checked

1. Type Errors

  • TypeScript: Runs tsc --noEmit (finds local install first, then global)
  • Python: Runs mypy or pyright if available

2. Lint Issues

  • Node.js: Auto-detects Biome, ESLint, or project-configured linter
  • Python: Auto-detects ruff, flake8, or pylint

3. Tests

  • Node.js: Auto-detects npm test script, Jest, Vitest, Mocha, or Bun test
  • Python: Auto-detects pytest or unittest

4. Code Quality (Git Diff Review)

  • Generates diff of staged/unstaged changes
  • YOU must analyze the diff for issues (see checklist below)

Workflow

Step 1: Run Automated Checks

bash "$SKILL_DIR/scripts/check-deploy-ready.sh"

Step 2: Review Diff Output

Analyze the generated diff for these issues:

Critical (must fix):

  • any type usage (TypeScript) or missing type hints (Python)
  • console.log/print() debug statements
  • Unhandled errors or missing try-catch
  • Security issues (SQL injection, XSS, hardcoded secrets)

Warnings:

  • TODO/FIXME comments
  • Magic numbers without constants
  • Functions without return types
  • Deep nesting (>3 levels)

Info:

  • Long functions (>50 lines)
  • Poor variable naming
  • Missing docstrings for public APIs

Step 3: Report Findings

Format your findings like this:

### Code Review: [filename]

**Critical:**
- Line X: [issue] - [suggestion]

**Warnings:**
- Line Y: [issue] - [suggestion]

**Info:**
- Line Z: [minor improvement]

Manual Commands

Node.js/TypeScript

# Type check (prefers local tsc)
./node_modules/.bin/tsc --noEmit
# or
npx tsc --noEmit

# Lint (auto-detected)
./node_modules/.bin/eslint . --ext .ts,.tsx,.js,.jsx
# or for Biome
npx biome check .

# Run tests
npm test
# or directly with Jest
npx jest
# or with Vitest
npx vitest run

Python

# Type check
mypy .
# or
pyright

# Lint
ruff check .
# or
flake8 .

# Run tests
pytest
# or with unittest
python -m unittest discover

Interpreting Results

All Checks Passed

The code is ready for a pull request.

Checks Failed

  1. Fix type errors first (they indicate real bugs)
  2. Fix lint errors (many can be auto-fixed with --fix)
  3. Fix failing tests (ensure all tests pass before deployment)
  4. Address code review findings by severity

Troubleshooting

TypeScript not found:

npm install typescript --save-dev

Python type checker not found:

pip install mypy  # or: pip install pyright

No linter detected:

# Node.js
npm install eslint --save-dev

# Python
pip install ruff  # or: pip install flake8

No test framework detected:

# Node.js (Jest)
npm install jest --save-dev
# Add to package.json scripts: "test": "jest"

# Node.js (Vitest)
npm install vitest --save-dev

# Python
pip install pytest

Empty diff output:

  • Stage changes with git add or use --unstaged flag
  • Ensure you’re in a git repository

Reference

See code-review-guide.md for detailed code review patterns and examples.