Skip to content
Back to skills

Refactor Check

ASecurity

Analyze Phel source for clean-code issues and phel-pdo rule compliance (.claude/rules/*.md)

  • 6 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 12, 2026
documentationphprefactoringapi

Works with

  • api

Security analysis

A100/100

Scanned September 12, 2026

npx -y skills add phel-lang/phel-pdo --skill refactor-check --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Refactor Check?

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

Security grade badge for Refactor Check
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/phel-lang-refactor-check/badge)](https://www.skillsdirectory.com/skills/phel-lang-refactor-check)

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
---
description: Analyze Phel source for clean-code issues and phel-pdo rule compliance (.claude/rules/*.md)
argument-hint: "[file-or-directory]"
context: fork
agent: Explore
allowed-tools: "Read, Glob, Grep"
---

# Refactor Check

Read and analyze the specified file(s) from `$ARGUMENTS` (default: `src/pdo.phel` + `src/pdo/statement.phel`).

phel-pdo is a thin idiomatic PDO wrapper, pure Phel, struct-based. There are no classes, no Gacela modules, no compiler phases - judge against the project rules, not OOP/SOLID.

## API Design (`.claude/rules/api-design.md`)

| Check | Rule |
|-------|------|
| One fn per method | One Phel fn per exposed PDO method, kebab-case (`lastInsertId` → `last-insert-id`) |
| Arg order | Wrapped struct first (`conn`/`stmt`), then PDO args in PHP order, then `& [optional]` |
| Optionals | Default in body via `(or x \PDO/DEFAULT)`, never overloads |
| Mutators | `execute`/`bind-value`/`set-attribute` return the wrapped struct (thread with `->`) |
| Reads | `fetch`/`fetch-all`/`row-count`/… return Phel-native data |
| Rows out | Every raw fetch routed through `row->map` (keys → keywords) |
| Params in | User maps/vectors run through `phel->php` before PDO |
| Errors | Rely on `ERRMODE_EXCEPTION`; never re-wrap `\PDOException` |
| Encapsulation | No public fn exposes raw `\PDO` / `\PDOStatement` |

## Clean Code

- **Naming**: kebab-case, intention-revealing? `defn-`/`def-` for non-public?
- **Functions**: Small? One responsibility? Threading (`->`, `->>`) where it clarifies?
- **Docstrings**: Public fns carry a terse `:doc` one-liner? Return-type tag reflects the underlying PDO type?
- **Comments**: `;` inline, `;;` standalone, `;;;` section header? No commented-out forms left behind?
- **Purity**: Pure functions only outside the PDO call sites; no globals?
- **Interop**: Boundary crossed only via `phel->php` / `php->phel`, `(php/-> (x :pdo) ...)` / `(php/-> (x :stmt) ...)`?

## Cross-File Hygiene

| Check | Rule |
|-------|------|
| Namespace | `statement.phel` opens with `(in-ns phel.pdo)` |
| Declares | New cross-file decls via `declare` in `src/pdo.phel` before `(load "pdo/statement")` |
| API tables | `README.md` connection/statement tables list every public fn |

## Output Format

```markdown
# Refactor Analysis: <file/directory>

## Summary
- **API Design Issues:** X
- **Clean Code Issues:** X
- **Cross-File Issues:** X

## Critical Issues (High Priority)
### [API] <fn> leaks raw \PDOStatement
**File:** `src/pdo/statement.phel:42`
**Problem:** ...
**Suggestion:** ...

## Moderate Issues (Medium Priority)
...

## Minor Issues (Low Priority)
...

## Recommended Refactoring Steps
1. ...
```

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.