plugins/developer-kit-core/skills/knowledge-graph/SKILL.md
Manages persistent Knowledge Graph for specifications. Caches agent discoveries and codebase analysis to remember findings across sessions. Validates task dependencies, stores patterns, components, and APIs to avoid redundant exploration. Use when: you need to cache analysis results, remember findings, reuse previous discoveries, look up what we found, spec-to-tasks needs to persist codebase analysis, task-implementation needs to validate contracts, or any command needs to query existing patterns/components/APIs.
npx skillsauth add giuseppe-trisciuoglio/developer-kit knowledge-graphInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Persistent JSON storage that caches agent discoveries and codebase analysis. Remember findings across sessions, validate task dependencies, query patterns/components/APIs, skip redundant exploration.
Location: docs/specs/[ID-feature]/knowledge-graph.json
Read existing Knowledge Graph or initialize empty structure:
Read file_path="docs/specs/001/knowledge-graph.json"
Returns full KG content. If file missing, returns empty structure and creates on first update.
Query specific sections: components, patterns, apis, integration-points, all
Read file_path="docs/specs/001/knowledge-graph.json"
Filter results by section and process in-memory.
# 1. Read existing
Read file_path="docs/specs/001/knowledge-graph.json"
# 2. Deep-merge updates (arrays append by ID, objects preserve existing)
# 3. Update timestamp
Write file_path="docs/specs/001/knowledge-graph.json" content="<merged JSON>"
Deep-merge rules:
id fieldmetadata.updated_at to current ISO timestampComplete JSON example for update:
{
"metadata": {
"spec_id": "001-hotel-search",
"created_at": "2026-03-14T10:30:00Z",
"updated_at": "2026-03-23T10:00:00Z",
"version": "1.0.0"
},
"patterns": {
"architectural": [
{
"id": "pat-001",
"name": "Repository Pattern",
"convention": "Extend JpaRepository<Entity, ID>",
"files": ["src/main/java/**/repository/*Repository.java"]
}
]
},
"components": {
"services": [
{
"id": "comp-svc-001",
"name": "HotelService",
"location": "src/main/java/com/example/hotel/service/HotelService.java",
"type": "service",
"methods": [{"name": "searchHotels", "returns": "List<HotelDTO>"}]
}
]
}
}
# 1. Read KG
Read file_path="docs/specs/001/knowledge-graph.json"
# 2. Check KG contains required IDs
# 3. Verify actual files exist
Grep pattern="src/**/HotelRepository.java"
Report satisfied dependencies and missing components.
# 1. Read KG and task expectations
Read file_path="docs/specs/001/knowledge-graph.json"
Glob pattern="src/**/ExpectedFile.java"
Grep pattern="class ExpectedClass|interface ExpectedInterface"
# 2. Match expectations against KG.provides
# 3. Report satisfied/unsatisfied contracts
# 1. Find implementation files
Glob pattern="src/**/*.java"
# 2. Extract symbols
Grep pattern="^(public|protected)? (class|interface|enum) " output_mode="content"
# 3. Classify by directory: /entity/ → entity, /service/ → service, /repository/ → repository
# 4. Update KG.provides with {task_id, file, symbols, type, implemented_at}
# 1. Find all KG files
Glob pattern="docs/specs/*/knowledge-graph.json"
# 2. Read each, extract patterns.architectural and patterns.conventions
# 3. Write merged .global-knowledge-graph.json
Write file_path="docs/specs/.global-knowledge-graph.json" content="<aggregated>"
knowledge-graph.json
├── metadata (spec_id, created_at, updated_at, version, analysis_sources)
├── codebase_context (project_structure, technology_stack)
├── patterns (architectural[], conventions[])
├── components (controllers[], services[], repositories[], entities[], dtos[])
├── provides[] ({ task_id, file, symbols[], type, implemented_at })
├── apis (internal[], external[])
└── integration_points[]
Complete schema with field definitions: See references/schema.md
| Scenario | Handling | |----------|----------| | File not found | Return empty KG; creates on first update | | Invalid JSON | Raise error; offer to recreate from analysis | | Merge conflicts | Deep-merge preserves existing, adds new with timestamps | | Write failure | Log error; continue without caching (non-blocking) |
Update workflow:
Read → docs/specs/[ID]/knowledge-graph.jsonWrite → same pathBefore expensive operations:
After discoveries:
Freshness guidelines:
30 days: Stale, re-analysis recommended
# Step 1: Check existing KG
Read file_path="docs/specs/001/knowledge-graph.json"
# Step 2: Analyze codebase (agent task)
Glob pattern="src/main/java/**/*.java"
Grep pattern="public (class|interface) " output_mode="content"
# Step 3: Build update with discoveries
Write file_path="docs/specs/001/knowledge-graph.json" content="{
\"metadata\": {
\"spec_id\": \"001-hotel-search\",
\"created_at\": \"2026-03-14T10:30:00Z\",
\"updated_at\": \"2026-03-23T10:00:00Z\",
\"version\": \"1.0.0\",
\"analysis_sources\": [{\"agent\": \"general-code-explorer\", \"timestamp\": \"2026-03-23T10:00:00Z\"}]
},
\"patterns\": {
\"architectural\": [{
\"id\": \"pat-001\",
\"name\": \"Repository Pattern\",
\"convention\": \"Extend JpaRepository<Entity, ID>\"
}]
},
\"components\": {
\"services\": [{
\"id\": \"comp-svc-001\",
\"name\": \"HotelService\",
\"location\": \"src/main/java/com/example/hotel/service/HotelService.java\",
\"type\": \"service\"
}],
\"repositories\": [{
\"id\": \"comp-repo-001\",
\"name\": \"HotelRepository\",
\"location\": \"src/main/java/com/example/hotel/repository/HotelRepository.java\",
\"type\": \"repository\"
}]
}
}"
# Read KG and task requirements
Read file_path="docs/specs/001/knowledge-graph.json"
# Verify components exist in codebase
Grep pattern="src/main/java/com/example/hotel/repository/HotelRepository.java"
Grep pattern="src/main/java/com/example/hotel/service/HotelService.java"
# Report validation result
# If all found: "All dependencies satisfied, proceed with implementation"
# If missing: "Warning: HotelService not found. Create it first?"
# Load KG to get cached context
Read file_path="docs/specs/001/knowledge-graph.json"
# Present summary to user:
# "Found cached analysis (2 days old):
# - Patterns: Repository Pattern, Service Layer
# - Components: HotelService, HotelController
# - Conventions: naming with *Controller/*Service/*Repository
# Use cached context for task generation?"
More examples: See references/query-examples.md
Critical Constraints:
knowledge-graph.jsondocs/specs/[ID]/ pathsLimitations:
aggregate operationWarnings:
references/schema.md - Complete JSON schema with field definitionsreferences/query-examples.md - Query patterns and integration examplesreferences/integration-patterns.md - Command integration detailsdevelopment
Provides final code cleanup after task review approval. Removes debug logs, temporary comments, dead code, optimizes imports, and improves readability. Use when asked to clean up code, polish, finalize, tidy up, remove technical debt, or prepare code for completion after review. Not for refactoring logic or fixing bugs—focused solely on cosmetic and hygiene cleanup.
tools
Ralph Wiggum-inspired automation loop for specification-driven development. Orchestrates task implementation, review, cleanup, and synchronization using a Python script. Use when: user runs /loop command, user asks to automate task implementation, user wants to iterate through spec tasks step-by-step, or user wants to run development workflow automation with context window management. One step per invocation. State machine: init → choose_task → implementation → review → fix → cleanup → sync → update_done. Supports --from-task and --to-task for task range filtering. State persisted in fix_plan.json.
testing
Creates, updates, validates, and displays the architectural DNA of a project through two shared documents: docs/specs/architecture.md (technology stack, architectural rules, security constraints, AI guardrails) and docs/specs/ontology.md (domain glossary / Ubiquitous Language). Use BEFORE brainstorm as a project setup step, or at any point in the SDD lifecycle to validate specs/tasks against architecture principles. Triggers on 'create constitution', 'update constitution', 'constitution check', 'validate against constitution', 'project principles', 'architectural guardrails', 'setup project architecture', 'define ontology'.
tools
Provides Qwen Coder CLI delegation workflows for coding tasks using Qwen2.5-Coder and QwQ models, including English prompt formulation, execution flags, and safe result handling. Use when the user explicitly asks to use Qwen for tasks such as code generation, refactoring, debugging, or architectural analysis. Triggers on "use qwen", "use qwen coder", "delegate to qwen", "ask qwen", "second opinion from qwen", "qwen opinion", "continue with qwen", "qwen session".