技能 pattern-detector
🔍

pattern-detector

安全 🌐 网络访问⚙️ 外部命令

偵測設計模式和反模式

不良的程式碼結構會導致技術債和維護問題。此技能可分析程式碼以識別正在使用的設計模式和應該修復的反模式,並提供明確的改進建議。

支持: Claude Codex Code(CC)
⚠️ 67
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“pattern-detector”。 Use pattern-detector to analyze this authentication module for design patterns and anti-patterns

预期结果:

  • ✓ Factory Pattern detected at auth/Factory.js:12 - Clean implementation for creating auth providers
  • ⚠️ Singleton Pattern overused at auth/Logger.js:8 - Consider dependency injection instead
  • ❌ God Object detected at auth/AuthManager.js:45 - Handles 7 responsibilities, should be split
  • Anti-pattern severity: High - Recommend splitting into AuthService, SessionManager, and TokenHandler

安全审计

安全
v5 • 1/16/2026

This is a pure markdown prompt skill containing only documentation and code examples. No executable code, scripts, network calls, filesystem access, or command execution. The static analyzer triggered on legitimate software pattern names (Strategy, Command, State, Singleton, Builder) which are incorrectly flagged as cryptographic keywords. JavaScript template literals in code examples were misidentified as shell backticks. All 61 findings are false positives.

2
已扫描文件
734
分析行数
2
发现项
5
审计总数
审计者: claude 查看审计历史 →

质量评分

38
架构
100
可维护性
81
内容
20
社区
100
安全
78
规范符合性

你能构建什么

審查程式碼品質

分析您的程式碼以識別架構問題,並接收具體的重構建議。

評估程式碼庫健康狀況

評估團隊程式碼中的反模式,確保遵守架構標準。

學習模式識別

了解為什麼某些模式是有問題的,以及如何透過實際範例來修復它們。

试试这些提示

分析程式碼檔案
Use @pattern-detector to analyze this code and identify all design patterns and anti-patterns present.
專注於問題
@pattern-detector --anti-patterns-only this code and explain each problem with severity level.
檢查實作
Use @pattern-detector to check if this code follows proper pattern implementation practices.
取得建議
@pattern-detector this code and provide specific recommendations for improving the architecture with code examples.

最佳实践

  • 先從反模式偵測開始,以識別最關鍵的問題
  • 優先將重構工作集中在上帝物件和義大利麵程式碼上,再優化模式
  • 將模式建議作為指南而非命令——情境很重要

避免

  • 使用模式偵測來證明過度工程是正當的,而非保持解決方案的簡單性
  • 忽略嚴重性等級,優先嘗試修復低優先順序的問題
  • 在不了解模式所要解決的特定問題的情況下應用模式

常见问题

此技能支援哪些語言?
模式偵測適用於任何具有標準物件導向模式的語言,包括 JavaScript、Python、Java 和 C++。
分析深度如何?
此技能分析程式碼結構和組織方式,不會執行程式碼或進行靜態分析。
它可以與我的 IDE 整合嗎?
這是一個在 Claude、Codex 和 Claude Code 對話中運作的 AI 技能。
我的程式碼資料安全嗎?
是的。此技能僅處理您在對話中明確共享的程式碼,不會儲存或傳輸任何資料。
為什麼某些模式被標記為存疑?
標記為可接受或存疑的模式可能是過度工程或對於特定使用案例不理想。
這與 linter 有什麼不同?
Linter 檢查語法和樣式。模式偵測在更高層級識別架構問題和設計決策。

开发者详情

文件结构

📄 SKILL.md