Skip to content
Back to skills

Code Quality Gates

ASecurity

Use automatically before and after code changes. Ensures documentation, formatting, type safety, and audit standards.

  • 20 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 7, 2026
toolstypescriptbashreacttestingapidocumentation

Works with

  • api

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add changoo89/claude-pilot --skill code-quality-gates --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Code Quality Gates?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Code Quality Gates
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/changoo89-code-quality-gates/badge)](https://www.skillsdirectory.com/skills/changoo89-code-quality-gates)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: code-quality-gates
description: Use automatically before and after code changes. Ensures documentation, formatting, type safety, and audit standards.
---

# SKILL: Code Quality Gates

> **Purpose**: Automated quality checks before/after code changes (PreToolUse, PostToolUse, Stop hooks converted to skill logic)
> **Target**: All agents making code changes

---

## Quick Start

### When to Use This Skill
- Before creating any .md files (documentation gate)
- After writing code (formatting, type check)
- Before completing work (final audit)

### Quick Reference
```bash
# PreToolUse: Block .md creation
[[ "$file" == *.md ]] && echo "Use Write tool for .md" && return 1

# PostToolUse: Auto-format + type check
prettier --write "$file" && npx tsc --noEmit

# Stop: Console.log audit
grep -rn "console.log" src/ || true
```

---

## Quality Gates

### Gate 1: Documentation (PreToolUse)

**Purpose**: Block .md file creation via Bash

**Apply**: Before Bash commands
```bash
echo "$command" | grep -qiE '\.md' && echo "Use Write tool for .md" && return 1
```

### Gate 2: Formatting (PostToolUse)

**Purpose**: Auto-format after code changes

**Apply**: After Edit/Write
```bash
format_code() {
  case "${1##*.}" in
    js|ts|tsx|json|css|md) prettier --write "$1" ;;
    py) black "$1" ;;
  esac
}
```

### Gate 3: Type Safety (PostToolUse)

**Purpose**: Verify TypeScript type correctness

**Apply**: After .ts file changes
```bash
[ -f tsconfig.json ] && npx tsc --noEmit
```

### Gate 4: Console Audit (Stop)

**Purpose**: Flag console.log before completion

**Apply**: Before work completion
```bash
find src -name "*.ts" -o -name "*.js" | xargs grep -n "console.log"
```

---

## Integration Points

| Hook | Function | Agent | Trigger |
|------|----------|-------|---------|
| PreToolUse | Documentation gate | All | Before Bash |
| PostToolUse | Formatting | Coder | After Edit/Write |
| PostToolUse | Type check | Coder | After .ts changes |
| Stop | Console audit | Coder | Before completion |

---

## Verification

```bash
# Test all gates
echo "# Test" > test.md  # Should warn
echo "const x=1;" > test.js && prettier --write test.js  # Should format
echo "const x: string = 1;" > test.ts && npx tsc --noEmit  # Should error
grep -rn "console.log" src/  # Should find logs
```

---

## Related Skills

- **vibe-coding**: Code quality standards (≤50 lines/function, ≤200 lines/file)
- **coding-standards**: TypeScript, React, API, testing standards
- **tdd**: Test-driven development (Red-Green-Refactor)

---

**Version**: claude-pilot 4.3.0

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.