new-data-function

Implement a Go data layer function with pagination and CRUD patterns.

109|17|Updated May 8, 2021
One-click install
npx skills add https://github.com/straubt1/tfx --skill new-data-function
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-data-function
Source: https://github.com/straubt1/tfx/tree/main/.claude/skills/new-data-function
Command: npx skills add https://github.com/straubt1/tfx --skill new-data-function

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The data/ package is the sole boundary between TFx and the go-tfe SDK. All API calls happen in this layer to keep the codebase testable, maintainable, and easy to reason about.

Core Features & Use Cases

  • Standardized pagination using client.FetchAll with PageSize 100.
  • Consistent function naming patterns (Fetch*, GetID, Create/Update*/Delete*).
  • Co-located tests, header comments, and clear error handling aligned with the repository’s conventions.

Quick Start

Create a new Go file under data/ following the examples in data/projects.go to implement the requested function for a target resource.

Frequently Asked Questions about new-data-function

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

FAQPage Schema
How do I implement a Go data-layer function for go-tfe with standard pagination?

Implement a new data/ layer function using client.FetchAll with PageSize 100 to handle paginated lists. Apply consistent naming patterns and standard Create, Read, Update, and Delete operations for the target API resource.

What naming conventions should I use for go-tfe API resource functions in the data layer?

Use consistent function naming patterns like Fetch for listing, Get*ID for single reads, and Create, Update, or Delete for mutations. These conventions keep the codebase testable and maintainable across the go-tfe SDK boundary.

How do I structure a Go data layer file to keep API calls testable?

Structure a self-contained Go file under the data/ directory with proper header comments, imports, and co-located tests. This isolates all go-tfe SDK API calls within the data layer to keep the codebase easy to reason about.

How do I handle errors when creating a new data function for the go-tfe SDK?

Apply clear error handling aligned with the repository conventions within your data/ layer function. Return errors from the go-tfe SDK directly through the data layer boundary to maintain testability and consistent error reporting.

Does the go-tfe data layer function support standard CRUD operations?

Yes, the data layer function supports standard Create, Read, Update, and Delete patterns where applicable. It applies these operations to a concrete API resource alongside paginated list fetching using client.FetchAll.

Can I use a different page size for client.FetchAll in my Go data layer?

No, the project conventions require using client.FetchAll with a PageSize of 100 for paginated lists. Adhering to this standardized pagination ensures consistent API resource retrieval across the data layer boundary.