Repository navigation
feat(generator): upgrade to Gemini 4 Argon and align with Agent Skills standard - #267
Conversation
There was a problem hiding this comment.
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.
| final words = combinedMarkdown | ||
| .split(RegExp(r'\s+')) | ||
| .where((s) => s.isNotEmpty) | ||
| .length; |
There was a problem hiding this comment.
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.
| final words = combinedMarkdown | |
| .split(RegExp(r'\s+')) | |
| .where((s) => s.isNotEmpty) | |
| .length; | |
| final words = RegExp(r'\S+').allMatches(combinedMarkdown).length; |
| 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(); |
There was a problem hiding this comment.
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.
| 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(); |
| 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(); |
There was a problem hiding this comment.
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.
| 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(); |
…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)
cce0b99 to
fe312e5
Compare
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)
models/gemini-4-argonwith 65,536 max output token limit--modelCLI option to override the Gemini model across all commandsDetails
tag advice