data-layer

Create uniform cached getters for diverse data sources.

6.0k|5.4k|Updated Jan 6, 2018
One-click install
npx skills add https://github.com/ethereum/ethereum-org-website --skill data-layer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-layer
Source: https://github.com/ethereum/ethereum-org-website/tree/main/.claude/skills/data-layer
Command: npx skills add https://github.com/ethereum/ethereum-org-website --skill data-layer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill provides a structured approach to building a consistent, cached data-access layer for multiple data sources, reducing boilerplate and ensuring predictable behavior across the codebase.

Core Features & Use Cases

  • Uniform getters: Centralized pattern for pure passthrough getters backed by a single KEYS map.
  • Caching & invalidation: Built-in caching strategy to balance freshness and performance via a wrapper in lib/data.
  • Data source integration: Clear directory structure and guidelines for adding fetchers, mocks, and development utilities.

Quick Start

Create a new fetcher in src/data-layer/fetchers and wire it into KEYS, then expose via a getter and add a cached wrapper.

Frequently Asked Questions about data-layer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a cached data-layer for multiple data sources?

A cached data-layer provides uniform getters backed by a single KEYS map, with built-in caching to balance freshness and performance. Create fetchers in src/data-layer/fetchers, wire them into KEYS, expose via getters, and add cached wrappers in lib/data for predictable, centralized data access.

What's the best way to structure fetchers and getters in TypeScript?

Organize fetchers in src/data-layer with a consistent pattern: pure passthrough getters backed by a centralized KEYS map. This ensures a single source of truth, reduces boilerplate, and enables predictable behavior across your codebase.

Can I use cached getters for development and testing?

Yes. The data-layer pattern supports optional mocks and development infrastructure within the same file structure, letting you swap implementations without changing getter signatures while maintaining the centralized KEYS map.

How does caching invalidation work in a data-layer?

Caching invalidation is managed through a wrapper in lib/data that balances freshness and performance. The centralized KEYS map coordinates cache lifecycle, ensuring all getters respect the same invalidation strategy.

Do I need to refactor existing data fetches to use this pattern?

No immediate refactor is required. Add new fetchers incrementally by creating them in src/data-layer/fetchers, wiring into KEYS, and exposing via cached getters. Gradual adoption reduces risk while establishing consistent patterns.

What problem does a single source of truth (KEYS) solve?

A centralized KEYS map eliminates duplicate data-access logic and coordinates all fetchers from one place. This ensures consistent naming, predictable getter behavior, and simplified maintenance across diverse data sources.