solid-detection

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SOLID Detection Skill

SOLID检测技能

Project Detection

项目类型检测

Detect project type from configuration files:
bash
undefined
从配置文件检测项目类型:
bash
undefined

Next.js (priority over React)

Next.js (优先级高于React)

[ -f "package.json" ] && grep -q '"next"' package.json
[ -f "package.json" ] && grep -q '"next"' package.json

React (no "next" in package.json)

React (package.json中无"next")

[ -f "package.json" ] && grep -q '"react"' package.json && ! grep -q '"next"' package.json
[ -f "package.json" ] && grep -q '"react"' package.json && ! grep -q '"next"' package.json

Generic TypeScript (no react/next, has .ts files)

通用TypeScript (无react/next,存在.ts文件)

[ -f "package.json" ] && ! grep -q '"react"' package.json && ! grep -q '"next"' package.json [ -f "tsconfig.json" ] || [ -f "bun.lockb" ] || [ -f "bunfig.toml" ]
[ -f "package.json" ] && ! grep -q '"react"' package.json && ! grep -q '"next"' package.json [ -f "tsconfig.json" ] || [ -f "bun.lockb" ] || [ -f "bunfig.toml" ]

Laravel

Laravel

[ -f "composer.json" ] && grep -q '"laravel' composer.json
[ -f "composer.json" ] && grep -q '"laravel' composer.json

Swift

Swift

[ -f "Package.swift" ] || ls *.xcodeproj
[ -f "Package.swift" ] || ls *.xcodeproj

Java

Java

[ -f "pom.xml" ] || [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]
[ -f "pom.xml" ] || [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]

Go

Go

[ -f "go.mod" ]
[ -f "go.mod" ]

Ruby

Ruby

[ -f "Gemfile" ] && [ -f "Rakefile" ]
[ -f "Gemfile" ] && [ -f "Rakefile" ]

Rust

Rust

[ -f "Cargo.toml" ]
[ -f "Cargo.toml" ]

Python

Python

[ -f "pyproject.toml" ] || [ -f "requirements.txt" ]

**Priority order:** Next.js > React > Generic TS > Laravel > Swift > Java > Go > Ruby > Rust > Python
[ -f "pyproject.toml" ] || [ -f "requirements.txt" ]

**优先级顺序:** Next.js > React > 通用TypeScript > Laravel > Swift > Java > Go > Ruby > Rust > Python

Language Rules

各语言规则

Next.js / TypeScript

Next.js / TypeScript

RuleValue
File limit150 lines
Interface location
modules/[feature]/src/interfaces/
Shared interfaces
modules/cores/interfaces/
ForbiddenInterfaces in
components/
,
app/
SOLID skill
solid-nextjs
Pattern detection:
regex
^(export )?(interface|type) \w+
规则取值
文件行数限制150行
接口存放位置
modules/[feature]/src/interfaces/
共享接口位置
modules/cores/interfaces/
禁止项接口存放在
components/
app/
目录
SOLID技能标识
solid-nextjs
模式检测:
regex
^(export )?(interface|type) \w+

React / TypeScript

React / TypeScript

RuleValue
File limit100 lines
Interface location
modules/[feature]/src/interfaces/
Shared interfaces
modules/cores/interfaces/
ForbiddenInterfaces in
components/
files
SOLID skill
solid-react
Pattern detection:
regex
^(export )?(interface|type) \w+
规则取值
文件行数限制100行
接口存放位置
modules/[feature]/src/interfaces/
共享接口位置
modules/cores/interfaces/
禁止项接口存放在
components/
目录的文件中
SOLID技能标识
solid-react
模式检测:
regex
^(export )?(interface|type) \w+

Generic TypeScript / Bun / Node.js

通用TypeScript / Bun / Node.js

RuleValue
File limit100 lines
Interface location
modules/[feature]/src/interfaces/
Shared interfaces
modules/cores/interfaces/
StructureModular MANDATORY
ForbiddenInterfaces in service/lib files
SOLID skill
solid-generic
Pattern detection:
regex
^(export )?(interface|type) \w+
规则取值
文件行数限制100行
接口存放位置
modules/[feature]/src/interfaces/
共享接口位置
modules/cores/interfaces/
结构要求必须采用模块化结构
禁止项接口存放在service/lib文件中
SOLID技能标识
solid-generic
模式检测:
regex
^(export )?(interface|type) \w+

Laravel / PHP

Laravel / PHP

RuleValue
File limit100 lines
Interface location
FuseCore/[Module]/App/Contracts/
Shared interfaces
FuseCore/Core/App/Contracts/
StructureFuseCore Modular MANDATORY
ForbiddenInterfaces outside Contracts/
SOLID skill
solid-php
Pattern detection:
regex
^interface \w+
规则取值
文件行数限制100行
接口存放位置
FuseCore/[Module]/App/Contracts/
共享接口位置
FuseCore/Core/App/Contracts/
结构要求必须采用FuseCore模块化结构
禁止项接口存放在Contracts/目录外
SOLID技能标识
solid-php
模式检测:
regex
^interface \w+

Swift

Swift

RuleValue
File limit150 lines
Interface location
Features/[Feature]/Protocols/
Shared interfaces
Core/Protocols/
StructureFeatures Modular MANDATORY
ForbiddenProtocols outside Protocols/
SOLID skill
solid-swift
Pattern detection:
regex
^protocol \w+
规则取值
文件行数限制150行
接口存放位置
Features/[Feature]/Protocols/
共享接口位置
Core/Protocols/
结构要求必须采用Features模块化结构
禁止项协议存放在Protocols/目录外
SOLID技能标识
solid-swift
模式检测:
regex
^protocol \w+

Java

Java

RuleValue
File limit100 lines
Interface location
modules/[feature]/interfaces/
Shared interfaces
modules/core/interfaces/
StructureModular MANDATORY
ForbiddenInterfaces in impl files
SOLID skill
solid-java
Pattern detection:
regex
^(public )?(interface) \w+
规则取值
文件行数限制100行
接口存放位置
modules/[feature]/interfaces/
共享接口位置
modules/core/interfaces/
结构要求必须采用模块化结构
禁止项接口存放在实现类文件中
SOLID技能标识
solid-java
模式检测:
regex
^(public )?(interface) \w+

Go

Go

RuleValue
File limit100 lines
Interface location
internal/modules/[feature]/ports/
Shared interfaces
internal/core/ports/
StructureModular MANDATORY
ForbiddenInterfaces in impl files
SOLID skill
solid-go
Pattern detection:
regex
^type \w+ interface \{
规则取值
文件行数限制100行
接口存放位置
internal/modules/[feature]/ports/
共享接口位置
internal/core/ports/
结构要求必须采用模块化结构
禁止项接口存放在实现类文件中
SOLID技能标识
solid-go
模式检测:
regex
^type \w+ interface \{

Ruby

Ruby

RuleValue
File limit100 lines
Interface location
app/modules/[feature]/contracts/
Shared interfaces
app/modules/core/contracts/
StructureModular MANDATORY
ForbiddenContracts in model files
SOLID skill
solid-ruby
Pattern detection:
regex
^module \w+Contract
规则取值
文件行数限制100行
接口存放位置
app/modules/[feature]/contracts/
共享接口位置
app/modules/core/contracts/
结构要求必须采用模块化结构
禁止项契约存放在模型文件中
SOLID技能标识
solid-ruby
模式检测:
regex
^module \w+Contract

Rust

Rust

RuleValue
File limit100 lines
Interface location
src/modules/[feature]/traits.rs
Shared interfaces
src/core/traits.rs
StructureModular MANDATORY
ForbiddenTraits in impl files
SOLID skill
solid-rust
Pattern detection:
regex
^pub trait \w+
规则取值
文件行数限制100行
接口存放位置
src/modules/[feature]/traits.rs
共享接口位置
src/core/traits.rs
结构要求必须采用模块化结构
禁止项特征存放在实现类文件中
SOLID技能标识
solid-rust
模式检测:
regex
^pub trait \w+

Python

Python

RuleValue
File limit100 lines
Interface location
src/interfaces/
ForbiddenABC outside interfaces/
Pattern detection:
regex
class \w+\(.*ABC.*\)
规则取值
文件行数限制100行
接口存放位置
src/interfaces/
禁止项ABC类存放在interfaces/目录外
模式检测:
regex
class \w+\(.*ABC.*\)

Line Counting

行数统计

Exclude from count:
  • Blank lines
  • Comments (
    //
    ,
    /* */
    ,
    #
    ,
    """
    )
  • Import statements (optional)
bash
undefined
不计入行数的内容:
  • 空行
  • 注释(
    //
    /* */
    #
    """
  • 导入语句(可选)
bash
undefined

TypeScript/Go/Rust/Swift

TypeScript/Go/Rust/Swift

grep -v '^\s*$|^\s*//|^\s*/*|^\s**' file
grep -v '^\s*$|^\s*//|^\s*/*|^\s**' file

PHP

PHP

grep -v '^\s*$|^\s*//|^\s*#|^\s*/*|^\s**' file
grep -v '^\s*$|^\s*//|^\s*#|^\s*/*|^\s**' file

Python

Python

grep -v '^\s*$|^\s*#|^\s*"""' file
undefined
grep -v '^\s*$|^\s*#|^\s*"""' file
undefined

Validation Actions

校验动作

SeverityAction
Interface in wrong locationBLOCK (exit 2)
File over limitWARNING (exit 0)
Missing documentationWARNING
严重程度执行动作
接口存放位置错误阻止提交(退出码2)
文件行数超限警告(退出码0)
缺少文档警告

Skill Mapping

技能映射

Project TypeSOLID SkillSkill Path
nextjs
solid-nextjs
nextjs-expert/skills/solid-nextjs/
react
solid-react
react-expert/skills/solid-react/
generic
solid-generic
solid/skills/solid-generic/
laravel
solid-php
laravel-expert/skills/solid-php/
swift
solid-swift
swift-apple-expert/skills/solid-swift/
java
solid-java
solid/skills/solid-java/
go
solid-go
solid/skills/solid-go/
ruby
solid-ruby
solid/skills/solid-ruby/
rust
solid-rust
solid/skills/solid-rust/
python
(no skill yet)-
项目类型SOLID技能技能路径
nextjs
solid-nextjs
nextjs-expert/skills/solid-nextjs/
react
solid-react
react-expert/skills/solid-react/
generic
solid-generic
solid/skills/solid-generic/
laravel
solid-php
laravel-expert/skills/solid-php/
swift
solid-swift
swift-apple-expert/skills/solid-swift/
java
solid-java
solid/skills/solid-java/
go
solid-go
solid/skills/solid-go/
ruby
solid-ruby
solid/skills/solid-ruby/
rust
solid-rust
solid/skills/solid-rust/
python
(暂未提供技能)-

Environment Variables

环境变量

Set by
detect-project.sh
:
bash
SOLID_PROJECT_TYPE=nextjs|react|generic|laravel|swift|java|go|ruby|rust|python|unknown
SOLID_FILE_LIMIT=100|150
SOLID_INTERFACE_DIR=path/to/interfaces
SOLID_STRUCTURE=modular
detect-project.sh
设置:
bash
SOLID_PROJECT_TYPE=nextjs|react|generic|laravel|swift|java|go|ruby|rust|python|unknown
SOLID_FILE_LIMIT=100|150
SOLID_INTERFACE_DIR=path/to/interfaces
SOLID_STRUCTURE=modular