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
Comprehensive error handling strategies and behaviors for Knowledge Graph operations.
Scenario: KG file doesn't exist at expected path.
Behavior:
Empty KG Structure:
{
"metadata": {
"spec_id": null,
"feature_name": null,
"created_at": null,
"updated_at": null,
"version": "1.0",
"analysis_sources": []
},
"codebase_context": {
"project_structure": {},
"technology_stack": []
},
"patterns": {
"architectural": [],
"conventions": []
},
"components": {
"controllers": [],
"services": [],
"repositories": [],
"entities": [],
"dtos": []
},
"provides": [],
"apis": {
"internal": [],
"external": []
},
"integration_points": []
}When this occurs:
User impact: None (normal operation)
Scenario: KG file exists but contains invalid JSON.
Behavior:
Detection:
try:
kg_data = json.load(kg_file)
except json.JSONDecodeError as e:
raise KnowledgeGraphError(
f"Knowledge graph corrupted at {path}: {str(e)}"
)Recovery options:
User impact: High (cannot use existing KG)
Scenario: Concurrent updates to KG cause merge conflicts.
Behavior:
Merge Strategy:
Example merge:
def merge_kg(existing, updates):
# Arrays: append if not duplicate
for key in ['patterns', 'components', 'apis']:
for item in updates[key]:
if item not in existing[key]:
existing[key].append(item)
# Objects: deep merge
for key in ['codebase_context']:
existing[key].update(updates[key])
# Metadata: always update
existing['metadata']['updated_at'] = datetime.now().isoformat()
return existingDetection:
Prevention:
Scenario: Cannot write KG file (permissions, disk full, etc.).
Behavior:
Detection:
try:
with open(kg_path, 'w') as f:
json.dump(kg_data, f, indent=2)
except (IOError, OSError) as e:
logger.error(f"Cannot write knowledge graph: {str(e)}")
# Continue without caching
return NoneImpact:
Recovery:
Scenario: Invalid path provided for KG operations.
Behavior:
Validation rules:
docs/specs/.. (parent directory)Example:
def validate_kg_path(path):
# Must start with docs/specs/
if not path.startswith("docs/specs/"):
raise ValueError(f"Invalid KG path: {path}")
# No path traversal
if ".." in path:
raise ValueError(f"Path traversal not allowed: {path}")
# Must resolve within project
real_path = Path(path).resolve()
project_root = Path.cwd()
if not str(real_path).startswith(str(project_root)):
raise ValueError(f"Path outside project: {path}")
return real_pathScenario: Validation requirements reference non-existent components.
Behavior:
Error types:
Example:
{
"errors": [
"Component comp-svc-missing not found in codebase"
],
"warnings": [
"API api-int-001 not found, may need implementation"
],
"valid": false
}Recovery:
Scenario: Expected symbols not found in completed dependencies.
Behavior:
Example:
{
"satisfied": [
{
"expectation": "Search entity with symbols [Search, SearchStatus]",
"provided_by": "TASK-001"
}
],
"unsatisfied": [
{
"expectation": "SearchId value object",
"provided_by": "None",
"reason": "No completed dependency provides SearchId"
}
],
"valid": false
}Recovery:
Scenario: Cannot extract symbols from source files.
Behavior:
Causes:
Example:
try:
symbols = extract_symbols_from_file(file_path)
except ParseError as e:
logger.warning(f"Could not extract symbols from {file_path}: {e}")
symbols = []Impact:
When to retry:
Retry configuration:
MAX_RETRIES = 3
RETRY_DELAY = 1 # seconds
def retry_on_failure(func):
for attempt in range(MAX_RETRIES):
try:
return func()
except TransientError as e:
if attempt == MAX_RETRIES - 1:
raise
time.sleep(RETRY_DELAY * (2 ** attempt)) # Exponential backoffWhen KG is unavailable:
Example:
⚠️ Warning: Knowledge graph unavailable
Continuing without caching (performance may be degraded)
Would you like to recreate the knowledge graph from codebase analysis?Principle: Fail gracefully, don't block workflow.
Examples:
| Error | Message | Action |
|---|---|---|
| File not found | "No existing knowledge graph, will create new" | Continue (normal) |
| Invalid JSON | "Knowledge graph corrupted at {path}. Recreate from codebase?" | Ask user |
| Write failed | "Cannot write knowledge graph, continuing without cache" | Log and continue |
| Invalid path | "Invalid knowledge graph path: {path}" | Raise error |
| Validation failed | "Validation failed: N errors, M warnings" | Report and continue |
| Contract failed | "N unsatisfied expectations" | Report and continue |
| Extraction failed | "Could not extract symbols from {file}" | Log warning |
| Level | When to Use | Example |
|---|---|---|
| Info | Normal operation | "Created new knowledge graph" |
| Warning | Non-critical issue | "Knowledge graph is stale (30 days old)" |
| Error | Operation failed | "Cannot write knowledge graph" |
| Critical | System broken | "Knowledge graph corrupted beyond repair" |
Always log:
Sometimes log:
Never log:
logger.info(f"Knowledge graph operation: {operation} on {path}")
logger.warning(f"Stale knowledge graph: {days} days old")
logger.error(f"Failed to write KG: {error}", exc_info=True)
logger.debug(f"KG validation result: {validation}")Validate paths:
docs/specs/..)Validate data:
Validate operations:
File writes:
Example:
import tempfile
import os
def atomic_write(path, data):
# Write to temp file
temp_fd, temp_path = tempfile.mkstemp(
dir=os.path.dirname(path)
)
try:
with os.fdopen(temp_fd, 'w') as f:
json.dump(data, f, indent=2)
# Atomic rename
os.replace(temp_path, path)
except:
# Cleanup on failure
os.unlink(temp_path)
raiseDesign operations to be idempotent:
Example:
def update_kg(path, updates):
kg = read_kg(path) # Returns empty KG if not exists
merged = merge(kg, updates) # Idempotent merge
write_kg(path, merged)../../etc/passwd → Raises errordef test_write_failure():
# Mock file write to fail
with mock.patch('builtins.open', side_effect=IOError):
result = write_kg(path, data)
# Should return None, not raise
assert result is NoneError handling principles:
Key behaviors:
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