ishwormali/habbitpoint/testing

Claude Code and agent skill by ishwormali/habbitpoint

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Writes and reviews Flutter/Dart tests. Use when writing unit tests, widget tests, or reviewing existing tests for correctness, structure, and naming conventions.

Install

npx vskill@latest install ishwormali/habbitpoint/testing

SKILL.md

The same SKILL.md was published earlier as ishwormali/habbitpoint/testing.

Testing Skill

This skill defines how to write effective, meaningful Flutter and Dart tests.


1. Test Validity

Before writing or accepting a test, ask:

"Can this test actually fail if the real code is broken?"
  • Avoid tests that only confirm mocked/fake behavior that doesn't reflect real logic.
  • Avoid tests that confirm behavior guaranteed by the language, the standard library, or trivially obvious code that cannot fail unless the environment is broken.
  • Every test should be capable of catching a real regression.

2. Structure

Always use group() in test files — even when there is only one test. Name the group after the class under test:

dart
group('Counter', () {
test('value should start at 0', () {
final counter = Counter();
expect(counter.value, 0);
});
});

3. Naming

Name test cases using "should" to clearly describe the expected behavior:

dart
test('should emit updated list when item is added', () { ... });
test('should throw ArgumentError when input is negative', () { ... });

4. HabbitPoint Testing Examples

Model Testing: SkillItem
dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:habbitpoint/app/models/habit_models.dart';
import 'package:habbitpoint/app/theme/app_colors.dart';
group('SkillItem', () {
test('should calculate progress correctly', () {
const skill = SkillItem(
id: 'fitness',
name: 'Fitness',
level: 8,
currentXp: 240,
nextLevelXp: 300,
colors: [AppColors.orange, AppColors.red],
icon: Icons.fitness_center_rounded,
);
expect(skill.progress, 0.8);
});
test('should create new instance with copyWith', () {
const skill = SkillItem(
id: 'fitness',
name: 'Fitness',
level: 8,
currentXp: 240,
nextLevelXp: 300,
colors: [AppColors.orange, AppColors.red],
icon: Icons.fitness_center_rounded,
);
final updated = skill.copyWith(currentXp: 250);
expect(updated.currentXp, 250);
expect(updated.level, 8); // Unchanged
expect(skill.currentXp, 240); // Original unchanged
});
});
Provider Testing: activityLogsProvider
dart
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:habbitpoint/app/models/habit_models.dart';
import 'package:habbitpoint/app/riverpod/activity_logs_provider.dart';
group('activityLogsProvider', () {
test('should start with empty list', () {
final container = ProviderContainer();
expect(container.read(activityLogsProvider), isEmpty);
});
test('should add log to state', () {
final container = ProviderContainer();
final notifier = container.read(activityLogsProvider.notifier);
final log = ActivityLog(
id: '1',
label: 'Morning Run',
emoji: '🏃',
durationMinutes: 30,
moodLabel: 'Energized',
moodEmoji: '⚡',
xp: 10,
recordedAt: DateTime.now(),
colors: [Colors.orange],
);
notifier.addLog(log);
expect(container.read(activityLogsProvider), [log]);
});
test('should remove log by id', () {
final log1 = ActivityLog(
id: '1',
label: 'Morning Run',
emoji: '🏃',
durationMinutes: 30,
moodLabel: 'Good',
moodEmoji: '😊',
xp: 10,
recordedAt: DateTime.now(),
colors: [Colors.orange],
);
final log2 = ActivityLog(
id: '2',
label: 'Evening Study',
emoji: '📚',
durationMinutes: 60,
moodLabel: 'Focused',
moodEmoji: '🧠',
xp: 15,
recordedAt: DateTime.now(),
colors: [Colors.purple],
);
final container = ProviderContainer(
overrides: [
activityLogsProvider.overrideWithValue([log1, log2]),
],
);
container.read(activityLogsProvider.notifier).removeLog('1');
expect(container.read(activityLogsProvider), [log2]);
});
});
Widget Test: HomeScreen with Riverpod
dart
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:habbitpoint/app/models/habit_models.dart';
import 'package:habbitpoint/app/riverpod/tasks_provider.dart';
import 'package:habbitpoint/app/riverpod/skills_provider.dart';
import 'package:habbitpoint/app/screens/home_screen.dart';
import 'package:habbitpoint/app/theme/app_theme.dart';
group('HomeScreen', () {
testWidgets('should display quick actions from provider', (tester) async {
final mockTasks = [
const TaskItem(
id: '1',
title: 'It\'s your usual workout time',
xp: 5,
emoji: '🏃',
),
const TaskItem(
id: '2',
title: 'Quick 10-min stretch?',
xp: 1,
emoji: '🧘',
),
];
await tester.pumpWidget(
ProviderScope(
overrides: [
tasksProvider.overrideWithValue(mockTasks),
skillsProvider.overrideWithValue(const []),
],
child: MaterialApp(
theme: buildAppTheme(),
home: const HomeScreen(),
),
),
);
expect(find.text('It\'s your usual workout time'), findsOneWidget);
expect(find.text('Quick 10-min stretch?'), findsOneWidget);
});
testWidgets('should handle empty tasks gracefully', (tester) async {
await tester.pumpWidget(
ProviderScope(
overrides: [
tasksProvider.overrideWithValue(const []),
skillsProvider.overrideWithValue(const []),
],
child: MaterialApp(
theme: buildAppTheme(),
home: const HomeScreen(),
),
),
);
// Should render without crashing
expect(find.byType(HomeScreen), findsOneWidget);
});
});
Integration Test: Log Activity and See Updated Insights
dart
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:habbitpoint/app/models/habit_models.dart';
import 'package:habbitpoint/app/riverpod/activity_logs_provider.dart';
import 'package:habbitpoint/app/riverpod/insights_provider.dart';
import 'package:habbitpoint/app/screens/home_screen.dart';
import 'package:habbitpoint/app/theme/app_theme.dart';
group('Activity Logging Integration', () {
testWidgets('should update insights when activity is logged', (tester) async {
final container = ProviderContainer();
// Verify initial state (no activities, warning insight)
expect(container.read(activityLogsProvider), isEmpty);
final initialInsights = container.read(insightsProvider);
expect(
initialInsights.any((i) => i.type == InsightType.warning),
true,
);
// Log an activity
container.read(activityLogsProvider.notifier).addLog(
ActivityLog(
id: '1',
label: 'Morning Run',
emoji: '🏃',
durationMinutes: 30,
moodLabel: 'Energized',
moodEmoji: '⚡',
xp: 10,
recordedAt: DateTime.now(),
colors: [Colors.orange],
),
);
// Verify insights changed to positive
final updatedInsights = container.read(insightsProvider);
expect(
updatedInsights.any((i) => i.type == InsightType.positive),
true,
);
});
});

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ishwormali/habbitpoint/testing/badge)](https://verified-skill.com/skills/ishwormali/habbitpoint/testing)

Something wrong with this skill or its page? Tell us.