Awesome-claude-code create-health-check
Generates Health Check pattern for PHP 8.4. Creates application-level health endpoints with component checkers (Database, Redis, RabbitMQ), status aggregation, and RFC-compliant JSON response. Includes unit tests.
install
source · Clone the upstream repo
git clone https://github.com/dykyi-roman/awesome-claude-code
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/dykyi-roman/awesome-claude-code "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/create-health-check" ~/.claude/skills/dykyi-roman-awesome-claude-code-create-health-check && rm -rf "$T"
manifest:
skills/create-health-check/SKILL.mdsource content
Health Check Generator
Creates Health Check infrastructure for monitoring application and dependency health.
When to Use
| Scenario | Example |
|---|---|
| Load balancer routing | Kubernetes liveness/readiness probes |
| Monitoring | Prometheus health scraping |
| Deployment readiness | Verify all dependencies before serving traffic |
| Dependency status | Check Database, Redis, RabbitMQ availability |
Component Characteristics
HealthCheckInterface
— unique identifier for the checkname(): string
— execute the health checkcheck(): HealthCheckResult
HealthStatus Enum
- Healthy: All systems operational
- Degraded: Partially operational, non-critical issues
- Unhealthy: System is down or critical failure
HealthCheckResult
- Immutable value object
- Properties:
,name
(HealthStatus),status
(float),durationMs
(array)details - Static factory methods:
,healthy()
,unhealthy()degraded()
HealthCheckRunner
- Accepts iterable of HealthCheckInterface implementations
- Runs all checks with configurable timeout
- Aggregates overall status (worst status wins)
- Catches exceptions as unhealthy results
Generation Process
Step 1: Generate Domain Components
Path:
src/Domain/Shared/Health/
— Interface for health checksHealthCheckInterface.php
— Enum with Healthy/Degraded/Unhealthy statesHealthStatus.php
— Immutable result value objectHealthCheckResult.php
Step 2: Generate Infrastructure Checkers
Path:
src/Infrastructure/Health/
— PDO connectivity checkDatabaseHealthCheck.php
— Redis connectivity checkRedisHealthCheck.php
— RabbitMQ connectivity checkRabbitMqHealthCheck.php
— Runs all checks and aggregates statusHealthCheckRunner.php
Step 3: Generate Presentation Endpoint
Path:
src/Presentation/Api/Action/
— PSR-15 handler returning JSON responseHealthCheckAction.php
Step 4: Generate Tests
— Result construction and serializationHealthCheckResultTest.php
— Aggregation and error handlingHealthCheckRunnerTest.php
— HTTP response codes and formatHealthCheckActionTest.php
File Placement
| Component | Path |
|---|---|
| Domain Interfaces & VOs | |
| Infrastructure Checkers | |
| Presentation Action | |
| Unit Tests (Domain) | |
| Unit Tests (Infra) | |
| Unit Tests (Presentation) | |
Naming Conventions
| Component | Pattern | Example |
|---|---|---|
| Interface | | |
| Status Enum | | |
| Result VO | | |
| Checker | | |
| Runner | | |
| Action | | |
| Test | | |
Quick Template Reference
HealthCheckInterface
interface HealthCheckInterface { public function name(): string; public function check(): HealthCheckResult; }
HealthStatus
enum HealthStatus: string { case Healthy = 'healthy'; case Degraded = 'degraded'; case Unhealthy = 'unhealthy'; public function isOperational(): bool; public function merge(self $other): self; }
HealthCheckResult
final readonly class HealthCheckResult { public function __construct( public string $name, public HealthStatus $status, public float $durationMs, public array $details = [] ) {} public static function healthy(string $name, float $durationMs): self; public static function unhealthy(string $name, float $durationMs, string $error): self; public static function degraded(string $name, float $durationMs, string $reason): self; public function toArray(): array; }
Usage Example
// GET /health $runner = new HealthCheckRunner($checkers, timeoutSeconds: 5); $result = $runner->run(); // $result['status'] is HealthStatus, $result['checks'] is array<string, HealthCheckResult>
Response Format (RFC Health Check JSON)
{ "status": "healthy", "checks": { "database": { "name": "database", "status": "healthy", "duration_ms": 1.23, "details": {} }, "redis": { "name": "redis", "status": "healthy", "duration_ms": 0.45, "details": {} }, "rabbitmq": { "name": "rabbitmq", "status": "degraded", "duration_ms": 15.7, "details": { "reason": "High latency detected" } } } }
Anti-patterns to Avoid
| Anti-pattern | Problem | Solution |
|---|---|---|
| Slow checks | Health endpoint times out | Set per-check timeouts |
| No timeouts | Single check blocks entire response | Use configurable timeout per runner |
| Exposing internals | Leaking credentials or internal IPs | Return only status, duration, generic details |
| Missing checks | Silent dependency failures | Register checkers for all critical dependencies |
| Synchronous only | Sequential checks increase latency | Consider parallel execution for many checks |
| No degraded state | Binary healthy/unhealthy is too rigid | Use three-state model with Degraded |
References
For complete PHP templates and examples, see:
— HealthCheckInterface, HealthStatus, HealthCheckResult, checkers, runner, action templatesreferences/templates.md
— DI wiring, custom checker, and unit testsreferences/examples.md