Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计提醒

code-pattern-checker代码模式检查器

Agent Skill

code-pattern-checker 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

372

周安装

16

GitHub Stars

23

下载量

131
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-pattern-checker(代码模式检查器)
来源仓库:https://github.com/camoa/claude-skills
仓库路径:skills/code-pattern-checker
安装命令:
npx skills add https://github.com/camoa/claude-skills --skill code-pattern-checker
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/camoa/claude-skills --skill code-pattern-checker

简介

code-pattern-checker 依据 Drupal 标准校验代码质量,涵盖 SOLID 原则、DRY 模式与安全规范。

  • 适用于 Drupal 项目提交前检查、前端 CSS/JS 标准化及安全漏洞扫描。
  • 强制 WebFetch 在线资源作为引用依据,禁止仅依赖本地 bundled 文件。
  • 激活条件为检测到代码提交或合并请求上下文,非主动触发时不响应。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Code Pattern Checker

Validate code against Drupal standards and best practices.

Required References

Load these before checking code:

ReferenceChecks
references/solid-drupal.mdSOLID principles
references/dry-patterns.mdDRY patterns
dev-guides: drupal/security/Security practices (online)
dev-guides: drupal/sdc/ + drupal/js-development/CSS/JS/SDC standards (online)
references/quality-gates.mdGate 1 requirements
For security and frontend checks, WebFetch from https://camoa.github.io/dev-guides/ instead of reading bundled files.

Activation

Activate when you detect:

  • Before committing code
  • After implementation, before task completion
  • /drupal-dev-framework:validate command
  • "Check my code" or "Review this"
  • Invoked by task-completer skill

Gate Enforcement

This skill enforces Gate 1: Code Standards from references/quality-gates.md. Code CANNOT be committed until Gate 1 passes.

Workflow

1. Identify Files to Check

Ask if not clear:

Which files should I check?
1. All changed files (git diff)
2. Specific file(s)
3. All files in a component

Your choice:

Use Bash with git diff --name-only to get changed files if option 1.

2. Read and Analyze Files

Use Read on each file. For each, check:

PHP Files:

  • PSR-12 / Drupal coding standards
  • Docblocks on classes and public methods
  • Type hints on parameters and returns
  • No deprecated functions
  • Naming: PascalCase classes, camelCase methods

SOLID Principles (references/solid-drupal.md):

  • Single Responsibility - one purpose per class
  • Dependency Inversion - inject dependencies via services.yml
  • No \Drupal::service() in new code (BLOCKING)
  • Interfaces defined for services

DRY Check (references/dry-patterns.md):

  • No duplicate code blocks (BLOCKING)
  • Shared logic in services/traits
  • Leverages Drupal base classes

Security (dev-guides drupal/security/):

  • No raw SQL with user input (BLOCKING)
  • Output escaped (Twig auto, Html::escape)
  • Form tokens present (Form API handles)
  • Access checks on routes (BLOCKING)
  • Input validated via Form API

CSS/SCSS (dev-guides drupal/sdc/ + drupal/js-development/):

  • Mobile-first media queries
  • No !important (BLOCKING)
  • No @extend (BLOCKING)
  • BEM naming convention
  • Drupal behaviors pattern for JS

3. Run Automated Tools

Suggest running (user executes):

# PHP CodeSniffer
ddev exec vendor/bin/phpcs --standard=Drupal,DrupalPractice {path}

# PHPStan (if configured)
ddev exec vendor/bin/phpstan analyze {path}

# SCSS Lint (if applicable)
npm run lint:scss

4. Report Findings

Format output as:

## Code Check: {file or component}

### Status: PASS / ISSUES FOUND

### Standards Check
| Check | Status | Notes |
|-------|--------|-------|
| PSR-12 | PASS | - |
| Docblocks | ISSUE | Missing on processData() |
| Type hints | PASS | - |

### SOLID Principles
| Principle | Status |
|-----------|--------|
| Single Responsibility | PASS |
| Dependency Inversion | PASS |

### Security
| Check | Status | Notes |
|-------|--------|-------|
| SQL Injection | PASS | Uses query builder |
| XSS | PASS | Output escaped |
| Access Control | ISSUE | Missing on /admin/custom route |

### DRY Check
| Issue | Location |
|-------|----------|
| Duplicate logic | lines 45-52 and 78-85 |

### Issues to Fix (Priority Order)
1. **Security**: Add access check to admin route
2. **Standards**: Add docblock to processData()
3. **DRY**: Extract duplicate logic to private method

### Recommendation
- [ ] Fix security issue before merge
- [ ] Other issues: fix now or create follow-up task

Approved for commit: NO (fix security first) / YES

5. Offer Fixes

For each issue, offer to help:

Issue: Missing docblock on processData()

Suggested fix:
/**
 * Process the input data and return results.
 *
 * @param array $data
 *   The input data array.
 *
 * @return array
 *   The processed results.
 */

Apply this fix? (yes/no/skip)

Stop Points

STOP and wait for user:

  • After asking which files to check
  • After presenting findings
  • Before applying each fix
  • If security issues found (emphasize fixing)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.62%
按下载量换算48

Claude

26.51%
按下载量换算35

Cursor

18.77%
按下载量换算25

Gemini CLI

9.07%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills