본문으로 건너뛰기
Skillpedia
머신러닝48k · #4640

fp-data-transforms

하는 일

이 도구는 코드 안에서 데이터를 정리하고 변환하도록 돕습니다. 목록(배열)과 객체 정보를 조작하고, 데이터를 효율적으로 결합할 수 있어 복잡한 정보를 다루기 쉽게 만듭니다.

사용하는 경우

  • ✓웹사이트나 앱에서 데이터를 받아 화면에 표시하도록 정리해야 할 때.
  • ✓기본 설정과 사용자 선호 설정을 합쳐야 할 때.
  • ✓고객 주문처럼 정보를 묶어 합계를 계산할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-data-transforms/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/fp-data-transforms/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 제품 목록을 각 항목의 이름과 가격을 보여 주는 형식으로 바꿔 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 데이터를 처리하기 위해 「함수형 패턴」을 사용합니다. 단계별 지시를 쓰는 대신 데이터에 무엇이 일어나야 하는지 정의하면, 도구가 체계적인 방식으로 실행합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Practical Data Transformations

This skill covers the data transformations you do every day: working with arrays, reshaping objects, normalizing API responses, grouping data, and safely accessing nested values. Each section shows the imperative approach first, then the functional equivalent, with honest assessments of when each approach shines.

Detailed Guide

Read the detailed guide before executing this skill. It retains the complete procedure and reference material. Treat its safety, prerequisites, and validation requirements as mandatory. For focused work, load the relevant sections; for end-to-end work, read the guide completely.

When to Use

  • You need to transform arrays, objects, grouped data, or nested values in TypeScript.
  • The task involves reshaping API responses, null-safe access, aggregation, or normalization.
  • You want practical functional patterns for everyday data work instead of low-level loops.

6. Real-World Examples

Example 1: Transform API Response to UI-Ready Data

// API response
interface ApiOrder {
  order_id: string;
  customer: {
    id: string;
    full_name: string;
  };
  line_items: Array<{
    product_id: string;
    product_name: string;
    qty: number;
    unit_price: number;
  }>;
  order_date: string;
  status: 'pending' | 'processing' | 'shipped' | 'delivered';
}

// What the UI needs
interface OrderSummary {
  id: string;
  customerName: string;
  itemCount: number;
  total: number;
  formattedTotal: string;
  date: string;
  statusLabel: string;
  statusColor: string;
}

// Transformation
const STATUS_CONFIG: Record<string, { label: string; color: string }> = {
  pending: { label: 'Pending', color: 'yellow' },
  processing: { label: 'Processing', color: 'blue' },
  shipped: { label: 'Shipped', color: 'purple' },
  delivered: { label: 'Delivered', color: 'green' },
};

const formatCurrency = (cents: number): string =>
  `$${(cents / 100).toFixed(2)}`;

const formatDate = (iso: string): string =>
  new Date(iso).toLocaleDateString('en-US', {
    month: 'short',
    day: 'numeric',
    year: 'numeric',
  });

const toOrderSummary = (order: ApiOrder): OrderSummary => {
  const total = order.line_items.reduce(
    (sum, item) => sum + item.qty * item.unit_price,
    0
  );

  const status = STATUS_CONFIG[order.status] ?? STATUS_CONFIG.pending;

  return {
    id: order.order_id,
    customerName: order.customer.full_name,
    itemCount: order.line_items.reduce((sum, item) => sum + item.qty, 0),
    total,
    formattedTotal: formatCurrency(total),
    date: formatDate(order.order_date),
    statusLabel: status.label,
    statusColor: status.color,
  };
};

// Transform all orders
const toOrderSummaries = (orders: ApiOrder[]): OrderSummary[] =>
  orders.map(toOrderSummary);

Example 2: Merge User Settings with Defaults

interface AppSettings {
  theme: {
    mode: 'light' | 'dark' | 'system';
    primaryColor: string;
    fontSize: 'small' | 'medium' | 'large';
  };
  notifications: {
    email: boolean;
    push: boolean;
    sms: boolean;
    frequency: 'immediate' | 'daily' | 'weekly';
  };
  privacy: {
    showProfile: boolean;
    showActivity: boolean;
    allowAnalytics: boolean;
  };
}

type DeepPartial<T> = {
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
};

const DEFAULT_SETTINGS: AppSettings = {
  theme: {
    mode: 'system',
    primaryColor: '#007bff',
    fontSize: 'medium',
  },
  notifications: {
    email: true,
    push: true,
    sms: false,
    frequency: 'immediate',
  },
  privacy: {
    showProfile: true,
    showActivity: true,
    allowAnalytics: true,
  },
};

const deepMergeSettings = (
  defaults: AppSettings,
  user: DeepPartial<AppSettings>
): AppSettings => ({
  theme: { ...defaults.theme, ...user.theme },
  notifications: { ...defaults.notifications, ...user.notifications },
  privacy: { ...defaults.privacy, ...user.privacy },
});

// Usage
const userPreferences: DeepPartial<AppSettings> = {
  theme: { mode: 'dark' },
  notifications: { sms: true, frequency: 'daily' },
};

const finalSettings = deepMergeSettings(DEFAULT_SETTINGS, userPreferences);

Example 3: Group Orders by Customer with Totals

interface Order {
  id: string;
  customerId: string;
  customerName: string;
  items: Array<{ name: string; price: number; quantity: number }>;
  date: string;
}

interface CustomerOrderSummary {
  customerId: string;

…
자주 묻는 질문

「함수형 패턴」이란 무엇인가요?

「어떻게」 하는지보다 데이터에 「무엇」을 할지에 집중하는 코드 작성 방식입니다. 그래서 코드가 더 깔끔하고 이해하기 쉬워집니다.

「널 안전 접근」이란 무엇인가요?

다른 정보 안에 중첩된 정보(데이터 안의 데이터)에 접근할 때, 경로의 일부가 없어도 프로그램이 충돌하지 않도록 하는 방식입니다.

이것을 쓰려면 프로그래밍을 알아야 하나요?

이 도구는 이미 프로그래밍에 익숙하고 흔한 데이터 조작을 단순하게 하고 싶은 사람을 위해 설계되었습니다.

상세 정보

작성자의 원본 설명

Everyday data transformations using functional patterns - arrays, objects, grouping, aggregation, and null-safe access

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4640
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬