Token导航 LogoToken导航

Agent Skill · 研究检索

sc-principles(科学原理)

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

sc-principles 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 47,223。

总安装 744周安装 31GitHub Stars 17下载 248核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/tony363/superclaude --skill sc-principles

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

sc-principles 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。适用于需要根据关键词或任务场景从来源线索中筛选信息的场景。通过 npx skills add 命令从指定 GitHub 仓库安装使用。

安装前建议确认权限范围、维护状态及是否触发联网或文件操作。可结合原始 README 进一步核验具体功能和使用方法。

来源仓库内路径:skills/sc-principles

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/tony363/superclaude --skill sc-principles;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

sc-principles 怎么安装?

在终端执行 npx skills add https://github.com/tony363/superclaude --skill sc-principles。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

sc-principles 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

sc-principles 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/tony363/superclaude --skill sc-principles;npx skills add tony363/superclaude --skill "sc-principles" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

sc-principles 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

sc-principles 用的人多吗?

公开数据是累计安装 744 次,近一周安装 31 次,下载 248 次,GitHub 17 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

sc-principles 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
sc-principles

科学原理 · 本页

74417执行命令MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

/sc:principles - Code Principles Validator

Mandatory validation skill enforcing four fundamental software engineering principles:

  1. KISS (Keep It Simple, Stupid) - Code should be as simple as possible
  2. Functional Core, Imperative Shell - Business logic must be pure; I/O belongs at edges
  3. SOLID - Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, Dependency Inversion
  4. Let It Crash - Fail fast for bugs; handle errors explicitly at boundaries

Quick Start

# Full validation (all four principles)
/sc:principles src/

# KISS only validation
/sc:principles src/ --kiss-only

# Purity only validation
/sc:principles src/ --purity-only

# SOLID only validation
/sc:principles src/ --solid-only

# Let It Crash only validation
/sc:principles src/ --crash-only

# Strict mode (warnings become errors)
/sc:principles src/ --strict

# Generate detailed report
/sc:principles src/ --report

Behavioral Flow

1. INITIALIZE
   ├── Detect scope root
   ├── Find changed Python files (git diff)
   └── Determine file contexts (core vs shell)

2. ANALYZE
   ├── Parse AST for each file
   ├── Calculate complexity metrics (KISS)
   ├── Detect I/O patterns (Purity)
   ├── Check structural patterns (SOLID)
   └── Analyze error handling (Let It Crash)

3. VALIDATE
   ├── Compare against thresholds
   ├── Classify violations (error vs warning)
   └── Apply context rules (core stricter than shell)

4. REPORT/BLOCK
   ├── Output violations with locations
   ├── Generate actionable recommendations
   └── Exit 0 (pass) or 2 (blocked)

Validation Rules

KISS Gate

MetricThresholdSeverityDescription
Cyclomatic Complexity> 10errorNumber of independent paths through code
Cyclomatic Complexity> 7warningEarly warning for growing complexity
Cognitive Complexity> 15errorWeighted complexity (nested structures count more)
Function Length> 50 lineserrorLines of code per function (inclusive count)
Nesting Depth> 4 levelserrorIf/for/while/with/try nesting
Parameter Count> 5warningFunction parameters

Cognitive vs Cyclomatic Complexity:

  • Cyclomatic counts decision points (branches)
  • Cognitive weights nested structures more heavily: 1 + nesting_depth per control structure
  • Example: if (if (if...)) has low cyclomatic but high cognitive (hard to read)

Purity Gate

The "Functional Core, Imperative Shell" pattern:

LayerPath PatternsI/O AllowedSeverity
Core*/domain/*, */logic/*, */services/*, */utils/*, */core/*NOerror
Shell*/handlers/*, */adapters/*, */api/*, */cli/*, */scripts/*, */tests/*YESwarning

Note: Files in */archive/*, */examples/*, */benchmarks/*, conftest.py, setup.py, and *__main__.py are treated as shell (I/O allowed).

Detected I/O Patterns:

CategoryExamples
File I/Oopen(), read(), write(), Path.read_text()
Networkrequests.get(), httpx, urllib, socket
Databaseexecute(), query(), session.add(), cursor
Subprocesssubprocess.run(), os.system(), Popen
Global Stateglobal, nonlocal keywords
Side Effectsprint(), logging.*, logger.*
Async I/Oasync def, await, async for, async with

SOLID Gate

Detects structural violations of SOLID design principles.

PrincipleDetectionSeverityDescription
SRPFile >300 lines, class with >5 public methodswarningSingle Responsibility - one reason to change
OCPif/elif chains on type, isinstance cascadeswarningOpen-Closed - extend, don't modify
LSPOverride that raises NotImplementedErrorerrorLiskov Substitution - honor contracts
ISPInterface/protocol with >7 methodswarningInterface Segregation - small interfaces
DIPDirect instantiation in business logicwarningDependency Inversion - depend on abstractions

Code Smells to Flag:

SmellPrincipleRecommended Fix
File >300 linesSRPExtract responsibilities into modules
if/else type chainsOCPStrategy pattern or registry
Override that throwsLSPHonor base contract or don't inherit
10+ method interfaceISPSplit into focused interfaces
new Service() in logicDIPDependency injection

Let It Crash Gate

Detects anti-patterns in error handling based on the "Let It Crash" philosophy.

PatternSeverityDescription
Bare except:errorCatches all exceptions including KeyboardInterrupt
except Exception: (no re-raise)warningSwallows errors without handling
except: passerrorSilent failure, debugging nightmare
Nested try/except fallbackswarningComplex error paths, hard to debug

When to Let It Crash:

  • Validation failures → crash with clear error
  • Programming errors → surface immediately
  • Internal operations → let them fail

When to Handle Errors (exceptions to rule):

  • Data persistence → protect against data loss
  • External APIs → retry, fallback, graceful degradation
  • Resource cleanup → RAII, finally blocks
  • User-facing operations → graceful error messages

Not Flagged (appropriate handling):

  • Error handling in */adapters/*, */api/*, */cli/* paths
  • Explicit logging before swallowing
  • Re-raise after logging

Flags

FlagTypeDefaultDescription
--kiss-onlyboolfalseRun only KISS validation
--purity-onlyboolfalseRun only purity validation
--solid-onlyboolfalseRun only SOLID validation
--crash-onlyboolfalseRun only Let It Crash validation
--no-kissboolfalseSkip KISS validation
--no-purityboolfalseSkip purity validation
--no-solidboolfalseSkip SOLID validation
--no-crashboolfalseSkip Let It Crash validation
--thresholdint10Max cyclomatic complexity
--max-cognitiveint15Max cognitive complexity
--max-linesint50Max function line count
--max-depthint4Max nesting depth
--max-paramsint5Max parameter count
--max-file-linesint300Max file line count (SRP)
--max-interface-methodsint7Max interface methods (ISP)
--strictboolfalseTreat all warnings as errors
--core-onlyboolfalseOnly validate core layer files
--allboolfalseAnalyze all files, not just changed
--reportboolfalseGenerate detailed JSON report

Integration Flags

For use by other skills and pre-commit hooks:

FlagDescription
--pre-commitRun as pre-commit hook (blocks commit on failure)
--inlineReal-time validation during implementation
--jsonOutput JSON format for programmatic use

Exit Codes

CodeMeaningAction
0Validation passedProceed
2Violations detectedBlocked - refactor required
3Validation errorManual intervention needed

Personas Activated

  • code-warden - Primary reviewer for principles enforcement
  • optimizer - For complex refactoring guidance
  • guardian - For metrics integration

Validator Scripts

Located in scripts/ directory:

validate_kiss.py

python .claude/skills/sc-principles/scripts/validate_kiss.py \
  --scope-root . \
  --threshold 10 \
  --max-lines 50 \
  --json

validate_purity.py

python .claude/skills/sc-principles/scripts/validate_purity.py \
  --scope-root . \
  --core-only \
  --json

Pre-commit Integration

Add to .pre-commit-config.yaml:

repos:
  - repo: local
    hooks:
      - id: kiss-check
        name: KISS Validation
        entry: python .claude/skills/sc-principles/scripts/validate_kiss.py --scope-root . --json
        language: python
        types: [python]
        pass_filenames: false

      - id: purity-check
        name: Purity Validation
        entry: python .claude/skills/sc-principles/scripts/validate_purity.py --scope-root . --json
        language: python
        types: [python]
        pass_filenames: false

Refactoring Guidance

When violations are detected, apply these patterns:

For Complexity Violations

  1. Extract Method - Split large functions into smaller, named pieces
  2. Guard Clauses - Replace nested if/else with early returns
  3. Strategy Pattern - Replace complex switch/if-else with polymorphism
  4. Decompose Conditional - Name complex conditions as explaining variables

Before:

def process(data, config, user):
    if data:
        if config.enabled:
            if user.has_permission:
                for item in data:
                    if item.valid:
                        # deep logic here

After:

def process(data, config, user):
    if not can_process(data, config, user):
        return None
    return process_items(data)

def can_process(data, config, user):
    return data and config.enabled and user.has_permission

def process_items(data):
    return [process_item(item) for item in data if item.valid]

For Purity Violations

  1. Dependency Injection - Pass dependencies as arguments
  2. Repository Pattern - Isolate database operations
  3. Adapter Pattern - Wrap external APIs
  4. Return Don't Print - Return values, let callers handle output

Before:

# In domain/calculator.py (CORE - should be pure)
def calculate_discount(user_id):
    user = db.query(User).get(user_id)  # I/O in core!
    print(f"Calculating for {user.name}")  # Side effect!
    return 0.2 if user.is_premium else 0.1

After:

# In domain/calculator.py (CORE - now pure)
def calculate_discount(user: User) -> float:
    """Pure function - no I/O, just logic."""
    return 0.2 if user.is_premium else 0.1

# In adapters/discount_service.py (SHELL - I/O allowed)
def get_user_discount(user_id: int) -> float:
    user = user_repository.get(user_id)
    discount = calculate_discount(user)
    logger.info(f"Discount for {user.name}: {discount}")
    return discount

For SOLID Violations

  1. SRP (Single Responsibility) - Extract into modules
  2. OCP (Open-Closed) - Use strategy pattern or registry
  3. LSP (Liskov Substitution) - Honor base contracts
  4. ISP (Interface Segregation) - Split fat interfaces
  5. DIP (Dependency Inversion) - Inject dependencies

Before (OCP violation):

def process_payment(payment_type, amount):
    if payment_type == "credit":
        return process_credit(amount)
    elif payment_type == "debit":
        return process_debit(amount)
    elif payment_type == "crypto":  # New type = code change!
        return process_crypto(amount)

After (OCP compliant):

PROCESSORS = {
    "credit": process_credit,
    "debit": process_debit,
    "crypto": process_crypto,  # Add here, no function change
}

def process_payment(payment_type, amount):
    processor = PROCESSORS.get(payment_type)
    if not processor:
        raise ValueError(f"Unknown payment type: {payment_type}")
    return processor(amount)

For Let It Crash Violations

  1. Remove catch-all blocks - Let bugs surface
  2. Remove defensive guards - Validate at boundaries instead
  3. Flatten try/except - Handle at edges, not everywhere

Before (catch-all anti-pattern):

def get_user(user_id):
    try:
        user = db.query(User).get(user_id)
        return user
    except:  # BAD: catches everything, hides bugs
        return None

After (let it crash):

def get_user(user_id):
    # Let database errors surface - they indicate real problems
    return db.query(User).get(user_id)

# Handle at the boundary (API layer)
@app.get("/users/{user_id}")
def api_get_user(user_id: int):
    try:
        return get_user(user_id)
    except DBError as e:
        logger.error("Database error", error=e, user_id=user_id)
        raise HTTPException(500, "Database unavailable")

Examples

Example 1: Full Validation

$ /sc:principles src/ --report

KISS Validation: BLOCKED
Files analyzed: 12
Errors: 3, Warnings: 5

Violations:
  [ERROR] src/services/order.py:45 process_order: complexity = 15 (max: 10)
  [ERROR] src/utils/parser.py:12 parse_data: length = 78 (max: 50)
  [WARNING] src/domain/calc.py:8 calculate: parameters = 7 (max: 5)

Purity Validation: BLOCKED
Core violations: 2, Shell warnings: 1

Violations:
  [ERROR] src/domain/user.py:23 get_status: database - db.query (context: core)
  [ERROR] src/services/report.py:56 generate: file_io - open (context: core)

Recommendations:
  - COMPLEXITY: Extract helper functions, use early returns
  - DATABASE: Use repository pattern. Business logic receives data, not queries
  - FILE I/O: Move file operations to adapter layer

Example 2: KISS Only

$ /sc:principles src/ --kiss-only --threshold 8

KISS Validation: PASSED
Files analyzed: 12
Errors: 0, Warnings: 2

Example 3: Strict Mode

$ /sc:principles src/ --strict

# All warnings become errors
# Any warning will block

Quality Integration

This skill integrates with SuperClaude quality gates:

  • Contributes to simplicity dimension (weight: 0.08)
  • Contributes to purity dimension (weight: 0.02)
  • Triggers simplification strategy when simplicity < 70
  • Triggers purification strategy when purity < 70

Related Skills

  • /sc:improve --type principles - Auto-refactor for principles compliance
  • /sc:implement - Includes principles validation by default
  • /sc:analyze - Code analysis includes principles metrics

Test Coverage

The validators have comprehensive test coverage (59 tests across 4 suites):

Purity Validator Tests (16):

  • Async function detection (async def)
  • Await expression detection
  • Async for loop detection
  • Async with context manager detection
  • Shell vs core severity differentiation
  • False positive regression (set.add, parser.add_argument, asyncio.run, callback.call)
  • Edge cases (syntax errors, unicode, empty files)

KISS Validator Tests (15):

  • Function length (inclusive count)
  • Cyclomatic complexity
  • Cognitive complexity
  • Nesting depth
  • Parameter count
  • Edge cases (syntax errors, unicode, empty files)

SOLID Validator Tests (15):

  • SRP: File length, class method count, private methods excluded
  • OCP: isinstance cascades
  • LSP: NotImplementedError in concrete overrides, ABC/Protocol excluded
  • ISP: Fat Protocol and ABC interfaces
  • DIP: Direct service instantiation in core paths
  • Edge cases (syntax errors, empty files)

Crash Validator Tests (13):

  • Bare except detection
  • except: pass detection
  • Exception swallowed in core paths
  • Exception with re-raise (OK)
  • Specific exception handling (OK)
  • Nested try/except depth
  • Shell path relaxation (adapters, api)
  • Edge cases (syntax errors, empty files, try/finally)

Run tests:

python -m pytest .claude/skills/sc-principles/tests/ -v

Version: 2.1.0 Validators: validate_kiss.py, validate_purity.py, validate_solid.py, validate_crash.py Shared: shared.py (common find_python_files utility) Agent: code-warden Traits: principles-enforced Tests: 59 passing (all 4 validators)

平台分布

Codex

28.12%
按下载量换算70

Claude Code

23.82%
按下载量换算59

windsurf

19.2%
按下载量换算48

trae

13.68%
按下载量换算34

OpenCode

7.98%
按下载量换算20

Cursor

3.7%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/tony363/superclaude --skill sc-principles;npx skills add tony363/superclaude --skill "sc-principles" 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills