Nexus Skills is an open-source tool that solves one of the most expensive problems in AI-assisted development: codebase context. When you tell an AI coding assistant to “find where the user authentication is handled,” it either needs the entire codebase in its context window (costing thousands of tokens) or you must manually hunt down and paste the relevant files (wasting your time). Nexus Skills bridges this gap by building a persistent, queryable knowledge base from your codebase that AI assistants can search with minimal token overhead.
The project splits into two core components. Nexus-mapper is the indexing engine that scans your source code and generates structured intelligence – AST-based dependency graphs, file structure maps, call hierarchies, and change impact data. Nexus-query is the search interface that AI assistants (or you, via CLI) can query to find functions, trace dependencies, understand module relationships, and assess change impact.
What makes Nexus Skills particularly clever is its phase-gated workflow and zero-dependency philosophy. The mapper runs once when the codebase changes, not on every query. Queries return only the specific context needed, not the entire knowledge base. And the entire tool is implemented in pure Python with no external dependencies – no Node, no heavy ML models, no database servers.
Repository: github.com/Haaaiawd/Nexus-skills
How Does the Nexus-Mapper to Nexus-Query Pipeline Work?
flowchart LR
subgraph Indexing Phase
A[Source Code] --> B[Nexus-Mapper]
B --> C[File Structure Map]
B --> D[Dependency Graph\nAST-based]
B --> E[Call Hierarchy]
B --> F[Import Map]
end
subgraph Query Phase
G[Nexus-Query] --> H{Query Type}
H --> I[Find Function\nDefinition]
H --> J[Trace Dependency\nChain]
H --> K[Impact Analysis\nfor Changes]
H --> L[Module\nRelationships]
end
C --> G
D --> G
E --> G
F --> G
subgraph AI Session
M[AI Assistant] --> G
G --> N[Minimal Context\nResponse]
N --> M
endThe pipeline is designed around a fundamental insight: codebase knowledge is mostly static. Your file structure, class hierarchies, and dependency graph change only when you edit code – not between queries. By separating indexing from querying, Nexus Skills performs the expensive analysis once and serves lightweight queries repeatedly.
What Are the Key Data Structures Nexus-Mapper Generates?
| Data Structure | Description | Query Use Case |
|---|---|---|
| File Structure Map | Directory tree with file types, sizes, and modification times | “What modules are in the auth package?” |
| AST Dependency Graph | Function calls, class inheritance, and import relationships extracted from abstract syntax trees | “What functions call validate_user()?” |
| Call Hierarchy | Full call chains from entry points to leaf functions | “What is the full call path for login?” |
| Import Map | All import statements organized by module and external packages | “What third-party libraries are we using?” |
| Change Impact Index | Files affected by changes to specific functions or modules | “If I change the database schema, what breaks?” |
What Is the Phase-Gated Workflow?
Nexus Skills introduces a three-phase workflow that optimizes token usage in AI coding sessions:
sequenceDiagram
participant Dev as Developer
participant Mapper as Nexus-Mapper
participant Query as Nexus-Query
participant AI as AI Assistant
Note over Dev,AI: Phase 1: Analyze
Dev->>Mapper: Run mapper on codebase
Mapper->>Mapper: Parse AST, build graphs
Mapper->>Dev: Knowledge base created (./nexus/)
Note over Dev,AI: Phase 2: Implement
Dev->>AI: "Add error handling to login"
AI->>Query: "Find the login function"
Query->>AI: "login() in auth/auth.py line 42"
AI->>Query: "Show dependencies of auth module"
Query->>AI: "imports: jwt, database, cache"
AI->>Dev: Writes code with full context
Note over Dev,AI: Phase 3: Review
Dev->>Mapper: Run mapper after changes
Mapper->>Mapper: Detect changes, re-index
Mapper->>Dev: "login() modified. Impact: tests/test_auth.py, middleware/rate_limit.py"
AI->>Dev: Review and verify impact pointsPhase 1 (Analyze): Run nexus-mapper once at the start of a session or after pulling changes. This builds the full knowledge base.
Phase 2 (Implement): During development, the AI assistant calls nexus-query only when it needs to understand parts of the codebase it hasn’t seen. Each query returns the minimum context needed.
Phase 3 (Review): After making changes, run nexus-mapper again to detect what changed and perform impact analysis. The AI assistant uses this to verify nothing is broken.
How Does Nexus Skills Compare to Other Code Intelligence Tools?
| Feature | Nexus Skills | Code Graph Analyzer | grep/sourcegraph |
|---|---|---|---|
| AST-level understanding | Yes | Yes | No (text only) |
| Dependency graph traversal | Yes | Yes | No |
| Persistent knowledge base | Yes (disk) | No (in-memory) | No |
| AI assistant integration | Yes (native) | Partial | No |
| Zero dependencies | Yes (pure Python) | No (requires Node) | Varies |
| Update strategy | Incremental re-index | Full re-parse | N/A |
| Query cost | ~50 tokens/query | ~200+ tokens/query | ~100+ tokens/query |
How to Install and Configure Nexus Skills
git clone https://github.com/Haaaiawd/Nexus-skills.git
cd Nexus-skills
# Add to PATH
export PATH="$PWD:$PATH"
To integrate with Claude Code as a Skill:
mkdir -p ~/.claude/skills/nexus-skills
cp SKILL.md ~/.claude/skills/nexus-skills/
The skill file configures:
# ~/.claude/skills/nexus-skills/SKILL.md
nexus_base: /path/to/your/project/nexus
mapper_command: nexus-mapper /path/to/your/project
query_command: nexus-query /path/to/your/project/nexus
Once configured, you can query the codebase from within an AI coding session:
nexus-query --find-function "login"
nexus-query --dependencies "auth/auth.py"
nexus-query --impact-analysis "schema/database.py"
FAQ
What is Nexus Skills and what problem does it solve? Nexus Skills builds persistent, queryable knowledge bases from codebases for AI coding assistants. It solves context blindness by pre-indexing your codebase into structured intelligence that assistants can query instantly with minimal tokens.
What is the difference between nexus-mapper and nexus-query? Nexus-mapper is the indexing engine that scans your codebase and builds the knowledge base. Nexus-query is the search interface for querying it. Mapper runs when code changes; query runs on every question.
What is the phase-gated workflow in Nexus Skills? The three-phase workflow is: Phase 1 (analyze) – run mapper to capture codebase state; Phase 2 (implement) – query as needed during development; Phase 3 (review) – run mapper again to detect changes and assess impact.
Does Nexus Skills have any dependencies? Zero. Core functionality uses only Python standard library. No Node.js, no databases, no heavy ML models required.
How do I install Nexus Skills? Clone the repository and add scripts to PATH. Optionally create a Claude Code skill file for integrated AI assistant workflows.
Further Reading
- Nexus Skills GitHub Repository – Official source code, documentation, and setup guides
- Claude Code Skills Documentation – How to create and manage Claude Code skills including Nexus Skills integration
- AST Analysis with Python – Python’s built-in abstract syntax tree module used by nexus-mapper
- Dependency Graph Analysis in Software Engineering – Academic survey of dependency graph techniques relevant to codebase intelligence
無程式碼也能輕鬆打造專業LINE官方帳號!一鍵導入模板,讓AI助你行銷加分!