check-doc-examples

Verifies code examples in documentation. Checks that class names, method signatures, namespaces, and imports match actual codebase. Detects outdated and misleading examples.

59 stars

Best use case

check-doc-examples is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Verifies code examples in documentation. Checks that class names, method signatures, namespaces, and imports match actual codebase. Detects outdated and misleading examples.

Teams using check-doc-examples should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/check-doc-examples/SKILL.md --create-dirs "https://raw.githubusercontent.com/dykyi-roman/awesome-claude-code/main/skills/check-doc-examples/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/check-doc-examples/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How check-doc-examples Compares

Feature / Agentcheck-doc-examplesStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Verifies code examples in documentation. Checks that class names, method signatures, namespaces, and imports match actual codebase. Detects outdated and misleading examples.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Documentation Code Examples Verification

Analyze documentation for code examples that don't match the actual codebase.

## Detection Patterns

### 1. Incorrect Class Name in Example

```markdown
<!-- DOC says: -->
```php
use App\Service\OrderProcessor;
$processor = new OrderProcessor();
```
<!-- But actual class is App\Application\Order\ProcessOrderUseCase -->
```

### 2. Wrong Method Signature

```markdown
<!-- DOC says: -->
```php
$user = $repository->findByEmail($email);
```
<!-- But actual method signature is: -->
```php
public function findByEmail(Email $email): ?User  // Uses Email VO, not string
```

### 3. Outdated Namespace

```markdown
<!-- DOC says: -->
```php
use App\Models\User;  // Laravel-style
```
<!-- But project uses DDD structure: -->
```php
use App\UserManagement\Domain\Entity\User;
```

### 4. Missing Required Parameters

```markdown
<!-- DOC says: -->
```php
$order = Order::create($userId, $items);
```
<!-- But actual method requires: -->
```php
Order::create(UserId $userId, ItemCollection $items, Currency $currency, Address $shippingAddress)
```

### 5. Deprecated API in Examples

```markdown
<!-- DOC says: -->
```php
$service->process($data);  // process() was renamed to execute()
```
<!-- Method was renamed but docs not updated -->

## Verification Process

### Step 1: Extract Code Blocks from Docs

```bash
# Find PHP code blocks in markdown
Grep: "```php" --glob "**/*.md" -A 20

# Find inline code references
Grep: "`[A-Z][a-zA-Z]+::[a-z]" --glob "**/*.md"
Grep: "`\\$[a-z]+->|new [A-Z]" --glob "**/*.md"
```

### Step 2: Verify Class References

```bash
# For each class mentioned in docs, verify it exists
# Example: doc mentions "OrderProcessor"
Grep: "class OrderProcessor" --glob "**/*.php"

# Verify namespace matches
Grep: "namespace.*Order" --glob "**/*.php"
```

### Step 3: Verify Method Signatures

```bash
# For each method call in doc examples
# Example: doc mentions "$repo->findByEmail($email)"
Grep: "function findByEmail" --glob "**/*.php"
# Compare parameter types and count
```

### Step 4: Check Import Paths

```bash
# For each use statement in doc examples
# Example: "use App\Service\OrderProcessor"
Glob: **/Service/OrderProcessor.php
# If not found, search for actual location
Grep: "class OrderProcessor" --glob "**/*.php"
```

### Step 5: Verify Constructor Parameters

```bash
# For each "new ClassName(...)" in docs
# Verify constructor matches
Grep: "class OrderProcessor" --glob "**/*.php" -A 20
# Check __construct parameters
```

## Severity Classification

| Pattern | Severity |
|---------|----------|
| Non-existent class in install/quickstart | 🔴 Critical |
| Wrong method signature in API docs | 🔴 Critical |
| Outdated namespace in examples | 🟠 Major |
| Missing required parameters | 🟠 Major |
| Deprecated method in examples | 🟡 Minor |
| Style difference (not functional) | 🟡 Minor |

## Output Format

```markdown
### Code Example Mismatch: [Description]

**Severity:** 🔴/🟠/🟡
**Documentation:** `file.md:line`
**Code Reference:** `src/path/File.php:line`

**In Documentation:**
```php
// What the doc says
```

**In Actual Code:**
```php
// What the code actually is
```

**Fix:**
Update documentation to match current code.
```

## Summary Report Format

```markdown
## Code Examples Verification

| Metric | Count |
|--------|-------|
| Code blocks checked | X |
| Valid examples | X |
| Class name mismatches | X |
| Method signature mismatches | X |
| Namespace mismatches | X |
| Deprecated API usage | X |

### Mismatched Examples

| Doc File | Line | Reference | Issue |
|----------|------|-----------|-------|
| `README.md` | 45 | `OrderProcessor` | Class not found |
| `docs/api.md` | 78 | `findByEmail()` | Wrong parameters |
```

Related Skills

create-health-check

59
from dykyi-roman/awesome-claude-code

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.

create-docker-healthcheck

59
from dykyi-roman/awesome-claude-code

Generates Docker health check scripts for PHP services. Creates PHP-FPM, Nginx, and custom endpoint health checks.

code-examples-template

59
from dykyi-roman/awesome-claude-code

Generates code examples for PHP documentation. Creates minimal, copy-paste ready examples with expected output.

check-xxe

59
from dykyi-roman/awesome-claude-code

Analyzes PHP code for XML External Entity vulnerabilities. Detects unsafe XML parsers, missing entity protection, LIBXML flags issues, XSLT attacks.

check-version-consistency

59
from dykyi-roman/awesome-claude-code

Audits version consistency across project files. Checks composer.json, README, CHANGELOG, docs, and configuration files for version number synchronization.

check-type-juggling

59
from dykyi-roman/awesome-claude-code

Detects PHP type juggling vulnerabilities. Identifies loose comparison with user input, in_array without strict mode, switch statement type coercion, and hash comparison bypasses.

check-timeout-strategy

59
from dykyi-roman/awesome-claude-code

Audits timeout configuration across HTTP clients, database connections, queue consumers, cache operations, and external service calls. Detects missing or misconfigured timeouts.

check-test-quality

59
from dykyi-roman/awesome-claude-code

Analyzes PHP test code quality. Checks test structure, assertion quality, test isolation, naming conventions, AAA pattern adherence.

check-ssrf

59
from dykyi-roman/awesome-claude-code

Analyzes PHP code for SSRF vulnerabilities. Detects unvalidated URLs, internal network access, DNS rebinding, cloud metadata access, URL parsing bypass attempts.

check-sql-injection

59
from dykyi-roman/awesome-claude-code

Analyzes PHP code for SQL injection vulnerabilities. Detects query concatenation, ORM misuse, raw queries, dynamic identifiers, prepared statement bypasses.

check-serialization

59
from dykyi-roman/awesome-claude-code

Analyzes PHP code for serialization overhead. Detects inefficient JSON encoding, large object hydration, missing JsonSerializable, circular reference issues.

check-sensitive-data

59
from dykyi-roman/awesome-claude-code

Analyzes PHP code for sensitive data exposure. Detects plaintext secrets, exposed credentials, PII in logs, insecure storage, hardcoded keys.