ci-workflow
Run comprehensive CI checks before committing changes. Use when the user asks to run CI, run quality checks, validate code quality, or before finishing any task that involves code changes.
When & Why to Use This Skill
The CI Workflow skill automates comprehensive code quality validation by executing a rigorous sequence of checks including static analysis, security scans, and multi-layered testing. It ensures that every code modification adheres to strict architectural standards and quality thresholds before being committed, effectively reducing technical debt and preventing regressions in the development lifecycle.
Use Cases
- Pre-commit Validation: Automatically run a full suite of CI checks to ensure code integrity and functional correctness before pushing changes to a repository.
- Quality Gate Enforcement: Maintain high engineering standards by validating code against strict PHPInsights metrics, architecture rules (Deptrac), and 100% test coverage requirements.
- Automated Bug & Security Detection: Utilize static analysis (Psalm) and security vulnerability scans to identify potential logic errors and security flaws early in the development process.
- Mutation Testing: Verify the robustness of your test suite using Infection to ensure that existing tests effectively catch logic mutations and edge cases.
- Architectural Integrity: Enforce hexagonal architecture principles and layer boundaries automatically to prevent code rot and maintainable system design.
| name | ci-workflow |
|---|---|
| description | Run comprehensive CI checks before committing changes. Use when the user asks to run CI, run quality checks, validate code quality, or before finishing any task that involves code changes. |
CI Workflow Skill
This skill guides you through running comprehensive CI quality checks before committing code changes.
When to Use This Skill
Activate this skill when:
- User explicitly asks to "run CI" or "run quality checks"
- Before finishing any task that involves code changes
- After making significant code modifications
- Before creating a pull request
- When validating code quality
Workflow Steps
1. Run Comprehensive CI Command
Execute the primary CI command that runs all quality checks:
make ci
Expected Outcome: The command MUST output "✅ CI checks successfully passed!" at the end.
2. Monitor CI Execution
The make ci command runs these checks in sequence:
- Composer validation
- Security vulnerability analysis
- Code style fixes (PHP CS Fixer)
- Static analysis (Psalm)
- Security taint analysis (Psalm)
- Code quality analysis (PHPInsights)
- Architecture validation (Deptrac)
- Unit tests
- Integration tests
- End-to-end tests (Behat)
- Mutation testing (Infection)
3. Handle Failures
If CI fails (output shows "❌ CI checks failed:"):
Identify the failing check from the error output
Fix the specific issue:
- Code style: Review PHP CS Fixer suggestions
- Static analysis: Fix Psalm type errors
- Quality issues: Address PHPInsights warnings (reduce complexity, fix architecture)
- Test failures: Debug and fix failing tests
- Mutation testing: Add missing test cases or refactor for testability
Run individual check to verify fix:
make phpcsfixer # For code style issues make psalm # For static analysis errors make phpinsights # For quality issues make unit-tests # For unit test failures make infection # For mutation testing issuesRe-run full CI after fixes:
make ci
4. Iterate Until Success
CRITICAL: Keep fixing issues and re-running make ci until you see:
✅ CI checks successfully passed!
DO NOT finish the task until this success message appears.
5. Quality Standards Protection
NEVER decrease these quality thresholds:
- PHPInsights min-quality: 100% (src/), 95% (tests/)
- PHPInsights min-complexity: 93% (src/), 95% (tests/)
- PHPInsights min-architecture: 100% (src/), 90% (tests/)
- PHPInsights min-style: 100% (src/), 95% (tests/)
- Mutation testing MSI: 100%
- Test coverage: 100%
If quality checks fail, fix the code, don't lower the standards.
Common Issues and Solutions
High Cyclomatic Complexity
Problem: PHPInsights reports complexity score too low Solution:
- Run
make phpmdto identify complex methods - Refactor by extracting methods or using strategy pattern
- Keep methods under 5 complexity score
Escaped Mutants
Problem: Infection finds untested code mutations Solution:
- Review the mutation diff in infection output
- Add specific test cases for edge cases
- Consider refactoring for better testability (injectable time, extracted methods)
Architecture Violations
Problem: Deptrac reports layer violations Solution:
- Review the dependency rule violation
- Move code to appropriate layer
- Follow hexagonal architecture principles
Success Criteria
- Command outputs "✅ CI checks successfully passed!"
- All quality metrics meet or exceed thresholds
- Zero test failures
- Zero escaped mutants
- Zero architecture violations