flutter-testing

flutter-testing is a skill for Claude Code, Codex from lh17708357536-gif/flutter-cn-overseas-app-skills. It costs 114 tokens per session (4,408 once invoked), scanned A, original, MIT.

A testing guide for Flutter mobile apps and NestJS backends used across multiple regions. It covers unit tests, screen tests, end-to-end tests, regional build variants called flavors, and rules for testing payments, tenants, and external services with test doubles.

In plain words
What is it for?
It is for planning and writing Flutter and NestJS tests, checking China and overseas flavors, testing multi-tenant behavior and refunds, and setting coverage requirements in CI.
Why use it?
It gives teams a shared testing baseline and helps prevent regional differences, business rules, and important error cases from being missed. It also ties tests to CI, the automated checks run before code is accepted.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: reads .claude/ paths.

Good fit It is for planning and writing Flutter and NestJS tests, checking China and overseas flavors, testing multi-tenant behavior and refunds, and setting coverage requirements in CI.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/lh17708357536-gif/flutter-cn-overseas-app-skills/flutter-testing
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add lh17708357536-gif/flutter-cn-overseas-app-skills --skill flutter-testing
Clone the repo
git clone --depth 1 https://github.com/lh17708357536-gif/flutter-cn-overseas-app-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for flutter-testing

README.md
[![agentmods](https://agentmods.dev/badge/skills/lh17708357536-gif/flutter-cn-overseas-app-skills/flutter-testing/github.svg)](https://agentmods.dev/skills/lh17708357536-gif/flutter-cn-overseas-app-skills/flutter-testing)
Your own site
<a href="https://agentmods.dev/skills/lh17708357536-gif/flutter-cn-overseas-app-skills/flutter-testing"><img src="https://agentmods.dev/badge/skills/lh17708357536-gif/flutter-cn-overseas-app-skills/flutter-testing/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for flutter-testing

Your own site · 80×15
<a href="https://agentmods.dev/skills/lh17708357536-gif/flutter-cn-overseas-app-skills/flutter-testing"><img src="https://agentmods.dev/badge/skills/lh17708357536-gif/flutter-cn-overseas-app-skills/flutter-testing.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 114 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,408 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00114 $0.04408
Opus 5 $0.00057 $0.02204
Sonnet 5 $0.00023 $0.00882
Haiku 4.5 $0.00011 $0.00441

Measured 12d ago against content hash 06ab7559e5c4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

flutter-testing scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/flutter-testing/SKILL.md · 379 lines

How it starts

The opening of the file, as written. The whole thing — 379 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Flutter + NestJS 测试规范 Skill

适用于多区域 Flutter + NestJS 项目的测试基线。所有 <PLACEHOLDER> 替换为项目实际值。

本 skill 与 CI 强绑定:测试写完必须进 CI 门禁才有意义,CI 矩阵见 ~/.claude/skills/ci-cd-github-actions/SKILL.md。多区域项目最易漏测的就是 flavor 条件编译(第 6 节),必看。

1. 测试金字塔与原则

        ╱╲   e2e(少)—— 后端 supertest 打真实 HTTP + 测试库;关键业务链路
       ╱──╲
      ╱widget╲  widget(中)—— 页面渲染 / 交互 / 空态 / 加载态
     ╱────────╲
    ╱   unit    ╲ unit(多)—— Notifier 业务逻辑 / util / Service 纯逻辑
   ╱────────────╲

该测 / 不该测

  • 必测:业务规则(积分扣费/退款、多租户 where 过滤、切租户重置、语言归一)、flavor 工厂选择、错误分支(余额不足、越权、race 守卫)、数据映射(Freezed ↔ JSON)
  • 建议测:关键 widget 的空态 CTA、加载骨架、向导 exit guard、i18n key 不缺失
  • 不必测:纯 UI 布局像素(golden 覆盖即可)、第三方 SDK 内部、Freezed/json_serializable 生成代码、getter/setter
  • 禁止:为了覆盖率写无断言的假测试;测试里连真实生产后端 / 真实第三方 AI(用 mock)

2. Flutter 依赖与目录

pubspec.yaml dev_dependencies

dev_dependencies:
  flutter_test:
    sdk: flutter
  mocktail: ^1.0.0          # mock(不需要 codegen,优于 mockito)
  golden_toolkit: ^0.15.0   # golden(可选)
  network_image_mock: ^2.1.1 # widget 测试里拦截 CachedNetworkImage

目录(与 lib/ 镜像):

test/
├── unit/
│   ├── providers/        # Notifier / Provider 业务逻辑
│   ├── services/         # API service(mock Dio)
│   ├── utils/            # normalizeBusinessLanguageCode / date / locale
│   └── config/           # ★ flavor 工厂选择(第 6 节)
├── widget/               # 页面 / 组件渲染与交互
├── golden/               # golden 基准图
└── helpers/
    ├── pump_app.dart     # 统一 pumpWidget(注入 ProviderScope + l10n + theme)
    └── mocks.dart        # 共享 mock 类

3. Notifier / Provider 单元测试(ProviderContainer + override)

核心模式:用 ProviderContainer + overrideWith 注入 mock 依赖,直接驱动 Notifier,不启 UI。

// test/unit/providers/credits_provider_test.dart
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mocktail/mocktail.dart';

class MockCreditsApi extends Mock implements CreditsApiService {}

void main() {
  late MockCreditsApi api;

  setUp(() => api = MockCreditsApi());

  ProviderContainer makeContainer() => ProviderContainer(
        overrides: [creditsApiProvider.overrideWithValue(api)],
      );

  test('扣费成功后余额减少', () async {
    when(() => api.consume(any(), any(), any()))
        .thenAnswer((_) async => ConsumeResult(balance: 80));
    final c = makeContainer();
    addTearDown(c.dispose);

    await c.read(creditsProvider.notifier).consume('A1', 'generate', 20);

    expect(c.read(creditsProvider).balance, 80);
  });

  test('★ AI 调用失败必须触发退款(refundWithRetry)', () async {
    when(() => api.consume(any(), any(), any()))
        .thenAnswer((_) async => ConsumeResult(balance: 80));
    when(() => api.callAI(any())).thenThrow(Exception('upstream 500'));
    when(() => api.refundWithRetry(any(), any(), maxRetry: any(named: 'maxRetry')))
        .thenAnswer((_) async {});
    final c = makeContainer();
    addTearDown(c.dispose);

    await expectLater(
      c.read(someToolProvider.notifier).generate(),
      throwsA(isA<Exception>()),
    );
    // ★ 断言退款一定被调用一次(对应 _shared/rules.md §1 双保险)
    verify(() => api.refundWithRetry(20, any(), maxRetry: 3)).called(1);
  });
}

Read the full file on GitHub · 379 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 379 lines · 114 tokens per session scan A 06ab7559e5c4

Subscribe to this mod's changes

flutter-testing is a skill published in the GitHub repository lh17708357536-gif/flutter-cn-overseas-app-skills (20 stars, last pushed 2mo ago), licensed MIT. It adds 114 tokens to every session and 4,408 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.