Agent Skills and Context7 MCP
Relevant source files
The following files were used as context for generating this wiki page:
The data-path project integrates with AI-native ecosystems through two primary mechanisms: Context7 MCP and Agent Skills. These systems allow AI assistants to understand, load, and utilize the library's type-safe path manipulation capabilities directly within a development context.
Context7 MCP provides a Model Context Protocol (MCP) server implementation, while Agent Skills offer a structured framework for AI assistants to follow specific workflows for form binding, state updates, and validation mapping.
Sources: README.md:53-62, skills/data-path/SKILL.md:1-10
Context7 MCP Integration
The library is available as a Context7 MCP server. This allows AI assistants to load the documentation and library logic into their active context. The project uses tsup to build the MCP server, ensuring that it can be instantly rebuilt during development.
Sources: README.md:53-55, CONTRIBUTING.md:40-42
Installation and Loading
Users can install the skill-compatible component to provide guidance to their AI assistants using the following command:
npx ctx7 skills install /sergeyshmakov/data-path data-path
Sources: README.md:59-62
Agent Skills Framework
The Agent Skill for data-path is defined in skills/data-path/SKILL.md. It provides metadata and instructions that tell an AI assistant when and how to apply the library's features.
Skill Triggers
The skill is designed to activate when specific user intents are detected:
- Binding form fields to nested structures (e.g.,
users[i].firstName). - Updating deeply nested state immutably (e.g., Zustand,
useState). - Mapping validation errors (like Zod issues) to specific UI fields.
- Defining table column accessors for libraries like TanStack Table.
- Composing or comparing paths programmatically.
Sources: skills/data-path/SKILL.md:12-21
AI Assistant Workflow Logic
The following diagram illustrates how the Agent Skill guides an AI assistant from detecting a need to providing a type-safe implementation.
The diagram shows the logic used by an AI assistant to determine if the data-path skill should be applied based on user prompts.
Sources: skills/data-path/SKILL.md:12-65
Operational Workflows
The Agent Skill defines five core workflows that AI assistants follow to ensure correct implementation of the library.
Key Implementation Workflows
| Workflow | Use Case | Core Logic |
|---|---|---|
| Form Binding | React Hook Form / TanStack Form | Define FormValues type; create path with loop index inside lambda; use path.$ for field registration. |
| State Update | Zustand / useState | Create path at module scope; use path.set(state, newValue) in setters for structural cloning. |
| Error Mapping | Zod Validation | Join issue.path into unsafePath; compare with expected path.equals(). |
| Bulk Operations | Collection manipulation | Use .each() or .deep() templates; use .get() for arrays of values or .set() for bulk updates. |
| Path Composition | Reusable Components | Use .merge() to extend base paths and .subtract() to find relative paths. |
Sources: skills/data-path/SKILL.md:29-65, skills/data-path/references/api.md:1-50
Integration Rules and Constraints
To maintain type safety and avoid runtime errors, the Agent Skill enforces several technical rules:
- Lambda Capture: Path lambdas must capture runtime variables (like loop indices) at creation time:
path<T>(p => p.users[i].name). - Access Safely: The
.get()method returnsundefinedfor missing intermediate segments rather than throwing. - Immutability: All
.set()operations must be treated as immutable, returning a new structural clone. - Template Constraints:
.each()and.deep()are only available on non-primitive values (cannot be called on strings, numbers, or booleans).
Sources: skills/data-path/SKILL.md:67-73, skills/data-path/references/api.md:25-30
Tooling and Environment
The project infrastructure supports the MCP and Skill ecosystem through standardized build and linting tools.
This diagram outlines the build pipeline defined in package.json that supports the distribution of the library and its MCP server.
Sources: package.json:11-20, CONTRIBUTING.md:40-42
Key Development Scripts
| Script | Command | Purpose |
|---|---|---|
| Build | npm run build | Compiles the library and MCP server using tsup. |
| Dev | npm run dev | Rebuilds the MCP server instantly on file save. |
| Lint | npm run lint:fix | Uses Biome for zero-config formatting and linting. |
Sources: package.json:11-20, CONTRIBUTING.md:25-45
Summary
The "Agent Skills and Context7 MCP" feature set transforms data-path from a simple utility library into an AI-ready toolset. By providing structured workflows and a Model Context Protocol server, the project ensures that AI assistants can provide accurate, type-safe code suggestions for complex data structures and state management patterns.