Agent skill

Validate Logic

by peijun1700 in peijun1700/bluemouse

L13-L17 類型和邏輯驗證 - 檢查類型一致性、邏輯完整性、錯誤處理、安全性、性能. An agent skill from peijun1700/bluemouse.

AGPL-3.0Auto-check: notes

Install Validate Logic

skills CLI
$ npx skills add peijun1700/bluemouse --skill validate-logic -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install peijun1700/bluemouse validate-logic --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/peijun1700/bluemouse.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/validate-logic .claude/skills/validate-logic && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
validate-logic
GitHub stars
109
Token cost
~1.5k tokens
SKILL.md length
248 words
Files
2
Skills in repo
5
Repo updated
First seen
Licence
AGPL-3.0

At a glance

L13-L17 類型和邏輯驗證 - 檢查類型一致性、邏輯完整性、錯誤處理、安全性、性能. An agent skill from peijun1700/bluemouse.

  • Works in 2 steps: AI-Guided Validation → Script Execution
  • SKILL.md covers Two Ways to Use, L13: 類型一致性檢查, L14: 邏輯完整性檢查 (Informational) and L15: 錯誤處理檢查 ⚠️ ANTI-PATTERN…, plus 4 more sections
  • Runs Python scripts from its folder; calls python3; needs API_KEY

What it does

Validate Logic is an agent skill from peijun1700/bluemouse. L13-L17 類型和邏輯驗證 - 檢查類型一致性、邏輯完整性、錯誤處理、安全性、性能。 BlueMouse 17-Layer Validation Group 4(最深層檢查)。 Triggers: "logic", "security", "performance", "error handling", "安全檢查"

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 1 other file (for example `validator.py`).

The licence is AGPL-3.0.

Example prompts

  • “security”
  • “performance”
  • “error handling”
  • “/validate-logic”

Requirements

  • Python 3
  • A credential in API_KEY
  • Pre-approved tools (allowed-tools): Read, Bash, Grep, Glob

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. AI-Guided Validation
  2. Script Execution

What it can do on your machine

Read from SKILL.md and the folder at commit 4f32ef0. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Bash
    • Grep
    • Glob

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Validate Logic loads about 1.5k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 248 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Bash, Grep, Glob

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from peijun1700/bluemouse at commit 4f32ef0, republished under its AGPL-3.0 licence (© peijun1700). 248 words, ~1,547 tokens.

Download SKILL.mdSave it as .claude/skills/validate-logic/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
validate-logic
description
L13-L17 類型和邏輯驗證 - 檢查類型一致性、邏輯完整性、錯誤處理、安全性、性能。 BlueMouse 17-Layer Validation Group 4(最深層檢查)。 Triggers: "logic", "security", "performance", "error handling", "安全檢查"
allowed-tools
Read, Bash, Grep, Glob
user-invocable
true
context
fork

Validate Logic Skill (L13-L17)

BlueMouse 17-Layer Validation System - Group 4: 類型和邏輯驗證(最深層檢查)

Two Ways to Use

1. AI-Guided Validation

Follow the checklist below to analyze code.

2. Script Execution
bash
python3 .claude/skills/validate-logic/validator.py myfile.py
python3 .claude/skills/validate-logic/validator.py --verbose myfile.py

L13-L17 Validation Checklist

L13: 類型一致性檢查

What: All functions in the code have ≥70% type hint coverage

How:

python
funcs = [n for n in ast.walk(tree) if isinstance(n, ast.FunctionDef)]
total = len(funcs)
with_hints = sum(
    1 for f in funcs
    if f.returns or any(arg.annotation for arg in f.args.args)
)
coverage = int(with_hints / total * 100)
passed = coverage >= 70

Pass: "函數類型提示覆蓋率: {coverage}%" (≥70%) Fail: "函數類型提示覆蓋率: {coverage}%" (<70%)


L14: 邏輯完整性檢查 (Informational)

What: Code has control flow structures

How:

python
if_count = sum(1 for n in ast.walk(tree) if isinstance(n, ast.If))
for_count = sum(1 for n in ast.walk(tree) if isinstance(n, ast.For))
while_count = sum(1 for n in ast.walk(tree) if isinstance(n, ast.While))

has_branches = (if_count + for_count + while_count) > 0

Output:

  • Has control flow: "邏輯結構完整"
  • No control flow: "邏輯結構簡單"

Pass: Always (informational only)


L15: 錯誤處理檢查 ⚠️ ANTI-PATTERN DETECTION

What: No empty try-except blocks or pass-only handlers

How:

python
try_nodes = [node for node in ast.walk(tree) if isinstance(node, ast.Try)]

bad_handlers = 0
for node in try_nodes:
    for handler in node.handlers:
        # Empty handler
        if not handler.body:
            bad_handlers += 1
        # Only pass statement
        elif len(handler.body) == 1 and isinstance(handler.body[0], ast.Pass):
            bad_handlers += 1

Pass: Has try-except AND bad_handlers == 0 → "檢測到 N 個有效錯誤處理塊" Fail:

  • No try-except: "建議添加 try-except 錯誤處理塊"
  • Bad handlers: "發現 N 個空的或只有 pass 的錯誤處理塊 (Anti-pattern)"

Examples:

python
# ❌ FAIL: Empty handler
try:
    risky()
except:
    pass

# ❌ FAIL: Only pass
try:
    risky()
except Exception as e:
    pass

# ✅ PASS: Proper handling
try:
    risky()
except Exception as e:
    logger.error(f"Error: {e}")
    raise

L16: 安全性檢查 🔒 SECURITY SCAN

What: No dangerous functions or hardcoded secrets

Dangerous Functions
FunctionRiskAlternative
eval()Arbitrary code executionast.literal_eval()
exec()Arbitrary code executionAvoid
compile()Code injectionAvoid
__import__()Dynamic import riskUse regular import
pickleDeserialization attackjson

Detection:

python
dangerous_funcs = ['eval', 'exec', 'compile', '__import__']

for node in ast.walk(tree):
    if isinstance(node, ast.Call):
        if isinstance(node.func, ast.Name):
            if node.func.id in dangerous_funcs:
                issues.append(f"使用了危險函數: {node.func.id}")
Hardcoded Secrets
PatternExample
api_key = "..."api_key = "sk-123456789"
password = "..."password = "secret123"
secret = "..."secret = "mysecret"
token = "..."token = "eyJ..."
AWS keysaws_access_key_id = "AKIA..."

Detection:

python
secret_patterns = [
    r'api_key\s*=\s*[\'"][^\s\'\"]{10,}[\'"]',
    r'password\s*=\s*[\'"][^\s\'\"]{8,}[\'"]',
    r'secret\s*=\s*[\'"][^\s\'\"]{10,}[\'"]',
    r'token\s*=\s*[\'"][^\s\'\"]{10,}[\'"]',
    r'aws_access_key_id\s*=\s*[\'"]AKIA',
]

Pass: "未發現明顯安全問題" Fail: "發現 N 個潛在安全性問題" + list issues

Examples:

python
# ❌ FAIL: Dangerous function
result = eval(user_input)

# ❌ FAIL: Hardcoded secret
api_key = "sk-1234567890abcdef"

# ✅ PASS: Safe alternatives
import os
api_key = os.environ.get('API_KEY')
result = ast.literal_eval(safe_input)

L17: 性能檢查 ⚡ COMPLEXITY ANALYSIS

What: No deeply nested loops (≥3 levels)

How:

python
def get_loop_depth(node, current_depth=0):
    max_depth = current_depth
    for child in ast.iter_child_nodes(node):
        if isinstance(child, (ast.For, ast.While)):
            child_depth = get_loop_depth(child, current_depth + 1)
        else:
            child_depth = get_loop_depth(child, current_depth)
        max_depth = max(max_depth, child_depth)
    return max_depth

# Find max nesting depth
for node in ast.walk(tree):
    if isinstance(node, (ast.For, ast.While)):
        depth = get_loop_depth(node, 1)
        max_depth = max(max_depth, depth)

passed = max_depth < 3

Pass: "最高循環嵌套深度: {depth} (符合效能規範)" (depth < 3) Fail: "檢測到過深的循環嵌套 (Depth: {depth}),建議優化算法" (depth ≥ 3)

Examples:

python
# ✅ PASS: 2-level nesting (O(n²))
for i in range(n):
    for j in range(n):
        process(i, j)

# ❌ FAIL: 3-level nesting (O(n³))
for i in range(n):      # Level 1
    for j in range(n):  # Level 2
        for k in range(n):  # Level 3 - TOO DEEP!
            process(i, j, k)

Optimization Suggestions:

  • Use dictionary lookups instead of nested loops
  • Restructure algorithm
  • Use vectorized operations (numpy)

Output Format

==================================================
L13-L17: 類型和邏輯驗證
==================================================

Status: ✅ PASSED / ❌ FAILED
Score: X/100 (N/5 layers)

✅/❌ L13: 類型一致性檢查 - 函數類型提示覆蓋率: X%
✅ L14: 邏輯完整性檢查 - 邏輯結構完整/簡單
✅/❌ L15: 錯誤處理檢查 - [message]
✅/❌ L16: 安全性檢查 - [message]
✅/❌ L17: 性能檢查 - [message]

[Verbose mode shows detailed issues]

SkillLayers
/validate-17-layersL1-L17 (完整)
/validate-syntaxL1-L4
/validate-signatureL5-L8
/validate-dependenciesL9-L12
/validate-logicL13-L17

Part of BlueMouse 17-Layer Validation System

© peijun1700, AGPL-3.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in .claude/skills/validate-logic of peijun1700/bluemouse.

  • SKILL.md
  • validator.py

Open the folder on GitHubat commit 4f32ef0

Compare with similar skills

Validate Logic next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Validate Logic compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Validate Logic this skillpeijun1700/bluemouse109—~1.5kAutomated safety check: NotesAGPL-3.0
Logical Propertiesthedaviddias/Front-End-Checklist74k—~526Automated safety check: PassMIT
Writing Kea LogicsPostHog/posthog40k—~2.3kAutomated safety check: PassCustom licence
Logic Reviewsickn33/agentic-awesome-skills47k1 repos~3.5kAutomated safety check: PassMIT
Logic Lenssickn33/agentic-awesome-skills47k1 repos~1.3kAutomated safety check: PassMIT
Hunt Business Logicsickn33/agentic-awesome-skills47k1 repos~4.9kAutomated safety check: PassMIT

Similar skills

  • Logical Properties

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing stylesheets, component styles, and responsive behavior related to Use CSS logical properties for i18n and RTL support.

    74k GitHub stars~526 tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed
  • Writing Kea Logics

    PostHog/posthog

    Official

    Guide for writing or reviewing PostHog kea logic files (Logic.ts / Logic.tsx).

    40k GitHub stars~2.3k tokensUpdated yesterday
    Frontend & DesignAuto-check passed
  • Logic Review

    sickn33/agentic-awesome-skills

    Find logic bugs in a single file or function via semi-formal execution tracing (Premises → Trace → Divergence → Trigger → Remedy).

    47k GitHub starsUsed in 1 repo~3.5k tokens
    Auto-check passed
  • Logic Lens

    sickn33/agentic-awesome-skills

    AI-powered Claude Code skill that performs deep code review using formal logic and reasoning frameworks to detect bugs, anti-patterns, and security risks beyond what linters catch.

    47k GitHub starsUsed in 1 repo~1.3k tokens
    DevelopmentAuto-check passed
  • Hunt Business Logic

    sickn33/agentic-awesome-skills

    Hunting skill for business logic vulnerabilities. An agent skill from sickn33/agentic-awesome-skills.

    47k GitHub starsUsed in 1 repo~4.9k tokens
    Auto-check passed
  • Logic Explain

    sickn33/agentic-awesome-skills

    Explain what a specific piece of code actually does for a given input by producing a step-by-step execution trace (interprocedural, with name resolution and type transitions).

    47k GitHub starsUsed in 1 repo~894 tokens
    Auto-check passed

More from peijun1700/bluemouse

  • Validate Dependencies

    peijun1700/bluemouse

    L9-L12 依賴關係驗證 - 檢查導入語句、標準庫、第三方庫、循環依賴. An agent skill from peijun1700/bluemouse.

    109 GitHub stars~1k tokensUpdated 8 mo ago
    Auto-check: notes
  • Validate Signature

    peijun1700/bluemouse

    L5-L8 函數簽名驗證 - 檢查參數、返回值、類型提示、文檔字符串. An agent skill from peijun1700/bluemouse.

    109 GitHub stars~923 tokensUpdated 8 mo ago
    Auto-check: notes
  • Validate Syntax

    peijun1700/bluemouse

    L1-L4 語法和結構驗證 - 檢查 Python 語法、AST 結構、縮進格式、命名規範. An agent skill from peijun1700/bluemouse.

    109 GitHub stars~856 tokensUpdated 8 mo ago
    Auto-check: notes
  • Validate 17 Layers

    peijun1700/bluemouse

    The BlueMouse 17-Layer Alpha Scale (Static Standard). An agent skill from peijun1700/bluemouse.

    109 GitHub stars~546 tokensUpdated 8 mo ago
    Auto-check: notes

Questions about Validate Logic

What does Validate Logic do?

L13-L17 類型和邏輯驗證 - 檢查類型一致性、邏輯完整性、錯誤處理、安全性、性能. An agent skill from peijun1700/bluemouse. Validate Logic is an agent skill from peijun1700/bluemouse.

How do I install Validate Logic in Claude Code?

Run `npx skills add peijun1700/bluemouse --skill validate-logic -a claude-code`. Or copy the skill folder (.claude/skills/validate-logic in peijun1700/bluemouse) into .claude/skills/validate-logic in your project. Claude Code loads it when a task matches its description.

How do I install Validate Logic in Codex?

Run `npx skills add peijun1700/bluemouse --skill validate-logic -a codex`. Or copy the skill folder (.claude/skills/validate-logic in peijun1700/bluemouse) into .agents/skills/validate-logic in your project. Codex loads it when a task matches its description.

Can I use Validate Logic in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add peijun1700/bluemouse --skill validate-logic -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/validate-logic, .gemini/skills/validate-logic, .github/skills/validate-logic and .opencode/skills/validate-logic in your project.

What does Validate Logic need to run?

Going by SKILL.md and its folder, Validate Logic needs Python for the scripts in its folder, the command-line tools its instructions call (python3) and credentials named API_KEY. Our summary lists: Python 3; A credential in API_KEY. Its frontmatter pre-approves these tools: Read, Bash, Grep, Glob.

Does Validate Logic access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Validate Logic safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Validate Logic use?

Validate Logic is published under the AGPL-3.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Validate Logic use?

About 1.5k tokens (SKILL.md is roughly 6.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Validate Logic?

Skills that share tags, products or a category with Validate Logic: Logical Properties (thedaviddias/Front-End-Checklist, 74k stars), Writing Kea Logics (PostHog/posthog, 40k stars), Logic Review (sickn33/agentic-awesome-skills, 47k stars) and Logic Lens (sickn33/agentic-awesome-skills, 47k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Validate Logic?

peijun1700 (a GitHub user) maintains it in peijun1700/bluemouse, which has 109 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on January 29, 2026.

Source: peijun1700/bluemouse on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.