Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

test-data-strategy测试数据策略

Agent Skill

用于辅助数据整理、表格处理、CSV/Excel 分析、指标计算和图表准备。它适合让 Agent 清洗字段、汇总数据、发现异常、生成统计口径或把分析结果转成可读说明。使用时需要确认数据来源、字段含义和时间范围,避免把样本数据当全量事实;涉及敏感数据、导出文件或批量写回时,应先确认权限和脱敏边界。

总安装

220

周安装

9

GitHub Stars

61

下载量

71
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:test-data-strategy(测试数据策略)
来源仓库:https://github.com/melodic-software/claude-code-plugins
仓库路径:skills/test-data-strategy
安装命令:
npx skills add https://github.com/melodic-software/claude-code-plugins --skill test-data-strategy
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/melodic-software/claude-code-plugins --skill test-data-strategy

简介

用于辅助数据整理、表格处理、CSV/Excel 分析和指标计算。

  • 适合清洗字段、汇总数据、发现异常或生成统计口径。
  • 需确认数据来源、字段含义和时间范围后再操作。
  • 涉及敏感数据或批量写回时应先确认权限和脱敏边界。
  • test-data-strategy 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Test Data Strategy

When to Use This Skill

Use this skill when:

  • Test Data Strategy tasks - Working on plan comprehensive test data management including synthetic data generation, data anonymization, versioning, and environment-specific strategies
  • Planning or design - Need guidance on Test Data Strategy approaches
  • Best practices - Want to follow established patterns and standards

Overview

Effective test data management ensures tests have the right data at the right time while protecting sensitive information and maintaining data quality across environments.

Test Data Types

TypeSourceUse CasePrivacy Risk
SyntheticGeneratedUnit/Integration testsNone
SubsetProduction samplePerformance testingMedium
MaskedAnonymized productionRealistic scenariosLow
Production CloneFull copyPre-prod validationHigh
BaselineCurated referenceRegression testingLow

Test Data Strategy Template

# Test Data Strategy: [Project Name]

## 1. Data Requirements

### By Test Level
| Level | Data Source | Volume | Refresh |
|-------|-------------|--------|---------|
| Unit | Synthetic | Minimal | On-demand |
| Integration | Synthetic/Subset | Moderate | Per run |
| System | Masked production | Realistic | Weekly |
| Performance | Scaled synthetic | Production-like | Per release |

### By Feature Area
| Feature | Critical Data | Volume Required | Sensitivity |
|---------|---------------|-----------------|-------------|
| Authentication | User accounts | 1000 | High |
| Payments | Transactions | 10000 | High |
| Reporting | Historical data | 1M records | Medium |

## 2. Data Generation Strategy

### Synthetic Data Tools
- **Unit Tests**: AutoFixture, Bogus
- **Integration**: TestContainers + Seed
- **Performance**: Bulk generators

### Generation Rules
| Entity | Key Fields | Generation Logic |
|--------|------------|------------------|
| User | Email | `{guid}@test.example.com` |
| Order | Amount | `Random(1, 10000)` |
| Date | Timestamp | `Random(now-1y, now)` |

## 3. Data Anonymization

### PII Fields
| Field | Original | Anonymization Method |
|-------|----------|---------------------|
| Name | John Smith | Faker generated |
| Email | john@acme.com | `hash@domain.test` |
| Phone | 555-123-4567 | `555-xxx-xxxx` |
| SSN | 123-45-6789 | `xxx-xx-xxxx` |
| Address | 123 Main St | Faker address |
| DOB | 1985-03-15 | Shift by random days |

### Anonymization Rules
- Preserve data relationships
- Maintain referential integrity
- Keep statistical properties
- Remove unique identifiers

## 4. Environment Strategy

### Dev Environment
- Source: 100% synthetic
- Refresh: On-demand
- Volume: Minimal

### QA Environment
- Source: Masked production subset
- Refresh: Weekly
- Volume: 10% of production

### Staging Environment
- Source: Masked production clone
- Refresh: Before each release
- Volume: 100% of production

### Performance Environment
- Source: Scaled synthetic
- Refresh: Before performance runs
- Volume: 150% of production

## 5. Data Versioning

### Baseline Management
- Version baseline data sets
- Track data schema changes
- Maintain backward compatibility
- Document data dependencies

### Refresh Procedures
1. Trigger: [Manual/Scheduled/Event]
2. Source: [Production/Backup/Generator]
3. Transform: [Anonymization steps]
4. Load: [Target environment]
5. Validate: [Verification checks]

## 6. Compliance Requirements

### GDPR Compliance
- [ ] No real EU citizen data in non-prod
- [ ] Right to erasure supported
- [ ] Data minimization applied
- [ ] Consent tracking anonymized

### HIPAA Compliance
- [ ] PHI fully de-identified
- [ ] Safe Harbor method applied
- [ ] Audit logs maintained
- [ ] Access controls verified

Synthetic Data Generation (.NET)

Using Bogus

using Bogus;

public class TestDataGenerator
{
    public static Faker<Customer> CustomerFaker => new Faker<Customer>()
        .RuleFor(c => c.Id, f => f.Random.Guid())
        .RuleFor(c => c.FirstName, f => f.Person.FirstName)
        .RuleFor(c => c.LastName, f => f.Person.LastName)
        .RuleFor(c => c.Email, (f, c) => f.Internet.Email(c.FirstName, c.LastName))
        .RuleFor(c => c.Phone, f => f.Phone.PhoneNumber())
        .RuleFor(c => c.DateOfBirth, f => f.Date.Past(50, DateTime.Now.AddYears(-18)))
        .RuleFor(c => c.Address, f => new Address
        {
            Street = f.Address.StreetAddress(),
            City = f.Address.City(),
            State = f.Address.StateAbbr(),
            Zip = f.Address.ZipCode()
        });

    public static Faker<Order> OrderFaker(Customer customer) => new Faker<Order>()
        .RuleFor(o => o.Id, f => f.Random.Guid())
        .RuleFor(o => o.CustomerId, customer.Id)
        .RuleFor(o => o.OrderDate, f => f.Date.Recent(30))
        .RuleFor(o => o.Total, f => f.Finance.Amount(10, 1000))
        .RuleFor(o => o.Status, f => f.PickRandom<OrderStatus>());
}

Using AutoFixture

using AutoFixture;
using AutoFixture.Xunit2;

public class CustomerTests
{
    [Theory, AutoData]
    public void CreateCustomer_WithValidData_Succeeds(Customer customer)
    {
        // AutoFixture generates valid Customer automatically
        var result = _service.Create(customer);
        Assert.True(result.IsSuccess);
    }

    [Theory, AutoData]
    public void ProcessOrder_CalculatesCorrectTotal(
        [Frozen] Customer customer,
        Order order,
        List<OrderItem> items)
    {
        // Frozen ensures customer is reused
        // Order and items are auto-generated
        order.Items = items;
        var total = _calculator.Calculate(order);
        Assert.Equal(items.Sum(i => i.Quantity * i.Price), total);
    }
}

Seeding Test Databases

public class TestDatabaseSeeder
{
    public static async Task SeedAsync(AppDbContext context)
    {
        // Clear existing data
        await context.Database.ExecuteSqlRawAsync("DELETE FROM Orders");
        await context.Database.ExecuteSqlRawAsync("DELETE FROM Customers");

        // Generate test data
        var customers = TestDataGenerator.CustomerFaker.Generate(100);
        await context.Customers.AddRangeAsync(customers);

        foreach (var customer in customers)
        {
            var orders = TestDataGenerator.OrderFaker(customer).Generate(5);
            await context.Orders.AddRangeAsync(orders);
        }

        await context.SaveChangesAsync();
    }
}

Data Anonymization Techniques

TechniqueDescriptionUse Case
SubstitutionReplace with fake dataNames, emails
ShufflingRearrange within columnSalaries, dates
MaskingPartial hidingSSN (xxx-xx-1234)
GeneralizationReduce precisionAge ranges, zip prefix
NullingRemove entirelyUnnecessary fields
TokenizationReplace with tokenCross-reference needs
HashingOne-way transformIdentifiers

.NET Anonymization Example

public class DataAnonymizer
{
    public Customer Anonymize(Customer source)
    {
        return new Customer
        {
            Id = source.Id, // Preserve for relationships
            FirstName = _faker.Person.FirstName,
            LastName = _faker.Person.LastName,
            Email = $"{Guid.NewGuid():N}@test.example.com",
            Phone = MaskPhone(source.Phone),
            SSN = "xxx-xx-" + source.SSN.Substring(7, 4),
            DateOfBirth = ShiftDate(source.DateOfBirth),
            Address = new Address
            {
                Street = _faker.Address.StreetAddress(),
                City = source.Address.City, // Preserve geography
                State = source.Address.State,
                Zip = source.Address.Zip.Substring(0, 3) + "00"
            }
        };
    }

    private string MaskPhone(string phone)
    {
        // Keep area code, mask rest
        return Regex.Replace(phone, @"(\d{3})\d{3}(\d{4})", "$1-xxx-$2");
    }

    private DateTime ShiftDate(DateTime date)
    {
        // Shift by random days within ±30
        return date.AddDays(_random.Next(-30, 30));
    }
}

Test Data Patterns

Builder Pattern

public class CustomerBuilder
{
    private Customer _customer = new();

    public CustomerBuilder WithName(string first, string last)
    {
        _customer.FirstName = first;
        _customer.LastName = last;
        return this;
    }

    public CustomerBuilder WithPremiumStatus()
    {
        _customer.IsPremium = true;
        _customer.PremiumSince = DateTime.Now.AddYears(-1);
        return this;
    }

    public CustomerBuilder WithOrders(int count)
    {
        _customer.Orders = TestDataGenerator.OrderFaker(_customer).Generate(count);
        return this;
    }

    public Customer Build() => _customer;
}

// Usage
var customer = new CustomerBuilder()
    .WithName("Test", "User")
    .WithPremiumStatus()
    .WithOrders(5)
    .Build();

Object Mother Pattern

public static class TestCustomers
{
    public static Customer ValidCustomer() => new()
    {
        Id = Guid.NewGuid(),
        FirstName = "Test",
        LastName = "User",
        Email = "test@example.com",
        Status = CustomerStatus.Active
    };

    public static Customer PremiumCustomer() => new()
    {
        Id = Guid.NewGuid(),
        FirstName = "Premium",
        LastName = "User",
        Email = "premium@example.com",
        IsPremium = true,
        Status = CustomerStatus.Active
    };

    public static Customer InactiveCustomer() => new()
    {
        Id = Guid.NewGuid(),
        Status = CustomerStatus.Inactive
    };
}

Integration Points

Inputs from:

  • Data model → Test data structure
  • Privacy requirements → Anonymization rules
  • test-strategy-planning skill → Data volume needs

Outputs to:

  • Test automation → Data fixtures
  • performance-test-planning skill → Load data
  • Environment provisioning → Seed scripts

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

39.73%
按下载量换算28

Claude

29.61%
按下载量换算21

Cursor

17.49%
按下载量换算12

Gemini CLI

8.64%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills