| name | code-communities |
| description | Detects architectural clusters and coupling boundaries via community detection on the code graph. Use when identifying module groupings or refactoring targets. |
Code Community Detection
Identify architectural clusters and module boundaries
in the codebase.
When NOT To Use
- One module's imports (use
cartograph:dependency-graph)
- Rendering an architecture already decided (use
cartograph:architecture-diagram)
Prerequisites
This skill requires the gauntlet plugin for graph
data. Discover it:
GRAPH_QUERY=$(find ~/.claude/plugins -name "graph_query.py" -path "*/gauntlet/*" 2>/dev/null | head -1)
If gauntlet is not installed: Fall back to directory
structure analysis. Group files by directory and use
import statements to identify module boundaries. Generate
a Mermaid diagram from directory-level relationships.
If installed but no graph.db: Tell the user to run
/gauntlet-graph build.
Steps
-
Run community detection (requires gauntlet):
python3 "$GRAPH_QUERY" --action communities
Fallback (no gauntlet): Analyze directory structure
and cross-directory imports:
find . -name "*.py" -not -path "*/node_modules/*" | \
sed 's|/[^/]*$||' | | -c | -rn
-v rg &>/dev/null;
rg -- py -l . | \
xargs -I{} rg {} --no-filename
grep -rh --include= .
| | -c | -rn | -20