{"id":"d1b72bce-9449-432c-a25c-575957497c5a","shortId":"gVfkvB","kind":"skill","title":"required-argument-aware-flag-validation","tagline":"Walk command tokens while inspecting attached/inline arguments so validators never skip missing or dangerous flag values.","description":"# SKILL: Required Argument Aware Flag Validation\n**Domain:** validator\n**Trigger:** Apply this whenever flag validation cannot rely on shell parsers and must check `--flag=value`, combined short bundles, and missing arguments explicitly.\n**Source Pattern:** Distilled from reviewed tool execution, streaming, persistence, and output-budget implementations.\n\n## Core Method\nIterate over tokens after the command verb, treat `--` according to whether the tool respects it, then inspect each `-flag`/`--flag` by looking it up in the declarative config. Handle inline values (`-E=`), attached numeric args (`-A20`), and bundles of non-arg flags carefully: reject unknown flags, ensure required arguments exist, and forbid bundles that include arg-taking options. Use typed helpers (validate flag argument) to keep regex/number checks centralized.\n\n## Key Rules\n- Never assume an inline assignment contains a value; `--flag=` must be validated as empty input, not allowed to silently consume the next token.\n- For launcher commands such as `xargs`, stop validating wrapper flags once parsing has switched to the downstream command.\n- Reject combined short flags if any member expects an argument; allow only `none`-type flags in bundles to avoid parser differentials.\n- Guard string arguments from starting with `-` unless the flag explicitly allows it (e.g., `git --sort -version:refname`).\n\n## Example Application\nImplement this in a shell command policy layer by validating the tokenized command against declarative flag metadata before execution. That ensures commands containing `-S`, `--diff-filter`, or `--flag=value` cannot bypass read-only guardrails through parser edge cases.\n\n## Anti-Patterns (What NOT to do)\n- Do not treat `-FLAG=value` the same as `-FLAG value`; the attached format still needs its own validation rules.\n- Do not skip the empty-inline-value check for `-FLAG=`; otherwise attackers can bypass restrictions by hiding invalid input behind `=`.","tags":["required","argument","aware","flag","validation","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents"],"capabilities":["skill","source-ychampion","skill-required-argument-aware-flag-validation","topic-agent-skills","topic-ai-agents","topic-cli","topic-coding-agents","topic-context-engineering","topic-developer-tools","topic-mcp","topic-multi-agent","topic-terminal-ui"],"categories":["cskill-agents"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/ychampion/cskill-agents/required-argument-aware-flag-validation","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add ychampion/cskill-agents","source_repo":"https://github.com/ychampion/cskill-agents","install_from":"skills.sh"}},"qualityScore":"0.467","qualityRationale":"deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 34 github stars · SKILL.md body (1,967 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T00:56:55.392Z","embedding":null,"createdAt":"2026-04-18T22:21:09.442Z","updatedAt":"2026-04-22T00:56:55.392Z","lastSeenAt":"2026-04-22T00:56:55.392Z","tsv":"'a20':105 'accord':78 'allow':159,194,215 'anti':265 'anti-pattern':264 'appli':32 'applic':223 'arg':104,111,127 'arg-tak':126 'argument':3,13,25,52,119,135,193,207 'assign':147 'assum':144 'attach':102,282 'attached/inline':12 'attack':302 'avoid':202 'awar':4,26 'behind':310 'budget':66 'bundl':49,107,123,200 'bypass':255,304 'cannot':37,254 'care':113 'case':263 'central':140 'check':44,139,298 'combin':47,185 'command':8,75,168,183,229,236,245 'config':97 'consum':162 'contain':148,246 'core':68 'danger':20 'declar':96,238 'diff':249 'diff-filt':248 'differenti':204 'distil':56 'domain':29 'downstream':182 'e':101 'e.g':217 'edg':262 'empti':156,295 'empty-inline-valu':294 'ensur':117,244 'exampl':222 'execut':60,242 'exist':120 'expect':191 'explicit':53,214 'filter':250 'flag':5,21,27,35,45,88,89,112,116,134,151,175,187,198,213,239,252,274,279,300 'forbid':122 'format':283 'git':218 'guard':205 'guardrail':259 'handl':98 'helper':132 'hide':307 'implement':67,224 'includ':125 'inlin':99,146,296 'input':157,309 'inspect':11,86 'invalid':308 'iter':70 'keep':137 'key':141 'launcher':167 'layer':231 'look':91 'member':190 'metadata':240 'method':69 'miss':18,51 'must':43,152 'need':285 'never':16,143 'next':164 'non':110 'non-arg':109 'none':196 'numer':103 'option':129 'otherwis':301 'output':65 'output-budget':64 'pars':177 'parser':41,203,261 'pattern':55,266 'persist':62 'polici':230 'read':257 'read-on':256 'refnam':221 'regex/number':138 'reject':114,184 'reli':38 'requir':2,24,118 'required-argument-aware-flag-valid':1 'respect':83 'restrict':305 'review':58 'rule':142,289 'shell':40,228 'short':48,186 'silent':161 'skill':23 'skill-required-argument-aware-flag-validation' 'skip':17,292 'sort':219 'sourc':54 'source-ychampion' 'start':209 'still':284 'stop':172 'stream':61 'string':206 'switch':179 'take':128 'token':9,72,165,235 'tool':59,82 'topic-agent-skills' 'topic-ai-agents' 'topic-cli' 'topic-coding-agents' 'topic-context-engineering' 'topic-developer-tools' 'topic-mcp' 'topic-multi-agent' 'topic-terminal-ui' 'treat':77,273 'trigger':31 'type':131,197 'unknown':115 'unless':211 'use':130 'valid':6,15,28,30,36,133,154,173,233,288 'valu':22,46,100,150,253,275,280,297 'verb':76 'version':220 'walk':7 'whenev':34 'whether':80 'wrapper':174 'xarg':171","prices":[{"id":"1ac55cb7-7a24-441d-b26a-c70c7c054ee7","listingId":"d1b72bce-9449-432c-a25c-575957497c5a","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"ychampion","category":"cskill-agents","install_from":"skills.sh"},"createdAt":"2026-04-18T22:21:09.442Z"}],"sources":[{"listingId":"d1b72bce-9449-432c-a25c-575957497c5a","source":"github","sourceId":"ychampion/cskill-agents/required-argument-aware-flag-validation","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/required-argument-aware-flag-validation","isPrimary":false,"firstSeenAt":"2026-04-18T22:21:09.442Z","lastSeenAt":"2026-04-22T00:56:55.392Z"}],"details":{"listingId":"d1b72bce-9449-432c-a25c-575957497c5a","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"required-argument-aware-flag-validation","github":{"repo":"ychampion/cskill-agents","stars":34,"topics":["agent-skills","ai-agents","cli","coding-agents","context-engineering","developer-tools","mcp","multi-agent","terminal-ui"],"license":"mit","html_url":"https://github.com/ychampion/cskill-agents","pushed_at":"2026-04-04T14:13:23Z","description":"Agent skills for coding CLIs, multi-agent runtimes, context engines, MCP extensions, and terminal tooling. Instead of using claude code's source code, give your agent skills to create your own!","skill_md_sha":"f8f2c4b9c55918c84a63807728a2da727f24ca11","skill_md_path":"skills/required-argument-aware-flag-validation/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/required-argument-aware-flag-validation"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"required-argument-aware-flag-validation","description":"Walk command tokens while inspecting attached/inline arguments so validators never skip missing or dangerous flag values."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/required-argument-aware-flag-validation"},"updatedAt":"2026-04-22T00:56:55.392Z"}}