Comprehensive developer toolkit providing reusable skills for Java/Spring Boot, TypeScript/NestJS/React/Next.js, Python, PHP, AWS CloudFormation, AI/RAG, DevOps, and more.
90
90%
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Risky
Do not use without reviewing
Security considerations and best practices for Knowledge Graph operations.
Principle: Only read KG from docs/specs/[ID]/ paths.
Why: Prevents path traversal attacks and unauthorized file access.
Implementation:
def validate_kg_path(path):
"""
Validate that KG path is within docs/specs/ directory.
"""
# Must start with docs/specs/
if not path.startswith("docs/specs/"):
raise ValueError(f"Invalid KG path: {path}")
# No path traversal allowed
if ".." in path:
raise ValueError(f"Path traversal not allowed: {path}")
# Resolve to absolute path
real_path = Path(path).resolve()
project_root = Path.cwd()
# Must be within project root
if not str(real_path).startswith(str(project_root)):
raise ValueError(f"Path outside project: {path}")
return real_pathWhat this prevents:
../../etc/passwd/etc/passwdsymlink-to-sensitive-filePrinciple: Validate all updates before merging into KG.
Why: Prevents malicious JSON from corrupting KG or causing unexpected behavior.
Implementation:
import json
def validate_json_structure(data):
"""
Validate that data matches expected KG structure.
"""
# Must be a dict
if not isinstance(data, dict):
raise ValueError("KG data must be a dictionary")
# Must have required top-level keys
required_keys = ['metadata', 'patterns', 'components', 'apis']
for key in required_keys:
if key not in data:
raise ValueError(f"Missing required key: {key}")
# Validate metadata structure
if 'version' in data['metadata']:
# Version should be a string like "1.0"
if not isinstance(data['metadata']['version'], str):
raise ValueError("Version must be a string")
# Validate arrays are arrays
array_keys = ['patterns', 'components', 'apis', 'provides']
for key in array_keys:
if key in data and key != 'metadata':
if not isinstance(data[key], dict):
raise ValueError(f"{key} must be a dictionary")
return TrueWhat this prevents:
Principle: KG should NOT contain passwords, API keys, tokens, or other sensitive data.
Why: KG files are committed to git and should not contain secrets.
What to exclude:
Implementation:
import re
SENSITIVE_PATTERNS = [
r'password\s*[:=]\s*\S+', # password: secret, password=secret
r'api[_-]?key\s*[:=]\s*\S+', # api_key: xxx
r'token\s*[:=]\s*\S+', # token: xxx
r'secret\s*[:=]\s*\S+', # secret: xxx
r'-----BEGIN\s+(PRIVATE\s+KEY|RSA\s+PRIVATE)-----', # Private keys
]
def contains_secrets(text):
"""
Check if text contains potential secrets.
"""
for pattern in SENSITIVE_PATTERNS:
if re.search(pattern, text, re.IGNORECASE):
return True
return False
def validate_no_secrets(data):
"""
Validate that KG data doesn't contain secrets.
"""
# Convert to JSON string for checking
json_str = json.dumps(data)
if contains_secrets(json_str):
raise ValueError("KG data appears to contain secrets")
return TrueWhat to store instead:
Principle: KG files are designed to be committed to git (no sensitive data by design).
What's safe to commit:
What's NOT safe to commit:
Verification:
# Check if KG would add sensitive data to git
git add docs/specs/*/knowledge-graph.json
git diff --cached --check # Fails if sensitive data detectedPrinciple: Knowledge Graph skill does NOT modify source code files.
What it DOES:
knowledge-graph.json filesWhat it does NOT do:
.java, .ts, .py filesEnforcement:
SAFE_EXTENSIONS = {'.json', '.md'} # Only safe file extensions
def validate_operation(target_file):
"""
Validate that operation only targets safe files.
"""
ext = Path(target_file).suffix.lower()
if ext not in SAFE_EXTENSIONS:
raise PermissionError(
f"Cannot modify {ext} files. "
f"Knowledge Graph only creates JSON and Markdown files."
)
# Must be knowledge-graph.json or similar
if 'knowledge-graph' not in target_file:
raise PermissionError(
f"Can only create knowledge-graph files, not {target_file}"
)
return TrueAttack: User provides path like ../../etc/passwd to access system files.
Mitigation:
docs/specs/.. in pathsExample:
# Attack attempt
update_kg("../../../etc/passwd", malicious_data)
# Defense
validate_kg_path("../../../etc/passwd")
# Raises: ValueError("Path traversal not allowed")Attack: Malicious JSON with unexpected structure causes exploit.
Mitigation:
Example:
# Attack attempt
malicious_json = '{"__proto__": {"polluted": true}}'
# Defense
validate_json_structure(json.loads(malicious_json))
# Raises: ValueError("Invalid JSON structure")Attack: User tries to store passwords/tokens in KG.
Mitigation:
Example:
# Attack attempt
data = {"api": {"credentials": {"password": "secret123"}}}
# Defense
validate_no_secrets(data)
# Raises: ValueError("KG data appears to contain secrets")Attack: User tries to make KG skill execute arbitrary code.
Mitigation:
Example:
# Attack attempt
extract_and_execute("malicious.java")
# Defense
# KG skill doesn't have execute capability
# Only has Read, Write, Edit, Grep, Glob, Bash tools
# Write tool validates it only creates .json filesAttack: Use KG to extract sensitive codebase information.
Mitigation:
What's stored:
Always validate:
Example:
def validate_update(updates):
# Validate structure
validate_json_structure(updates)
# Validate no secrets
validate_no_secrets(updates)
# Validate array sizes (prevent DoS)
for key in updates:
if isinstance(updates[key], list):
if len(updates[key]) > 10000:
raise ValueError(f"Array too large: {key}")
return TrueKG skill capabilities:
Multiple layers of security:
On error:
Example:
try:
update_kg(path, data)
except ValueError as e:
# Log detailed error internally
logger.error(f"KG update failed: {e}", exc_info=True)
# Return generic error to user
raise ValueError("Invalid KG data provided")Bad:
{
"database": {
"password": "secret123"
}
}Good:
{
"database": {
"host": "localhost",
"port": 5432,
"name": "mydb"
}
}Bad:
def update_kg(path, data):
write(path, data) # No validation!Good:
def update_kg(path, data):
validate_path(path)
validate_json_structure(data)
validate_no_secrets(data)
write(path, data)Bad:
# Blacklist approach (misses new threats)
if path not in ['etc/passwd', 'etc/shadow']:
process(path)Good:
# Whitelist approach (only allows safe paths)
if path.startswith('docs/specs/'):
process(path)What to log:
Example:
logger.warning(f"Security: Invalid path attempt: {path}")
logger.error(f"Security: Secrets detected in KG update")
logger.info(f"Security: KG update validated successfully")Before writing to KG:
What to check:
Audit script:
#!/bin/bash
# Audit KG files for security
echo "Auditing Knowledge Graph files..."
# Find all KG files
find docs/specs -name "knowledge-graph.json" | while read file; do
echo "Checking: $file"
# Check for secrets
if grep -iE "password|api[_-]?key|token|secret" "$file"; then
echo "⚠️ WARNING: Possible secrets in $file"
fi
# Check file location
if [[ ! "$file" == docs/specs/*/knowledge-graph.json ]]; then
echo "⚠️ WARNING: Unusual KG location: $file"
fi
# Check file size
size=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file")
if [ $size -gt 1048576 ]; then
echo "⚠️ WARNING: Large KG file (>1MB): $file"
fi
done
echo "Audit complete."Core security principles:
Key threats mitigated:
Security best practices:
Remember: Knowledge Graph stores structural information only, never credentials or sensitive data.
docs
plugins
developer-kit-ai
developer-kit-aws
agents
docs
skills
aws
aws-cli-beast
aws-cost-optimization
aws-drawio-architecture-diagrams
aws-sam-bootstrap
aws-cloudformation
aws-cloudformation-auto-scaling
aws-cloudformation-bedrock
aws-cloudformation-cloudfront
aws-cloudformation-cloudwatch
aws-cloudformation-dynamodb
aws-cloudformation-ec2
aws-cloudformation-ecs
aws-cloudformation-elasticache
references
aws-cloudformation-iam
references
aws-cloudformation-lambda
aws-cloudformation-rds
aws-cloudformation-s3
aws-cloudformation-security
aws-cloudformation-task-ecs-deploy-gh
aws-cloudformation-vpc
references
developer-kit-core
agents
commands
skills
developer-kit-devops
developer-kit-java
agents
commands
docs
skills
aws-lambda-java-integration
aws-rds-spring-boot-integration
aws-sdk-java-v2-bedrock
aws-sdk-java-v2-core
aws-sdk-java-v2-dynamodb
aws-sdk-java-v2-kms
aws-sdk-java-v2-lambda
aws-sdk-java-v2-messaging
aws-sdk-java-v2-rds
aws-sdk-java-v2-s3
aws-sdk-java-v2-secrets-manager
clean-architecture
graalvm-native-image
langchain4j-ai-services-patterns
references
langchain4j-mcp-server-patterns
references
langchain4j-rag-implementation-patterns
references
langchain4j-spring-boot-integration
langchain4j-testing-strategies
langchain4j-tool-function-calling-patterns
langchain4j-vector-stores-configuration
references
qdrant
references
spring-ai-mcp-server-patterns
spring-boot-actuator
spring-boot-cache
spring-boot-crud-patterns
spring-boot-dependency-injection
spring-boot-event-driven-patterns
spring-boot-openapi-documentation
spring-boot-project-creator
spring-boot-resilience4j
spring-boot-rest-api-standards
spring-boot-saga-pattern
spring-boot-security-jwt
assets
references
scripts
spring-boot-test-patterns
spring-data-jpa
references
spring-data-neo4j
references
unit-test-application-events
unit-test-bean-validation
unit-test-boundary-conditions
unit-test-caching
unit-test-config-properties
references
unit-test-controller-layer
unit-test-exception-handler
references
unit-test-json-serialization
unit-test-mapper-converter
references
unit-test-parameterized
unit-test-scheduled-async
references
unit-test-service-layer
references
unit-test-utility-methods
unit-test-wiremock-rest-api
references
developer-kit-php
developer-kit-project-management
developer-kit-python
developer-kit-specs
commands
docs
hooks
test-templates
tests
skills
developer-kit-tools
developer-kit-typescript
agents
docs
hooks
rules
skills
aws-cdk
aws-lambda-typescript-integration
better-auth
clean-architecture
drizzle-orm-patterns
dynamodb-toolbox-patterns
references
nestjs
nestjs-best-practices
nestjs-code-review
nestjs-drizzle-crud-generator
nextjs-app-router
nextjs-authentication
nextjs-code-review
nextjs-data-fetching
nextjs-deployment
nextjs-performance
nx-monorepo
react-code-review
react-patterns
shadcn-ui
tailwind-css-patterns
tailwind-design-system
references
turborepo-monorepo
typescript-docs
typescript-security-review
zod-validation-utilities
references
github-spec-kit