generate-widget

generate-widget is a command for Claude Code from TheBeardedBearSAS/claude-craft. It costs 7 tokens per session (2,930 once invoked), scanned A, original, MIT.

A Flutter widget generator that creates reusable interface components with documentation, unit tests, and widget tests. Widgets are the building blocks of a Flutter app's screen.

In plain words
What is it for?
Use it to create stateless, stateful, or hook-based widgets such as buttons and user cards, with configurable properties and tap actions.
Why use it?
It saves setup time and provides tests alongside a new component so its behaviour can be checked as it is added.

Command for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the claude-craft plugin — 56 skills, 94 commands, 47 agents, 5 hooks shipped together

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.

agentmods
npx agentmods add commands/thebeardedbearsas/claude-craft/generate-widget
Clone the repo
git clone --depth 1 https://github.com/TheBeardedBearSAS/claude-craft

Made for: Claude Code.

Or install claude-craft, the plugin that ships this one along with the rest of its 56 skills, 94 commands, 47 agents, 5 hooks.

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 generate-widget

README.md
[![agentmods](https://agentmods.dev/badge/commands/thebeardedbearsas/claude-craft/generate-widget.svg)](https://agentmods.dev/commands/thebeardedbearsas/claude-craft/generate-widget)
Your own site
<a href="https://agentmods.dev/commands/thebeardedbearsas/claude-craft/generate-widget"><img src="https://agentmods.dev/badge/commands/thebeardedbearsas/claude-craft/generate-widget.svg" alt="Measured on agentmods" height="20"></a>
Per session 7 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,930 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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.00007 $0.02930
Opus 5 $0.00003 $0.01465
Sonnet 5 $0.00001 $0.00586
Haiku 4.5 $0.00001 $0.00293

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

Security

Grade A, and why

generate-widget 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 2d 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.

.claude/commands/flutter/generate-widget.md · 558 lines

How it starts

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

Génération Widget Flutter avec Tests

Tu es un développeur Flutter senior. Tu dois générer un widget réutilisable avec documentation, tests unitaires et widget tests.

Arguments

$ARGUMENTS

Arguments :

  • Nom du widget (ex: CustomButton, UserCard)
  • (Optionnel) Type (stateless, stateful, hook)

Exemple : /flutter:generate-widget UserCard stateless

MISSION

Étape 1 : Créer le Widget

StatelessWidget
// lib/shared/widgets/{widget_name}.dart
import 'package:flutter/material.dart';

/// Un widget qui affiche {description}.
///
/// Exemple d'utilisation :
/// ```dart
/// {WidgetName}(
///   title: 'Mon titre',
///   onTap: () => print('Tapped'),
/// )
/// ```
class {WidgetName} extends StatelessWidget {
  /// Le titre affiché dans le widget.
  final String title;

  /// Le sous-titre optionnel.
  final String? subtitle;

  /// L'icône affichée à gauche.
  final IconData? leadingIcon;

  /// Callback appelé lors du tap.
  final VoidCallback? onTap;

  /// Indique si le widget est activé.
  final bool isEnabled;

  /// Crée un nouveau [{WidgetName}].
  const {WidgetName}({
    super.key,
    required this.title,
    this.subtitle,
    this.leadingIcon,
    this.onTap,
    this.isEnabled = true,
  });

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);

    return Semantics(
      button: onTap != null,
      enabled: isEnabled,
      child: Material(
        color: Colors.transparent,
        child: InkWell(
          onTap: isEnabled ? onTap : null,
          borderRadius: BorderRadius.circular(12),
          child: Container(
            padding: const EdgeInsets.all(16),
            decoration: BoxDecoration(
              color: theme.cardColor,
              borderRadius: BorderRadius.circular(12),
              boxShadow: [
                BoxShadow(
                  color: Colors.black.withOpacity(0.05),
                  blurRadius: 10,
                  offset: const Offset(0, 2),
                ),
              ],
            ),
            child: Row(
              children: [
                if (leadingIcon != null) ...[
                  Icon(
                    leadingIcon,
                    color: isEnabled
                        ? theme.colorScheme.primary
                        : theme.disabledColor,
                  ),
                  const SizedBox(width: 12),
                ],
                Expanded(
                  child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text(
                        title,
                        style: theme.textTheme.titleMedium?.copyWith(
                          color: isEnabled ? null : theme.disabledColor,
                        ),
                      ),
                      if (subtitle != null) ...[
                        const SizedBox(height: 4),
                        Text(
                          subtitle!,
                          style: theme.textTheme.bodySmall?.copyWith(
                            color: theme.textTheme.bodySmall?.color
                                ?.withOpacity(0.7),
                          ),
                        ),
                      ],
                    ],
                  ),
                ),
                if (onTap != null)
                  Icon(
                    Icons.chevron_right,
                    color: isEnabled
                        ? theme.colorScheme.onSurface.withOpacity(0.5)
                        : theme.disabledColor,
                  ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Read the full file on GitHub · 558 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. 2d ago First seen · 558 lines · 7 tokens per session scan A 7f334ddb2e84

Subscribe to this mod's changes

generate-widget is a command published in the GitHub repository TheBeardedBearSAS/claude-craft (105 stars, last pushed 3d ago), licensed MIT. It adds 7 tokens to every session and 2,930 once invoked, about $0.0000 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-09-03.