Agent skill

data-substrate-analysis

Analyze fundamental data primitives, type systems, and state management patterns in a codebase. Use when (1) evaluating typing strategies (Pydantic vs TypedDict vs loose dicts), (2) assessing immutability and mutation patterns, (3) understanding serialization approaches, (4) documenting state shape and lifecycle, or (5) comparing data modeling approaches across frameworks.

Stars 232
Forks 15

Install this agent skill to your Project

npx add-skill https://github.com/aiskillstore/marketplace/tree/main/skills/dowwie/data-substrate-analysis

SKILL.md

Data Substrate Analysis

Analyzes the fundamental units of data and state management patterns.

Process

  1. Locate type files — Find types.py, schema.py, models.py, state.py
  2. Classify typing — Strict (Pydantic), structural (TypedDict), loose (dict)
  3. Analyze mutation — In-place modification vs. copy-on-write
  4. Document serialization — json(), dict(), pickle, custom methods

Typing Strategy Classification

Detection Patterns

Strategy Indicators Files to Check
Pydantic BaseModel, Field(), validator models.py, schema.py
Dataclass @dataclass, field() types.py, models.py
TypedDict TypedDict, Required[], NotRequired[] types.py
NamedTuple NamedTuple, typing.NamedTuple types.py
Loose Dict[str, Any], plain dict Throughout

Analysis Questions

  • Are boundaries validated (API ingress/egress)?
  • Is nesting depth reasonable (<3 levels)?
  • Are optional fields explicit or implicit None?
  • Version migration path (Pydantic V1 → V2)?

Immutability Analysis

Mutable Patterns (Risk Indicators)

python
# In-place list modification
state.messages.append(msg)
state.history.extend(new_items)

# Direct dict mutation
state['key'] = value
state.update(new_data)

# Object attribute mutation
state.status = 'complete'

Immutable Patterns (Safer)

python
# Pydantic copy
new_state = state.model_copy(update={'key': value})

# Dataclass replace
new_state = replace(state, messages=[*state.messages, msg])

# Spread operator style
new_state = {**state, 'key': value}

# Frozen dataclass
@dataclass(frozen=True)
class State: ...

Serialization Strategy

Common Patterns

Method Code Pattern Trade-offs
Pydantic JSON .model_dump_json() Type-safe, automatic
Pydantic Dict .model_dump() For internal use
Dataclass asdict(obj) Manual, no validation
Custom to_dict(), from_dict() Full control
Pickle pickle.dumps() Fast, fragile, security risk
JSON json.dumps(obj, default=...) Requires encoder

Questions to Answer

  • Is serialization implicit (automatic) or explicit (manual)?
  • How are nested objects handled?
  • Is deserialization validated?
  • What happens with unknown fields?

Output Template

markdown
## Data Substrate Analysis: [Framework Name]

### Typing Strategy
- **Primary Approach**: [Pydantic/Dataclass/TypedDict/Loose]
- **Key Files**: [List of files]
- **Nesting Depth**: [Shallow/Medium/Deep]
- **Validation**: [At boundaries/Everywhere/None]

### Core Primitives

| Type | Location | Purpose | Mutability |
|------|----------|---------|------------|
| Message | schema.py:L15 | Chat message | Immutable |
| State | state.py:L42 | Agent state | Mutable ⚠️ |
| Result | types.py:L78 | Tool output | Immutable |

### Mutation Analysis
- **Pattern**: [In-place/Copy-on-write/Mixed]
- **Risk Areas**: [List of mutable state locations]
- **Concurrency Safe**: [Yes/No/Partial]

### Serialization
- **Method**: [Pydantic/Custom/JSON]
- **Implicit/Explicit**: [Description]
- **Round-trip Tested**: [Yes/No/Unknown]

Integration

  • Prerequisite: codebase-mapping to identify type files
  • Feeds into: comparative-matrix for typing decisions
  • Related: resilience-analysis for error handling in serialization

Expand your agent's capabilities with these related and highly-rated skills.

aiskillstore/marketplace

perigon-backend

Perigon ASP.NET Core + EF Core + Aspire conventions

232 15
Explore
aiskillstore/marketplace

perigon-agent

Pointers for Copilot/agents to apply Perigon conventions

232 15
Explore
aiskillstore/marketplace

perigon-angular

Angular 21+ standalone/Material/signal conventions for Perigon WebApp

232 15
Explore
aiskillstore/marketplace

fastapi-mastery

Comprehensive FastAPI development skill covering REST API creation, routing, request/response handling, validation, authentication, database integration, middleware, and deployment. Use when working with FastAPI projects, building APIs, implementing CRUD operations, setting up authentication/authorization, integrating databases (SQL/NoSQL), adding middleware, handling WebSockets, or deploying FastAPI applications. Triggered by requests involving .py files with FastAPI code, API endpoint creation, Pydantic models, or FastAPI-specific features.

232 15
Explore
aiskillstore/marketplace

context7-efficient

Token-efficient library documentation fetcher using Context7 MCP with 86.8% token savings through intelligent shell pipeline filtering. Fetches code examples, API references, and best practices for JavaScript, Python, Go, Rust, and other libraries. Use when users ask about library documentation, need code examples, want API usage patterns, are learning a new framework, need syntax reference, or troubleshooting with library-specific information. Triggers include questions like "Show me React hooks", "How do I use Prisma", "What's the Next.js routing syntax", or any request for library/framework documentation.

232 15
Explore
aiskillstore/marketplace

browser-use

Browser automation using Playwright MCP. Navigate websites, fill forms, click elements, take screenshots, and extract data. Use when tasks require web browsing, form submission, web scraping, UI testing, or any browser interaction.

232 15
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results