@neyugn/agent-kits 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +514 -0
- package/README.vi.md +410 -0
- package/README.zh.md +410 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +422 -0
- package/kits/coder/ARCHITECTURE.md +289 -0
- package/kits/coder/agents/ai-engineer.md +344 -0
- package/kits/coder/agents/backend-specialist.md +270 -0
- package/kits/coder/agents/cloud-architect.md +363 -0
- package/kits/coder/agents/code-reviewer.md +284 -0
- package/kits/coder/agents/data-engineer.md +401 -0
- package/kits/coder/agents/database-specialist.md +251 -0
- package/kits/coder/agents/debugger.md +209 -0
- package/kits/coder/agents/devops-engineer.md +281 -0
- package/kits/coder/agents/documentation-writer.md +296 -0
- package/kits/coder/agents/frontend-specialist.md +298 -0
- package/kits/coder/agents/i18n-specialist.md +348 -0
- package/kits/coder/agents/integration-specialist.md +314 -0
- package/kits/coder/agents/mobile-developer.md +271 -0
- package/kits/coder/agents/multi-tenant-architect.md +281 -0
- package/kits/coder/agents/orchestrator.md +263 -0
- package/kits/coder/agents/performance-analyst.md +327 -0
- package/kits/coder/agents/project-planner.md +277 -0
- package/kits/coder/agents/queue-specialist.md +282 -0
- package/kits/coder/agents/realtime-specialist.md +267 -0
- package/kits/coder/agents/security-auditor.md +253 -0
- package/kits/coder/agents/test-engineer.md +315 -0
- package/kits/coder/agents/ux-researcher.md +388 -0
- package/kits/coder/rules/.cursorrules +287 -0
- package/kits/coder/rules/CLAUDE.md +287 -0
- package/kits/coder/rules/CODEX.md +287 -0
- package/kits/coder/rules/GEMINI.md +287 -0
- package/kits/coder/scripts/checklist.py +318 -0
- package/kits/coder/scripts/kit_status.py +292 -0
- package/kits/coder/scripts/skills_manager.py +243 -0
- package/kits/coder/scripts/verify_all.py +391 -0
- package/kits/coder/skills/accessibility-patterns/SKILL.md +372 -0
- package/kits/coder/skills/accessibility-patterns/scripts/a11y_checker.py +211 -0
- package/kits/coder/skills/ai-rag-patterns/SKILL.md +444 -0
- package/kits/coder/skills/api-patterns/SKILL.md +316 -0
- package/kits/coder/skills/api-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/api-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/api-patterns/scripts/api_validator.py +253 -0
- package/kits/coder/skills/api-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/auth-patterns/SKILL.md +267 -0
- package/kits/coder/skills/aws-patterns/SKILL.md +576 -0
- package/kits/coder/skills/brainstorming/SKILL.md +370 -0
- package/kits/coder/skills/brainstorming/assets/.gitkeep +1 -0
- package/kits/coder/skills/brainstorming/references/deep-dive.md +21 -0
- package/kits/coder/skills/brainstorming/scripts/validate.py +56 -0
- package/kits/coder/skills/clean-code/SKILL.md +240 -0
- package/kits/coder/skills/clean-code/assets/.gitkeep +1 -0
- package/kits/coder/skills/clean-code/references/deep-dive.md +21 -0
- package/kits/coder/skills/clean-code/scripts/lint_runner.py +186 -0
- package/kits/coder/skills/clean-code/scripts/validate.py +56 -0
- package/kits/coder/skills/database-design/SKILL.md +255 -0
- package/kits/coder/skills/database-design/assets/.gitkeep +1 -0
- package/kits/coder/skills/database-design/references/deep-dive.md +21 -0
- package/kits/coder/skills/database-design/scripts/schema_validator.py +272 -0
- package/kits/coder/skills/database-design/scripts/validate.py +56 -0
- package/kits/coder/skills/docker-patterns/SKILL.md +240 -0
- package/kits/coder/skills/documentation-templates/SKILL.md +441 -0
- package/kits/coder/skills/e2e-testing/SKILL.md +457 -0
- package/kits/coder/skills/flutter-patterns/SKILL.md +330 -0
- package/kits/coder/skills/frontend-design/SKILL.md +127 -0
- package/kits/coder/skills/github-actions/SKILL.md +349 -0
- package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +466 -0
- package/kits/coder/skills/graphql-patterns/SKILL.md +558 -0
- package/kits/coder/skills/i18n-localization/SKILL.md +345 -0
- package/kits/coder/skills/i18n-localization/scripts/i18n_checker.py +267 -0
- package/kits/coder/skills/kubernetes-patterns/SKILL.md +357 -0
- package/kits/coder/skills/mermaid-diagrams/SKILL.md +351 -0
- package/kits/coder/skills/mobile-design/SKILL.md +305 -0
- package/kits/coder/skills/monitoring-observability/SKILL.md +458 -0
- package/kits/coder/skills/multi-tenancy/SKILL.md +317 -0
- package/kits/coder/skills/multi-tenancy/assets/.gitkeep +1 -0
- package/kits/coder/skills/multi-tenancy/references/deep-dive.md +21 -0
- package/kits/coder/skills/multi-tenancy/scripts/validate.py +56 -0
- package/kits/coder/skills/nodejs-best-practices/SKILL.md +220 -0
- package/kits/coder/skills/performance-profiling/SKILL.md +333 -0
- package/kits/coder/skills/performance-profiling/assets/.gitkeep +1 -0
- package/kits/coder/skills/performance-profiling/references/deep-dive.md +21 -0
- package/kits/coder/skills/performance-profiling/scripts/validate.py +56 -0
- package/kits/coder/skills/plan-writing/SKILL.md +360 -0
- package/kits/coder/skills/plan-writing/assets/.gitkeep +1 -0
- package/kits/coder/skills/plan-writing/references/deep-dive.md +21 -0
- package/kits/coder/skills/plan-writing/scripts/validate.py +56 -0
- package/kits/coder/skills/postgres-patterns/SKILL.md +361 -0
- package/kits/coder/skills/prompt-engineering/SKILL.md +277 -0
- package/kits/coder/skills/queue-patterns/SKILL.md +359 -0
- package/kits/coder/skills/queue-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/queue-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/queue-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/react-native-patterns/SKILL.md +393 -0
- package/kits/coder/skills/react-patterns/SKILL.md +319 -0
- package/kits/coder/skills/realtime-patterns/SKILL.md +506 -0
- package/kits/coder/skills/realtime-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/realtime-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/realtime-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/redis-patterns/SKILL.md +484 -0
- package/kits/coder/skills/security-fundamentals/SKILL.md +363 -0
- package/kits/coder/skills/security-fundamentals/assets/.gitkeep +1 -0
- package/kits/coder/skills/security-fundamentals/references/deep-dive.md +21 -0
- package/kits/coder/skills/security-fundamentals/scripts/security_scan.py +326 -0
- package/kits/coder/skills/security-fundamentals/scripts/validate.py +56 -0
- package/kits/coder/skills/seo-patterns/SKILL.md +262 -0
- package/kits/coder/skills/seo-patterns/scripts/seo_checker.py +211 -0
- package/kits/coder/skills/systematic-debugging/SKILL.md +478 -0
- package/kits/coder/skills/systematic-debugging/assets/.gitkeep +1 -0
- package/kits/coder/skills/systematic-debugging/references/deep-dive.md +21 -0
- package/kits/coder/skills/systematic-debugging/scripts/validate.py +56 -0
- package/kits/coder/skills/tailwind-patterns/SKILL.md +395 -0
- package/kits/coder/skills/terraform-patterns/SKILL.md +470 -0
- package/kits/coder/skills/testing-patterns/SKILL.md +285 -0
- package/kits/coder/skills/testing-patterns/assets/.gitkeep +1 -0
- package/kits/coder/skills/testing-patterns/references/deep-dive.md +21 -0
- package/kits/coder/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/kits/coder/skills/testing-patterns/scripts/validate.py +56 -0
- package/kits/coder/skills/typescript-patterns/SKILL.md +417 -0
- package/kits/coder/skills/ui-ux-pro-max/SKILL.md +364 -0
- package/kits/coder/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/kits/coder/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/kits/coder/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/kits/coder/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/kits/coder/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/kits/coder/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/kits/coder/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/kits/coder/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/kits/coder/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/kits/coder/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/kits/coder/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/kits/coder/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/kits/coder/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/core.py +257 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/design_system.py +488 -0
- package/kits/coder/skills/ui-ux-pro-max/scripts/search.py +76 -0
- package/kits/coder/workflows/.gitkeep +20 -0
- package/kits/coder/workflows/create.md +152 -0
- package/kits/coder/workflows/debug.md +223 -0
- package/kits/coder/workflows/deploy.md +283 -0
- package/kits/coder/workflows/orchestrate.md +243 -0
- package/kits/coder/workflows/plan.md +134 -0
- package/kits/coder/workflows/test.md +237 -0
- package/kits/coder/workflows/ui-ux-pro-max.md +109 -0
- package/package.json +49 -0
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Security Scan - Comprehensive security validation
|
|
4
|
+
==================================================
|
|
5
|
+
|
|
6
|
+
Validates security principles from security-fundamentals skill.
|
|
7
|
+
Based on OWASP Top 10 2025.
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
python .agent/skills/security-fundamentals/scripts/security_scan.py <project_path>
|
|
11
|
+
python .agent/skills/security-fundamentals/scripts/security_scan.py . --scan-type all
|
|
12
|
+
|
|
13
|
+
Scan Types:
|
|
14
|
+
- all: Run all scans (default)
|
|
15
|
+
- deps: Dependency vulnerabilities (OWASP A03)
|
|
16
|
+
- secrets: Hardcoded credentials (OWASP A04)
|
|
17
|
+
- patterns: Dangerous code patterns (OWASP A05)
|
|
18
|
+
- config: Security configuration (OWASP A02)
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import subprocess
|
|
22
|
+
import json
|
|
23
|
+
import os
|
|
24
|
+
import sys
|
|
25
|
+
import re
|
|
26
|
+
import argparse
|
|
27
|
+
from pathlib import Path
|
|
28
|
+
from typing import Dict, List, Any
|
|
29
|
+
from datetime import datetime
|
|
30
|
+
|
|
31
|
+
# Fix console encoding
|
|
32
|
+
try:
|
|
33
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
34
|
+
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
|
|
35
|
+
except:
|
|
36
|
+
pass
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Secret patterns to detect
|
|
40
|
+
SECRET_PATTERNS = [
|
|
41
|
+
# API Keys & Tokens
|
|
42
|
+
(r'api[_-]?key\s*[=:]\s*["\'][^"\']{10,}["\']', "API Key", "high"),
|
|
43
|
+
(r'token\s*[=:]\s*["\'][^"\']{10,}["\']', "Token", "high"),
|
|
44
|
+
(r'bearer\s+[a-zA-Z0-9\-_.]+', "Bearer Token", "critical"),
|
|
45
|
+
|
|
46
|
+
# Cloud Credentials
|
|
47
|
+
(r'AKIA[0-9A-Z]{16}', "AWS Access Key", "critical"),
|
|
48
|
+
(r'aws[_-]?secret[_-]?access[_-]?key\s*[=:]\s*["\'][^"\']+["\']', "AWS Secret", "critical"),
|
|
49
|
+
|
|
50
|
+
# Database & Connections
|
|
51
|
+
(r'password\s*[=:]\s*["\'][^"\']{4,}["\']', "Password", "high"),
|
|
52
|
+
(r'(mongodb|postgres|mysql|redis):\/\/[^\s"\']+', "Database URI", "critical"),
|
|
53
|
+
|
|
54
|
+
# Private Keys
|
|
55
|
+
(r'-----BEGIN\s+(RSA|PRIVATE|EC)\s+KEY-----', "Private Key", "critical"),
|
|
56
|
+
|
|
57
|
+
# JWT
|
|
58
|
+
(r'eyJ[A-Za-z0-9-_]+\.eyJ[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+', "JWT Token", "high"),
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
# Dangerous code patterns
|
|
62
|
+
DANGEROUS_PATTERNS = [
|
|
63
|
+
# Injection risks
|
|
64
|
+
(r'eval\s*\(', "eval()", "critical", "Code Injection"),
|
|
65
|
+
(r'exec\s*\(', "exec()", "critical", "Code Injection"),
|
|
66
|
+
(r'new\s+Function\s*\(', "Function constructor", "high", "Code Injection"),
|
|
67
|
+
(r'child_process\.exec\s*\(', "child_process.exec", "high", "Command Injection"),
|
|
68
|
+
|
|
69
|
+
# XSS risks
|
|
70
|
+
(r'dangerouslySetInnerHTML', "dangerouslySetInnerHTML", "high", "XSS"),
|
|
71
|
+
(r'\.innerHTML\s*=', "innerHTML assignment", "medium", "XSS"),
|
|
72
|
+
|
|
73
|
+
# SQL Injection
|
|
74
|
+
(r'["\'][^"\']*\+\s*[a-zA-Z_]+\s*\+\s*["\'].*(?:SELECT|INSERT|UPDATE|DELETE)', "SQL Concat", "critical", "SQL Injection"),
|
|
75
|
+
|
|
76
|
+
# Insecure configs
|
|
77
|
+
(r'verify\s*=\s*False', "SSL Verify Disabled", "high", "MITM"),
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
SKIP_DIRS = {'node_modules', '.git', 'dist', 'build', '__pycache__', '.venv', 'venv', '.next'}
|
|
81
|
+
CODE_EXTENSIONS = {'.js', '.ts', '.jsx', '.tsx', '.py', '.go', '.java'}
|
|
82
|
+
CONFIG_EXTENSIONS = {'.json', '.yaml', '.yml', '.toml', '.env'}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def scan_dependencies(project_path: str) -> Dict[str, Any]:
|
|
86
|
+
"""Scan for dependency vulnerabilities (OWASP A03)."""
|
|
87
|
+
results = {"tool": "dependency_scanner", "findings": [], "status": "✅ Secure"}
|
|
88
|
+
|
|
89
|
+
# Check for lock files
|
|
90
|
+
lock_files = {
|
|
91
|
+
"npm": ["package-lock.json", "pnpm-lock.yaml"],
|
|
92
|
+
"pip": ["requirements.txt", "poetry.lock"],
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
for manager, files in lock_files.items():
|
|
96
|
+
pkg_file = "package.json" if manager == "npm" else "requirements.txt"
|
|
97
|
+
if not (Path(project_path) / pkg_file).exists():
|
|
98
|
+
continue
|
|
99
|
+
|
|
100
|
+
has_lock = any((Path(project_path) / f).exists() for f in files)
|
|
101
|
+
if not has_lock:
|
|
102
|
+
results["findings"].append({
|
|
103
|
+
"type": "Missing Lock File",
|
|
104
|
+
"severity": "high",
|
|
105
|
+
"message": f"{manager}: No lock file found"
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
# Run npm audit if applicable
|
|
109
|
+
if (Path(project_path) / "package.json").exists():
|
|
110
|
+
try:
|
|
111
|
+
result = subprocess.run(
|
|
112
|
+
["npm", "audit", "--json"],
|
|
113
|
+
cwd=project_path,
|
|
114
|
+
capture_output=True,
|
|
115
|
+
text=True,
|
|
116
|
+
timeout=60
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
try:
|
|
120
|
+
audit_data = json.loads(result.stdout)
|
|
121
|
+
vulns = audit_data.get("vulnerabilities", {})
|
|
122
|
+
|
|
123
|
+
severity_count = {"critical": 0, "high": 0, "moderate": 0}
|
|
124
|
+
for vuln in vulns.values():
|
|
125
|
+
sev = vuln.get("severity", "low").lower()
|
|
126
|
+
if sev in severity_count:
|
|
127
|
+
severity_count[sev] += 1
|
|
128
|
+
|
|
129
|
+
if severity_count["critical"] > 0:
|
|
130
|
+
results["status"] = "🔴 Critical vulnerabilities"
|
|
131
|
+
results["findings"].append({
|
|
132
|
+
"type": "npm audit",
|
|
133
|
+
"severity": "critical",
|
|
134
|
+
"message": f"{severity_count['critical']} critical vulnerabilities"
|
|
135
|
+
})
|
|
136
|
+
elif severity_count["high"] > 0:
|
|
137
|
+
results["status"] = "🟡 High vulnerabilities"
|
|
138
|
+
|
|
139
|
+
results["npm_audit"] = severity_count
|
|
140
|
+
except json.JSONDecodeError:
|
|
141
|
+
pass
|
|
142
|
+
except:
|
|
143
|
+
pass
|
|
144
|
+
|
|
145
|
+
return results
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def scan_secrets(project_path: str) -> Dict[str, Any]:
|
|
149
|
+
"""Scan for hardcoded secrets (OWASP A04)."""
|
|
150
|
+
results = {
|
|
151
|
+
"tool": "secret_scanner",
|
|
152
|
+
"findings": [],
|
|
153
|
+
"status": "✅ No secrets",
|
|
154
|
+
"scanned_files": 0,
|
|
155
|
+
"by_severity": {"critical": 0, "high": 0, "medium": 0}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
for root, dirs, files in os.walk(project_path):
|
|
159
|
+
dirs[:] = [d for d in dirs if d not in SKIP_DIRS]
|
|
160
|
+
|
|
161
|
+
for file in files:
|
|
162
|
+
ext = Path(file).suffix.lower()
|
|
163
|
+
if ext not in CODE_EXTENSIONS and ext not in CONFIG_EXTENSIONS:
|
|
164
|
+
continue
|
|
165
|
+
|
|
166
|
+
filepath = Path(root) / file
|
|
167
|
+
results["scanned_files"] += 1
|
|
168
|
+
|
|
169
|
+
try:
|
|
170
|
+
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
|
|
171
|
+
content = f.read()
|
|
172
|
+
|
|
173
|
+
for pattern, secret_type, severity in SECRET_PATTERNS:
|
|
174
|
+
matches = re.findall(pattern, content, re.IGNORECASE)
|
|
175
|
+
if matches:
|
|
176
|
+
results["findings"].append({
|
|
177
|
+
"file": str(filepath.relative_to(project_path)),
|
|
178
|
+
"type": secret_type,
|
|
179
|
+
"severity": severity,
|
|
180
|
+
})
|
|
181
|
+
results["by_severity"][severity] += 1
|
|
182
|
+
except:
|
|
183
|
+
pass
|
|
184
|
+
|
|
185
|
+
if results["by_severity"]["critical"] > 0:
|
|
186
|
+
results["status"] = "🔴 CRITICAL: Secrets exposed!"
|
|
187
|
+
elif results["by_severity"]["high"] > 0:
|
|
188
|
+
results["status"] = "🟡 HIGH: Secrets found"
|
|
189
|
+
|
|
190
|
+
results["findings"] = results["findings"][:15]
|
|
191
|
+
return results
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def scan_patterns(project_path: str) -> Dict[str, Any]:
|
|
195
|
+
"""Scan for dangerous code patterns (OWASP A05)."""
|
|
196
|
+
results = {
|
|
197
|
+
"tool": "pattern_scanner",
|
|
198
|
+
"findings": [],
|
|
199
|
+
"status": "✅ No dangerous patterns",
|
|
200
|
+
"scanned_files": 0
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
for root, dirs, files in os.walk(project_path):
|
|
204
|
+
dirs[:] = [d for d in dirs if d not in SKIP_DIRS]
|
|
205
|
+
|
|
206
|
+
for file in files:
|
|
207
|
+
ext = Path(file).suffix.lower()
|
|
208
|
+
if ext not in CODE_EXTENSIONS:
|
|
209
|
+
continue
|
|
210
|
+
|
|
211
|
+
filepath = Path(root) / file
|
|
212
|
+
results["scanned_files"] += 1
|
|
213
|
+
|
|
214
|
+
try:
|
|
215
|
+
with open(filepath, 'r', encoding='utf-8', errors='ignore') as f:
|
|
216
|
+
lines = f.readlines()
|
|
217
|
+
|
|
218
|
+
for line_num, line in enumerate(lines, 1):
|
|
219
|
+
for pattern, name, severity, category in DANGEROUS_PATTERNS:
|
|
220
|
+
if re.search(pattern, line, re.IGNORECASE):
|
|
221
|
+
results["findings"].append({
|
|
222
|
+
"file": str(filepath.relative_to(project_path)),
|
|
223
|
+
"line": line_num,
|
|
224
|
+
"pattern": name,
|
|
225
|
+
"severity": severity,
|
|
226
|
+
"category": category,
|
|
227
|
+
})
|
|
228
|
+
except:
|
|
229
|
+
pass
|
|
230
|
+
|
|
231
|
+
critical = sum(1 for f in results["findings"] if f["severity"] == "critical")
|
|
232
|
+
if critical > 0:
|
|
233
|
+
results["status"] = f"🔴 CRITICAL: {critical} dangerous patterns"
|
|
234
|
+
elif results["findings"]:
|
|
235
|
+
results["status"] = "🟡 Patterns need review"
|
|
236
|
+
|
|
237
|
+
results["findings"] = results["findings"][:20]
|
|
238
|
+
return results
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def run_full_scan(project_path: str, scan_type: str = "all") -> Dict[str, Any]:
|
|
242
|
+
"""Run complete security scan."""
|
|
243
|
+
report = {
|
|
244
|
+
"project": project_path,
|
|
245
|
+
"timestamp": datetime.now().isoformat(),
|
|
246
|
+
"scan_type": scan_type,
|
|
247
|
+
"scans": {},
|
|
248
|
+
"summary": {
|
|
249
|
+
"total_findings": 0,
|
|
250
|
+
"critical": 0,
|
|
251
|
+
"high": 0,
|
|
252
|
+
"overall_status": "✅ SECURE"
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
scanners = {
|
|
257
|
+
"deps": ("dependencies", scan_dependencies),
|
|
258
|
+
"secrets": ("secrets", scan_secrets),
|
|
259
|
+
"patterns": ("code_patterns", scan_patterns),
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
for key, (name, scanner) in scanners.items():
|
|
263
|
+
if scan_type == "all" or scan_type == key:
|
|
264
|
+
result = scanner(project_path)
|
|
265
|
+
report["scans"][name] = result
|
|
266
|
+
|
|
267
|
+
findings = len(result.get("findings", []))
|
|
268
|
+
report["summary"]["total_findings"] += findings
|
|
269
|
+
|
|
270
|
+
for finding in result.get("findings", []):
|
|
271
|
+
sev = finding.get("severity", "low")
|
|
272
|
+
if sev == "critical":
|
|
273
|
+
report["summary"]["critical"] += 1
|
|
274
|
+
elif sev == "high":
|
|
275
|
+
report["summary"]["high"] += 1
|
|
276
|
+
|
|
277
|
+
if report["summary"]["critical"] > 0:
|
|
278
|
+
report["summary"]["overall_status"] = "🔴 CRITICAL ISSUES"
|
|
279
|
+
elif report["summary"]["high"] > 0:
|
|
280
|
+
report["summary"]["overall_status"] = "🟡 HIGH RISK"
|
|
281
|
+
elif report["summary"]["total_findings"] > 0:
|
|
282
|
+
report["summary"]["overall_status"] = "🟠 REVIEW NEEDED"
|
|
283
|
+
|
|
284
|
+
return report
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def main():
|
|
288
|
+
parser = argparse.ArgumentParser(
|
|
289
|
+
description="AGT-Kit Security Scanner (security-fundamentals skill)"
|
|
290
|
+
)
|
|
291
|
+
parser.add_argument("project_path", nargs="?", default=".", help="Project to scan")
|
|
292
|
+
parser.add_argument("--scan-type", choices=["all", "deps", "secrets", "patterns"],
|
|
293
|
+
default="all", help="Scan type")
|
|
294
|
+
parser.add_argument("--output", choices=["json", "summary"], default="summary")
|
|
295
|
+
|
|
296
|
+
args = parser.parse_args()
|
|
297
|
+
|
|
298
|
+
if not os.path.isdir(args.project_path):
|
|
299
|
+
print(json.dumps({"error": f"Not found: {args.project_path}"}))
|
|
300
|
+
sys.exit(1)
|
|
301
|
+
|
|
302
|
+
result = run_full_scan(args.project_path, args.scan_type)
|
|
303
|
+
|
|
304
|
+
if args.output == "summary":
|
|
305
|
+
print(f"\n{'='*60}")
|
|
306
|
+
print(f"[AGT-KIT SECURITY SCAN] {result['project']}")
|
|
307
|
+
print(f"{'='*60}")
|
|
308
|
+
print(f"Status: {result['summary']['overall_status']}")
|
|
309
|
+
print(f"Total Findings: {result['summary']['total_findings']}")
|
|
310
|
+
print(f" Critical: {result['summary']['critical']}")
|
|
311
|
+
print(f" High: {result['summary']['high']}")
|
|
312
|
+
print(f"{'='*60}\n")
|
|
313
|
+
|
|
314
|
+
for scan_name, scan_result in result['scans'].items():
|
|
315
|
+
print(f"\n{scan_name.upper()}: {scan_result['status']}")
|
|
316
|
+
for finding in scan_result.get('findings', [])[:5]:
|
|
317
|
+
print(f" - {finding.get('type', finding.get('pattern', 'Issue'))}: {finding.get('file', finding.get('message', ''))}")
|
|
318
|
+
else:
|
|
319
|
+
print(json.dumps(result, indent=2))
|
|
320
|
+
|
|
321
|
+
# Exit with error if critical issues
|
|
322
|
+
sys.exit(1 if result['summary']['critical'] > 0 else 0)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
if __name__ == "__main__":
|
|
326
|
+
main()
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Example validator for security-fundamentals
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python validate.py <project_path>
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def validate(project_path: str) -> dict:
|
|
14
|
+
"""Main validation logic"""
|
|
15
|
+
results = {
|
|
16
|
+
'errors': [],
|
|
17
|
+
'warnings': [],
|
|
18
|
+
'passed': []
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# TODO: Add validation logic
|
|
22
|
+
results['passed'].append('Placeholder validation passed')
|
|
23
|
+
|
|
24
|
+
return results
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def print_results(results: dict):
|
|
28
|
+
"""Pretty print results"""
|
|
29
|
+
print("\n🔍 Validation Results\n")
|
|
30
|
+
|
|
31
|
+
if results['errors']:
|
|
32
|
+
print(f"❌ Errors ({len(results['errors'])})")
|
|
33
|
+
for error in results['errors']:
|
|
34
|
+
print(f" - {error}")
|
|
35
|
+
|
|
36
|
+
if results['warnings']:
|
|
37
|
+
print(f"\n⚠️ Warnings ({len(results['warnings'])})")
|
|
38
|
+
for warning in results['warnings']:
|
|
39
|
+
print(f" - {warning}")
|
|
40
|
+
|
|
41
|
+
if results['passed']:
|
|
42
|
+
print(f"\n✅ Passed ({len(results['passed'])})")
|
|
43
|
+
for passed in results['passed']:
|
|
44
|
+
print(f" - {passed}")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if __name__ == "__main__":
|
|
48
|
+
if len(sys.argv) < 2:
|
|
49
|
+
print("Usage: python validate.py <project_path>")
|
|
50
|
+
sys.exit(1)
|
|
51
|
+
|
|
52
|
+
project_path = sys.argv[1]
|
|
53
|
+
results = validate(project_path)
|
|
54
|
+
print_results(results)
|
|
55
|
+
|
|
56
|
+
sys.exit(1 if results['errors'] else 0)
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: seo-patterns
|
|
3
|
+
description: SEO fundamentals including E-E-A-T, Core Web Vitals, technical SEO, and content optimization. Use when optimizing pages for search engines, improving rankings, or setting up SEO infrastructure.
|
|
4
|
+
allowed-tools: Read, Write, Edit, Bash
|
|
5
|
+
version: 1.0
|
|
6
|
+
priority: MEDIUM
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# SEO Patterns - Sustainable Search Visibility
|
|
10
|
+
|
|
11
|
+
> **Philosophy:** Technical SEO enables ranking; content quality earns it. There are no permanent shortcuts.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 🎯 Core Principles
|
|
16
|
+
|
|
17
|
+
| Principle | Rule |
|
|
18
|
+
| --------------------- | ------------------------------------------------- |
|
|
19
|
+
| **Content First** | Quality content is the foundation of all SEO |
|
|
20
|
+
| **Technical Clarity** | Search engines must access, understand, and index |
|
|
21
|
+
| **User Focus** | Optimize for users, not search engines |
|
|
22
|
+
| **E-E-A-T** | Experience, Expertise, Authoritativeness, Trust |
|
|
23
|
+
| **Patience** | SEO is a long-term investment, not quick wins |
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
❌ WRONG: Keyword stuffing, link farms, AI spam
|
|
27
|
+
✅ CORRECT: Useful content, technical excellence, earned authority
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📊 E-E-A-T Framework
|
|
33
|
+
|
|
34
|
+
E-E-A-T is NOT a direct ranking factor. It's a framework for evaluating content quality.
|
|
35
|
+
|
|
36
|
+
| Dimension | What It Represents | Signals |
|
|
37
|
+
| --------------------- | ---------------------------------- | ----------------------------------- |
|
|
38
|
+
| **Experience** | First-hand, real-world involvement | Original examples, lived experience |
|
|
39
|
+
| **Expertise** | Subject-matter competence | Credentials, depth, accuracy |
|
|
40
|
+
| **Authoritativeness** | Recognition by others | Mentions, citations, links |
|
|
41
|
+
| **Trustworthiness** | Reliability and safety | HTTPS, transparency, accuracy |
|
|
42
|
+
|
|
43
|
+
### YMYL (Your Money or Your Life)
|
|
44
|
+
|
|
45
|
+
High E-E-A-T requirements for content affecting:
|
|
46
|
+
|
|
47
|
+
- Health and safety
|
|
48
|
+
- Financial decisions
|
|
49
|
+
- Legal information
|
|
50
|
+
- News and current events
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ⚡ Core Web Vitals
|
|
55
|
+
|
|
56
|
+
| Metric | Target | What It Measures |
|
|
57
|
+
| ------- | ------- | ------------------------- |
|
|
58
|
+
| **LCP** | < 2.5s | Largest Contentful Paint |
|
|
59
|
+
| **INP** | < 200ms | Interaction to Next Paint |
|
|
60
|
+
| **CLS** | < 0.1 | Cumulative Layout Shift |
|
|
61
|
+
|
|
62
|
+
### Improvement Strategies
|
|
63
|
+
|
|
64
|
+
| Metric | Quick Wins |
|
|
65
|
+
| ------ | --------------------------------------------- |
|
|
66
|
+
| LCP | Optimize images, preload critical resources |
|
|
67
|
+
| INP | Reduce JavaScript, defer non-critical scripts |
|
|
68
|
+
| CLS | Set explicit dimensions on images/embeds |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## 🔧 Technical SEO Essentials
|
|
73
|
+
|
|
74
|
+
### Crawl & Index Control
|
|
75
|
+
|
|
76
|
+
| Element | Purpose | Implementation |
|
|
77
|
+
| --------------- | ---------------------- | ------------------------------- |
|
|
78
|
+
| **robots.txt** | Control crawl access | Block /admin/, /api/, etc. |
|
|
79
|
+
| **XML Sitemap** | Help discovery | Submit to Search Console |
|
|
80
|
+
| **Canonical** | Consolidate duplicates | `<link rel="canonical" />` |
|
|
81
|
+
| **Hreflang** | Multi-language sites | Define language/region versions |
|
|
82
|
+
| **HTTPS** | Security and trust | Valid SSL certificate |
|
|
83
|
+
|
|
84
|
+
### Robots.txt Example
|
|
85
|
+
|
|
86
|
+
```txt
|
|
87
|
+
User-agent: *
|
|
88
|
+
Disallow: /admin/
|
|
89
|
+
Disallow: /api/
|
|
90
|
+
Disallow: /private/
|
|
91
|
+
Allow: /api/public/
|
|
92
|
+
|
|
93
|
+
Sitemap: https://example.com/sitemap.xml
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Meta Tags Priorities
|
|
97
|
+
|
|
98
|
+
| Tag | SEO Impact | Best Practice |
|
|
99
|
+
| ------------------- | ---------- | --------------------------------------- |
|
|
100
|
+
| `<title>` | High | Unique, 50-60 chars, keyword near start |
|
|
101
|
+
| `meta description` | Medium | Compelling, 150-160 chars, for CTR |
|
|
102
|
+
| `<h1>` | Medium | One per page, main topic |
|
|
103
|
+
| `meta robots` | High | Control indexing per page |
|
|
104
|
+
| `og:*`, `twitter:*` | Low | Social sharing, not ranking |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 📝 Content SEO
|
|
109
|
+
|
|
110
|
+
### On-Page Elements
|
|
111
|
+
|
|
112
|
+
| Element | Principle |
|
|
113
|
+
| -------------------- | ------------------------------- |
|
|
114
|
+
| **Title Tag** | Clear topic + intent |
|
|
115
|
+
| **Meta Description** | Click relevance, not ranking |
|
|
116
|
+
| **H1** | Page's primary subject |
|
|
117
|
+
| **Headings (H2-H6)** | Logical structure |
|
|
118
|
+
| **Alt Text** | Accessibility and context |
|
|
119
|
+
| **Internal Links** | Topic clusters, related content |
|
|
120
|
+
|
|
121
|
+
### Content Quality Signals
|
|
122
|
+
|
|
123
|
+
| Dimension | What Search Engines Look For |
|
|
124
|
+
| --------------- | ---------------------------- |
|
|
125
|
+
| **Depth** | Fully answers the query |
|
|
126
|
+
| **Originality** | Adds unique value |
|
|
127
|
+
| **Accuracy** | Factually correct |
|
|
128
|
+
| **Clarity** | Easy to understand |
|
|
129
|
+
| **Usefulness** | Satisfies user intent |
|
|
130
|
+
| **Freshness** | Updated when relevant |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🏗️ Structured Data (Schema)
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"@context": "https://schema.org",
|
|
139
|
+
"@type": "Article",
|
|
140
|
+
"headline": "How to Build SEO-Friendly React Apps",
|
|
141
|
+
"author": {
|
|
142
|
+
"@type": "Person",
|
|
143
|
+
"name": "John Doe",
|
|
144
|
+
"url": "https://example.com/authors/john"
|
|
145
|
+
},
|
|
146
|
+
"datePublished": "2025-01-15",
|
|
147
|
+
"dateModified": "2025-02-01",
|
|
148
|
+
"publisher": {
|
|
149
|
+
"@type": "Organization",
|
|
150
|
+
"name": "Example Inc",
|
|
151
|
+
"logo": "https://example.com/logo.png"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Common Schema Types
|
|
157
|
+
|
|
158
|
+
| Type | Use Case |
|
|
159
|
+
| ------------------ | ------------------------------- |
|
|
160
|
+
| **Article** | Blog posts, news articles |
|
|
161
|
+
| **Product** | E-commerce product pages |
|
|
162
|
+
| **FAQPage** | FAQ sections |
|
|
163
|
+
| **BreadcrumbList** | Site navigation structure |
|
|
164
|
+
| **Organization** | Company/brand identity |
|
|
165
|
+
| **LocalBusiness** | Local businesses with locations |
|
|
166
|
+
| **HowTo** | Step-by-step guides |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 🤖 AI Content Guidelines
|
|
171
|
+
|
|
172
|
+
Search engines evaluate **output quality**, not authorship method.
|
|
173
|
+
|
|
174
|
+
### Effective Use
|
|
175
|
+
|
|
176
|
+
- AI as drafting or research assistant
|
|
177
|
+
- Human review for accuracy and clarity
|
|
178
|
+
- Original insights and synthesis
|
|
179
|
+
- Clear accountability
|
|
180
|
+
|
|
181
|
+
### Risky Use
|
|
182
|
+
|
|
183
|
+
- Publishing unedited AI output
|
|
184
|
+
- Factual errors or hallucinations
|
|
185
|
+
- Thin or duplicated content
|
|
186
|
+
- Keyword-driven text with no value
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## 📈 SEO Measurement
|
|
191
|
+
|
|
192
|
+
| Area | Key Metrics |
|
|
193
|
+
| --------------- | ------------------------------- |
|
|
194
|
+
| **Visibility** | Indexed pages, impressions |
|
|
195
|
+
| **Rankings** | Position changes, serp features |
|
|
196
|
+
| **Traffic** | Organic sessions, new pages |
|
|
197
|
+
| **Engagement** | CTR, dwell time, bounce rate |
|
|
198
|
+
| **Conversions** | Organic-attributed conversions |
|
|
199
|
+
| **Technical** | Core Web Vitals, crawl errors |
|
|
200
|
+
|
|
201
|
+
### Essential Tools
|
|
202
|
+
|
|
203
|
+
- Google Search Console (rankings, indexing)
|
|
204
|
+
- Google Analytics 4 (traffic, behavior)
|
|
205
|
+
- Lighthouse / PageSpeed Insights (Core Web Vitals)
|
|
206
|
+
- Screaming Frog (technical audits)
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## 🚨 SEO Anti-Patterns
|
|
211
|
+
|
|
212
|
+
| ❌ Don't | ✅ Do |
|
|
213
|
+
| -------------------------- | ---------------------------------- |
|
|
214
|
+
| Keyword stuffing | Natural language, topic coverage |
|
|
215
|
+
| Duplicate content | Canonical tags, unique pages |
|
|
216
|
+
| Hidden text/links | Visible, accessible content |
|
|
217
|
+
| Low-quality link building | Earn links through quality content |
|
|
218
|
+
| Ignore mobile | Mobile-first design |
|
|
219
|
+
| Block CSS/JS from crawlers | Allow full page rendering |
|
|
220
|
+
| Slow page load | Optimize Core Web Vitals |
|
|
221
|
+
| Missing alt text | Descriptive alt for all images |
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## ✅ SEO Checklist
|
|
226
|
+
|
|
227
|
+
### Page-Level
|
|
228
|
+
|
|
229
|
+
- [ ] Unique, descriptive `<title>` (50-60 chars)
|
|
230
|
+
- [ ] Compelling meta description (150-160 chars)
|
|
231
|
+
- [ ] One `<h1>` per page
|
|
232
|
+
- [ ] Logical heading hierarchy (H2, H3, etc.)
|
|
233
|
+
- [ ] Alt text on all images
|
|
234
|
+
- [ ] Internal links to related content
|
|
235
|
+
- [ ] Canonical tag present
|
|
236
|
+
- [ ] Schema markup where applicable
|
|
237
|
+
|
|
238
|
+
### Site-Level
|
|
239
|
+
|
|
240
|
+
- [ ] HTTPS enabled
|
|
241
|
+
- [ ] XML sitemap submitted
|
|
242
|
+
- [ ] robots.txt configured
|
|
243
|
+
- [ ] Mobile-friendly design
|
|
244
|
+
- [ ] Core Web Vitals passing
|
|
245
|
+
- [ ] No broken links (4xx/5xx)
|
|
246
|
+
- [ ] Clean URL structure
|
|
247
|
+
- [ ] Hreflang for multi-language
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 🔗 Related Skills
|
|
252
|
+
|
|
253
|
+
| Need | Skill |
|
|
254
|
+
| ------------------------ | ------------------------- |
|
|
255
|
+
| Performance optimization | `performance-profiling` |
|
|
256
|
+
| Accessibility | `accessibility-patterns` |
|
|
257
|
+
| React/Next.js SSR | `react-patterns` |
|
|
258
|
+
| Content structure | `documentation-templates` |
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
> **Key Principle:** Sustainable SEO is built on useful content, technical clarity, and trust over time. There are no permanent shortcuts.
|