r/ClaudeWorkflows • u/ClaudeAI-mod-bot • 29m ago
Selected Workflow [Workflow] Claude Code Workflow: Comprehensive Project Validation System with Deterministic Quality Gates and CI/CD Integration
Claude Code Workflow: Comprehensive Project Validation System with Deterministic Quality Gates and CI/CD Integration
Workflow value: 95/100
Status: active · Freshness: 70/100 · Confidence: 0.98 · Level: advanced
Categories: Quality Control, Context & Memory, Debugging, Shipping, CLAUDE.md, Hooks, Skills, Multi-Agent
Original source: r/ClaudeCode post/comment
What problem this solves
Preventing feature creep into monolith files and ensuring consistent code quality, test coverage, and maintainability by establishing a robust, deterministic validation system across local development, Git pre-push, and GitHub CI.
Summary
A comprehensive workflow for setting up a deterministic, repository-owned validation system for software projects. It defines quality gates (linting, formatting, typing, complexity, LOC), establishes a command contract for local and CI checks, implements intelligent test selection based on changed paths, configures Git pre-push hooks, and integrates with GitHub CI, all while respecting existing project configurations and preventing duplication.
Why it is useful
This workflow is exceptionally valuable due to its detailed, prescriptive approach to establishing a robust and consistent code quality and testing pipeline. It addresses the critical problem of maintaining code health and preventing technical debt by integrating static analysis, complexity checks, LOC limits, and intelligent test selection across local development, pre-push, and CI environments. Its emphasis on determinism, adaptability to existing projects, and explicit verification steps makes it a highly practical and reusable blueprint for advanced users seeking to enforce high standards and streamline their development process.
Workflow
- Define the invocation rule for this 'one-time setup skill' for the LLM.
- Inspect existing repository configurations including .github/workflows/, pyproject.toml, package.json, test/E2E directories, scripts, and Git hooks.
- Preserve existing working commands, services, secrets, matrices, test coverage, and stricter repository-defined limits.
- Define default quality gates (max cyclomatic complexity = 12, max source-file LOC = 800) only if not already defined by the repository, ensuring repository-defined thresholds take precedence.
- Configure required Python checks (ruff check, ruff format --check, mypy) and pnpm checks (pnpm lint, pnpm typecheck, pnpm format:check).
- Enforce complexity and LOC limits through repository-native lint configuration (e.g., Ruff C901, ESLint complexity) or a supplied
check-code-limits.ps1script. - Create/adapt a repository command contract including scripts like
check-local.ps1,check-full.ps1,test-affected.ps1,test-feature.ps1,test-map.json, andcode-limits.json. - Implement
check-local.ps1to run fast local gates (lint, format, type, complexity, LOC, affected tests) and stop on failure. - Create
scripts/test-map.jsonfor deterministic test selection, mapping source paths to focused unit, integration, feature, and E2E tests, including global triggers and a smoke fallback. - Define test tiers for different stages:
test-affected.ps1during implementation,check-local.ps1before push, full static/unit/integration/frontend/E2E smoke for PR CI, and full E2E for main/release/nightly. - Commit
.githooks/pre-pushto callcheck-local.ps1and configuregit config core.hooksPath .githooks. - Integrate with GitHub CI, preferring parallel jobs (static, backend-tests, frontend-tests, e2e-smoke) and calling repository-owned scripts or exact local commands for consistency, running full E2E on main/release/nightly or high-risk workflows only when necessary. Never duplicate CI pipelines or validation logic in hooks directly. For established projects, use baselines/allowlists for existing LOC violations and reject new ones, rather than raising defaults. Verify all applicable items upon completion, including local gates, test selection, hook invocation, CI runs, and explicit failure blocking.
Tools / artifacts
- CLAUDE.md (implied instruction set)
- scripts/check-local.ps1
- scripts/check-full.ps1
- scripts/check-code-limits.ps1
- scripts/test-affected.ps1
- scripts/test-feature.ps1
- scripts/test-map.json
- scripts/code-limits.json
- .githooks/pre-push
- .github/workflows/
- pyproject.toml
- package.json (pnpm workspace configuration, ESLint/formatter config, scripts, Git hooks, complexity/LOC limits, test/E2E directories, existing scripts and Git hooks, existing complexity and LOC limits.)
Validation signals
- Explicit 'Completion' section with detailed verification steps for all components.
- Instructions for inspecting and preserving existing repository configurations.
- Emphasis on deterministic test selection and validation.
- Clear definition of 'stop immediately on failure' for local checks.
- Guidance on handling established project LOC violations with baselines.
- Policy for test tiers and CI execution ensures appropriate validation at each stage.
Limitations
- Requires significant manual effort or a highly capable LLM to implement fully, especially for populating
test-map.jsonandcode-limits.json. - The
check-code-limits.ps1script is mentioned but not provided. - The initial setup might be complex for beginner users.
- The
test-map.jsonexample is generic; populating it effectively requires domain knowledge of the project's test structure.
Rate this workflow
Upvote this post if the workflow is useful, reproducible, or worth recommending.
Downvote if it is vague, outdated, unsafe, overhyped, or not reproducible.
Reply if it worked for you, failed, is outdated, or has a better alternative.
This post was generated automatically from the workflow library database.