Skip to content

feat(generator): upgrade to Gemini 4 Argon and align with Agent Skills standard - #267

Merged
jwren merged 2 commits into
flutter:mainfrom
jwren:gemini-4-configs
Nov 18, 2026
Merged

jwren merged 2 commits into
flutter:mainfrom
jwren:gemini-4-configs

Conversation

@jwren

@jwren jwren commented Nov 17, 2026

Copy link
Copy Markdown
Member
  • Set default model to models/gemini-4-argon with 65,536 max output token limit
  • Omit sampling temperature for Gemini 4 models per Google migration guidance
  • Add --model CLI option to override the Gemini model across all commands
  • Align documentation and prompt guidelines with the official agentskills.io standard
  • Enforce progressive disclosure size guidelines (< 500 lines, < 5,000 tokens)
  • Add static validation warnings for skills exceeding 500 lines or 1,024-character descriptions
  • Fix dry-run token metric calculations to report words and approximate tokens
  • Deduplicate guidelines in skill instructions and remove obsolete
    Details tag advice
  • Add unit tests for Gemini 4 request payloads and validation warnings (108 passing tests)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the skill generator tool to support the Gemini 4 Argon model as the default, introducing a --model command-line option and adjusting generation parameters such as omitting temperature for Gemini 4 models. It also adds validation warnings for SKILL.md files exceeding 500 lines or descriptions exceeding 1024 characters to align with the agentskills.io standard. The review feedback recommends optimizing the word-counting logic in the dry-run and validation commands by using RegExp.allMatches instead of splitting strings, which avoids unnecessary memory allocations for intermediate lists.

Comment on lines +58 to +61
final words = combinedMarkdown
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using split(RegExp(r'\s+')) on a potentially large string creates an intermediate list of all words in memory, which can be inefficient. A more memory-efficient and elegant way to count words in Dart is to use RegExp(r'\S+').allMatches(text).length which avoids list allocation entirely.

Suggested change
final words = combinedMarkdown
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final words = RegExp(r'\S+').allMatches(combinedMarkdown).length;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated word counting in GenerateSkillCommand to use RegExp(r'\S+').allMatches(combinedMarkdown).length and added dry-run word/token count assertions in 3e9f86d.

(AI assisted -- human reviewed -- jwren)

Comment on lines +69 to +78
final origWords = existingContent
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final origTokens = (origWords * 1.3).round();
final rawWords = combinedMarkdown
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final rawTokens = (rawWords * 1.3).round();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using split(RegExp(r'\s+')) on potentially large strings creates intermediate lists of all words in memory, which can be inefficient. A more memory-efficient and elegant way to count words in Dart is to use RegExp(r'\S+').allMatches(text).length which avoids list allocation entirely.

Suggested change
final origWords = existingContent
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final origTokens = (origWords * 1.3).round();
final rawWords = combinedMarkdown
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final rawTokens = (rawWords * 1.3).round();
final origWords = RegExp(r'\S+').allMatches(existingContent).length;\n final origTokens = (origWords * 1.3).round();\n final rawWords = RegExp(r'\S+').allMatches(combinedMarkdown).length;\n final rawTokens = (rawWords * 1.3).round();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated origWords and rawWords in UpdateSkillCommand to use RegExp(r'\S+').allMatches(...).length and verified dry-run size logging in 3e9f86d.

(AI assisted -- human reviewed -- jwren)

Comment on lines +256 to +265
final existWords = existingSkillFileContent
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final existTokens = (existWords * 1.3).round();
final rawWords = markdown
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final rawTokens = (rawWords * 1.3).round();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using split(RegExp(r'\s+')) on potentially large strings creates intermediate lists of all words in memory, which can be inefficient. A more memory-efficient and elegant way to count words in Dart is to use RegExp(r'\S+').allMatches(text).length which avoids list allocation entirely.

Suggested change
final existWords = existingSkillFileContent
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final existTokens = (existWords * 1.3).round();
final rawWords = markdown
.split(RegExp(r'\s+'))
.where((s) => s.isNotEmpty)
.length;
final rawTokens = (rawWords * 1.3).round();
final existWords = RegExp(r'\S+').allMatches(existingSkillFileContent).length;\n final existTokens = (existWords * 1.3).round();\n final rawWords = RegExp(r'\S+').allMatches(markdown).length;\n final rawTokens = (rawWords * 1.3).round();

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated existWords and rawWords in ValidateSkillCommand to use RegExp(r'\S+').allMatches(...).length and verified dry-run size logging in 3e9f86d.

(AI assisted -- human reviewed -- jwren)

…s standard

- Set default model to `models/gemini-4-argon` with 65,536 max output token limit
- Omit sampling temperature for Gemini 4 models per Google migration guidance
- Add `--model` CLI option to override the Gemini model across all commands
- Align documentation and prompt guidelines with the official agentskills.io standard
- Enforce progressive disclosure size guidelines (< 500 lines, < 5,000 tokens)
- Add static validation warnings for skills exceeding 500 lines or 1,024-character descriptions
- Fix dry-run token metric calculations to report words and approximate tokens
- Deduplicate guidelines in skill instructions and remove obsolete <details> tag advice
- Add unit tests for Gemini 4 request payloads and validation warnings (108 passing tests)
Count words in GenerateSkillCommand, UpdateSkillCommand, and
ValidateSkillCommand dry-run output via RegExp(r'\S+').allMatches(...)
to avoid intermediate list allocations from String.split, and add
dry-run word/token count assertions in unit tests.

Part of: flutter#267
Tested: dart format, dart analyze, dart test (108 passed)
@jwren
jwren requested a review from johnpryan November 18, 2026 18:23
@jwren
jwren merged commit ff6d472 into flutter:main Nov 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants