agentsclimarketplace

Validate

Skill devondragon/ccmagic/skills/validate

Comprehensive pre-commit validation with parallel checksFrom its SKILL.md

Install
npx -y skills add devondragon/ccmagic --skill validate

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 6 stars6 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

8.8 KB, as published. Nobody here has run it

Validate Command

Comprehensive pre-commit validation to ensure code quality, tests pass, and changes are ready for PR.

Validation Pipeline

Parallel execution: When operations are independent, run them simultaneously—linting, type checking, format checking, and security scanning can all run in parallel. Sequential operations (tests, build) run after parallel checks complete. Claude Code will determine when this is safe and helpful.

Check Categories (with dependencies):

  1. Syntax Check: Ensure code compiles/parses
  2. Type Checking: Validate type safety
  3. Linting: Check code style and quality
  4. Format Check: Verify code formatting
  5. Test Suite: Run all tests
  6. Security Scan: Check for vulnerabilities
  7. Documentation: Verify docs are updated
  8. Build: Ensure project builds successfully

Implementation Steps

How to read the command blocks below. These are a catalog, not a script to run verbatim. After Step 1 detects the project's stack and tooling, select the single command that matches — do not run them all. Where a block chains alternatives with || (e.g. pylint || flake8 || ruff check, npm audit || yarn audit), the || denotes "whichever of these tools this project actually uses" — pick the one that's configured, not a shell fallback. A check tool exiting non-zero almost always means a real failure (lint errors, failing tests), so chaining past it with || would mask that failure by falling through to the next tool. Run one command per check and read its exit code directly.

1. Detect Project Type and Tools

# Check for configuration files
ls -la | grep -E "package.json|pyproject.toml|Cargo.toml|go.mod|Makefile"

# Check for linter configs
ls -la | grep -E ".eslintrc|.pylintrc|.rubocop|rustfmt.toml"

# Check for formatter configs
ls -la | grep -E ".prettierrc|black.toml|.rustfmt"

2. Syntax and Compilation Checks

JavaScript/TypeScript

# TypeScript compilation
npx tsc --noEmit

# Plain-JS syntax check (per file; no config needed)
node --check path/to/file.js

Python

# Syntax check (accepts multiple files)
python -m py_compile **/*.py

Go

go build ./...

Rust

cargo check

3. Type Checking

# TypeScript
npx tsc --noEmit

# Python with mypy
mypy . --ignore-missing-imports

# Python with pyright
pyright

# Flow for JavaScript
npx flow check

4. Linting

# JavaScript/TypeScript
npm run lint || npx eslint .

# Python
pylint **/*.py || flake8 || ruff check

# Go
golangci-lint run || go vet ./...

# Rust
cargo clippy -- -D warnings

5. Code Formatting

# JavaScript/TypeScript
npx prettier --check . || npm run format:check

# Python
black --check . || autopep8 --diff -r .

# Go
gofmt -l . || go fmt ./...

# Rust
cargo fmt -- --check

6. Test Execution

# Run tests with coverage — pick the line for the detected stack
npm test -- --coverage   # JavaScript/TypeScript
pytest --cov             # Python
go test -cover ./...     # Go
cargo test               # Rust

# Then check coverage against the threshold (default 80%; see .validation.json)

7. Security Scanning

# Node.js dependencies
npm audit || yarn audit

# Python dependencies
safety check || pip-audit

# General secrets scanning
gitleaks detect || trufflehog filesystem .

# SAST scanning
semgrep --config=auto

8. Documentation Checks

# Check if docs need updating
git diff --name-only main...HEAD | grep -E "\.md|\.rst|\.txt"

# Verify README is current
# Check if API docs need regeneration
# Validate markdown links
npx markdown-link-check README.md

9. Build Verification

# Node.js
npm run build || yarn build

# Python
python setup.py build || poetry build

# Go
go build ./...

# Rust
cargo build --release

Validation Report Format

# Validation Report
Timestamp: [ISO 8601 timestamp]

## Summary
✅ **PASSED** - All validation checks successful
-- OR --
❌ **FAILED** - 3 checks failed, must fix before commit

## Check Results

### ✅ Syntax Check
- All files parse correctly
- No syntax errors found

### ✅ Type Checking
- TypeScript: No type errors
- Strict mode: Enabled

### ⚠️ Linting (3 warnings)
- `src/auth/login.ts:45` - Missing return type
- `src/utils/helpers.ts:12` - Unused variable 'temp'
- `src/api/routes.ts:78` - Line too long (125 chars)

### ✅ Formatting
- All files properly formatted
- Using Prettier v2.8.0

### ✅ Tests (145/145 passing)
- Unit tests: 120/120 ✅
- Integration: 20/20 ✅
- E2E: 5/5 ✅
- Coverage: 87.3% (threshold: 80%)

### ✅ Security Scan
- No vulnerabilities found
- Dependencies up to date
- No secrets detected

### ⚠️ Documentation
- README needs updating for new API endpoints
- Changelog not updated

### ✅ Build
- Build successful in 45.2s
- Bundle size: 2.1MB (within limit)

## Required Actions
1. Fix linting warnings in 3 files
2. Update README with new endpoints
3. Add entry to CHANGELOG.md

## Recommendations
- Consider adding tests for uncovered lines
- Update deprecated dependencies (3 available)
- Add JSDoc comments to public APIs

Smart Features

1. Incremental Validation

Only validate changed files when possible:

# Get changed files
git diff --name-only main...HEAD

# Run targeted validation
eslint --cache [changed-files]

2. Auto-fix Mode

Offer to automatically fix issues:

# Auto-fix linting
eslint --fix

# Auto-format code
prettier --write .

# Auto-fix imports
npx organize-imports-cli

3. Git Hooks Integration

Set up pre-commit hooks:

# Install husky
npx husky install

# Add pre-commit hook
npx husky add .husky/pre-commit "npm run validate"

Configuration File

Save validation preferences in .validation.json:

{
  "checks": {
    "syntax": true,
    "types": true,
    "lint": true,
    "format": true,
    "tests": true,
    "security": true,
    "docs": false,
    "build": true
  },
  "thresholds": {
    "coverage": 80,
    "maxWarnings": 10,
    "bundleSize": "5MB"
  },
  "autoFix": true,
  "parallel": true
}

Integration with Other Commands

  • Automatically run before /ccmagic:pr
  • Include in /ccmagic:merge workflow
  • Use with git pre-commit hooks

Failure Handling

When validation fails:

  1. Clearly identify what failed
  2. Provide specific fix instructions
  3. Offer auto-fix for simple issues
  4. Create todos for complex fixes
  5. Prevent commit/PR until fixed

Autonomous mode

/ccmagic:validate runs interactively by default. Autonomous mode is opt-in and additive: it runs the same checks without prompting and ends with a machine-readable handshake the orchestrator (/ccmagic:auto-ticket) parses. It never fixes code on its own — fixing is the caller's job.

When autonomous mode is active

Autonomous mode is ON when the first present signal (in priority order) resolves truthy:

  1. --autonomous in the skill arguments.
  2. An autonomous: true line in the grounding/context block a parent skill (e.g. /ccmagic:auto-ticket) prepends when invoking this skill.
  3. autonomous: true in ccmagic.local.md frontmatter — the project file .claude/ccmagic.local.md first, then the user file ~/.claude/ccmagic.local.md.

Absent all three, run the interactive path exactly as documented above.

/ccmagic:validate has no tracker access; it never moves a ticket. It runs the checks, reports the result, and emits the handshake — the parent skill/orchestrator owns any route-and-stop. Emit done when every check passes; emit needs-human when one or more checks fail, summarizing the failing checks on the reason line (the orchestrator decides whether to fix-and-retry or park). Auto-fix is off in autonomous mode — report failures, don't silently rewrite code.

A non-zero exit from any selected check is a failure. Because this handshake gates a merge decision in /ccmagic:auto-ticket, never let a || chain convert a real failure into a pass by falling through to another tool (see the note under Implementation Steps): run the one command that matches the detected stack and treat its exit code as authoritative. Emit done only when every selected check exited zero.

Handshake (emit last, in autonomous mode)

status: done | needs-human
reason: <one line — "validation passed" on done; the failing checks on needs-human>
follow_ups: []

Execution

Begin validation immediately without confirmation. Run checks in optimal order (fail fast on critical issues). Provide real-time progress updates. Display clear, actionable results with specific file:line references for issues.

Keep looking

Skills are one crate of 627,801. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.