Skip to content

Fix documented examples that name missing commands or flags, and test them - #41

Open
edumansky wants to merge 4 commits into
mainfrom
skill-example-check
Open

edumansky wants to merge 4 commits into
mainfrom
skill-example-check

Conversation

@edumansky

@edumansky edumansky commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Why

The handwritten examples in the skills, the README and the site pages had fallen behind the commands. Collection refreshes renamed commands and flags, and nothing checked the examples. An agent that ran them as written got unknown command or unknown flag. For example, the cc skill said dial-number has no create, update or delete, and listed dial-number list and get, which don't exist.

What changes

A new test, skill_examples_test.go. It checks every webex line in a code block of each skill file, the README and each site page. The command must exist, and every flag on the line must be one that command takes: its own flags, inherited flags, or --help. Flags on continuation lines count too. It also checks every row of a skill's | group | command, … | table. It skips lines with placeholders such as webex cc <resource> list and the generated Command Reference. Before the fixes it reported 61 problems in the skills alone.

Fixed examples:

  • cc:
    • dial-number now lists its real commands, including create-dialed-mapping, update-dialed-mapping-id and delete-dialed-mapping-id.
    • users get-ci-id takes --id.
    • The address-book and outdial-ani entry commands now pass the parent ID (--address-book-id, --out-dial-ani-id).
    • The flow gotcha no longer says flows have only four commands.
    • A new "Custom functions" section in the cc skill and site page explains two things. functions get returns the code as fnCode, but create and update read only sourceCode, and an update body copied from get fails with a wrapper-code error. functions test takes {"inputs": {...}} and publishes the latest draft first.
    • A new "Dynamic skills" section gives a body that works for users bulk-update-dynamic-skills. The collection's example lists every field of a skill record with no descriptions, and Webex returns a bare 500 when itemIdentifier is missing or the value field has the wrong name.
  • calling:
    • call-queue … -cxe is now … -customer-assist. Cisco's collection reads call queues only through those routes.
    • Call forwarding is now user-call get-forwarding-settings-person and update-forward-person, and call-settings-for-me get-my-forward and update-my-forward.
  • device:
    • xapi execute-command has no --device-id flag; the device ID and the command's arguments go in the body ({"deviceId": …, "arguments": {…}}).
    • The workspace-locations commands take --location-id.
    • The table rows for workspace-metrics and workspace-personalization are corrected.
  • meetings:
    • participants get-meeting and update take only --participant-id.
    • Invitee commands take --meeting-invitee-id.
    • summaries delete takes --summary-id.
    • The Q&A command is meeting-qa list-q.
    • transcripts list-meeting-compliance-officer has no --host-email.
  • messaging:
    • team-memberships takes --membership-id.
    • attachment-actions get takes --id.
    • The ecm-folder-linking table row is corrected.
  • admin:
    • hybrid-clusters get takes --hybrid-cluster-id.
    • hybrid-connectors list has no filter flag.
    • Authorizations are listed per user (authorizations list-user).
    • service-apps has only create-access-token.
  • README and site pages: the same renames, plus admin groups list-search, admin admin-audit list-events and calling reports-detailed-call-history get.

AGENTS.md mentions the test under Documentation checks.

Checks

  • go vet ./... and go test -p 1 -timeout 300s ./... pass.
  • python3 -m unittest discover -s codegen -p 'test_*.py': 91 tests pass.
  • make codegen leaves every file unchanged, so the generated Command Reference blocks are untouched.
  • npm run build in site/ passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JAtGHcFAKjQdB6dwDKd8mW


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

edumansky and others added 2 commits November 18, 2026 16:50
… them

Collection refreshes renamed commands and flags under the handwritten
examples in the skills, README and site pages, so agents following them got
"unknown command" or "unknown flag". The examples now use the current names,
and a test checks every `webex` example in a code block, and every row of a
skill's command table, against the command tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAtGHcFAKjQdB6dwDKd8mW
The table check read each skill by the wrong key, so it checked no rows.
Examples now also count when webex follows a shell operator or nohup, or
global flags, and a placeholder after a command is an argument. Flags
are checked by their whole name, shorthands included. A self-test feeds
the checker each kind of stale example.

Customer Assist queue examples show --has-cx-essentials true, which
selects that tier. Contact Center bulk bodies are an object with items,
not an array. The call-history example explains its time window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAtGHcFAKjQdB6dwDKd8mW

@edumansky edumansky left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Codex review (gpt-6.2-astra, reasoning effort: high)

The new test passes, but it never checks any skill command table and skips several existing example forms. Some corrected examples also still send an invalid request or operate on a different queue tier than their names suggest.

Comment thread skill_examples_test.go Outdated
if !ok || file != "SKILL.md" {
continue
}
for _, row := range commandTableRows(string(files[name])) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] Read command tables using the skill-relative file key

skill.Files() keys entries as admin/SKILL.md, but name here is skill/admin/SKILL.md. The lookup therefore returns nil for every area, and commandTableRows always receives an empty string. A collection refresh can remove a command from any skill table without failing the test promised by AGENTS.md:127. Read docs[name], which already holds the content under the prefixed key.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, fixed in 6bb97c3. The table check now reads the document content it already has (documentProblems(root, name, content)), so every area skill's table rows are checked; they all pass. Regression test: the "table row" case in TestDocumentCheckFindsStaleExamples.

Comment thread skill/calling/SKILL.md
Comment on lines +103 to +104
webex calling call-queue get-customer-assist --location-id <id> --queue-id <id>
webex calling call-queue create-customer-assist --location-id <id> --body '{...}'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] Distinguish Basic and Customer Assist queue operations

The -customer-assist command name does not select the license tier. CallingPostTelephonyConfigLocationsByLocationIdQueues creates a Customer Assist queue only with --has-cx-essentials true; copying the example with a valid body can create a Basic queue instead. The same selector is required to read an Assist queue and modify an Assist supervisor, and omitting it from the list returns Basic queues rather than both tiers. Label the default examples as Basic and show the flag for the Assist operations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, fixed in 6bb97c3. The section now says the -customer-assist commands serve both tiers and that --has-cx-essentials true selects Customer Assist. It shows Basic and Customer Assist get/create examples, and the flag on both supervisor commands. The site example says the default list is Basic.

Comment thread skill/cc/SKILL.md Outdated
webex cc dial-number delete-dialed-mapping-id --id <id>
webex cc dial-number list-references-dialed-mapping --id <id>
webex cc dial-number bulk-export-dialed-mapping
webex cc dial-number bulk-save-dialed-mapping --body '[{...}]'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] Wrap dial-number bulk-save items in the request object

The committed Contact Center collection defines Bulk save Dialed Number Mapping(s) with a top-level items property; each entry contains itemIdentifier, requestAction, and item. The CLI forwards --body unchanged, so replacing the ellipsis with valid mapping data still sends an array where the API expects an object. Show the envelope in the example.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, fixed in 6bb97c3, and not only here. Every Contact Center bulk body in the skill was written as an array: site bulk-save, the generic <resource> bulk-save, dial-number bulk-save-dialed-mapping, address-book bulk-save-entry and users bulk-partial-update. They now show {"items":[{"itemIdentifier":1,"requestAction":"SAVE","item":{...}}]}, matching each operation's collection example, with one sentence explaining the envelope.

Comment thread site/src/content/docs/calling.mdx Outdated

# Get detailed call history
webex calling reports-detailed-call-history list --start-time "2024-01-01T00:00:00Z"
webex calling reports-detailed-call-history get --start-time "2024-01-01T00:00:00Z" --end-time "2024-01-01T12:00:00Z"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] Use a supported time window for the call-history example

CallingGetCdrFeed requires a start time between 5 minutes and 48 hours ago and specifies UTC timestamps with milliseconds. The fixed January 2024 range is outside that window, so the corrected command still cannot retrieve the history shown. Use recent timestamps or named placeholders that explain the window and format.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, fixed in 6bb97c3. The example now uses START_TIME and END_TIME placeholders, with a comment giving the window (start between 5 minutes and 48 hours ago) and the format (UTC with milliseconds). I checked a request in that form live, read-only, and it returns items.

Comment thread skill_examples_test.go
Comment on lines +133 to +139
for len(args) > 0 && commandWord.MatchString(args[0]) {
ex.words, args = append(ex.words, args[0]), args[1:]
}
// "webex <area> <resource> --help" stands for many commands.
if len(ex.words) == 0 || len(args) > 0 && strings.HasPrefix(args[0], "<") {
last = nil
continue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] Validate commands with leading flags or positional placeholders

The skip intended for generic paths also drops concrete invocations. For example, webex --token "$WEBEX_TOKEN" calling people list in the quick start has no initial command words, while webex auth switch <email> in README has a placeholder after a complete command. Neither the command nor its flags are checked if either example goes stale. Resolve leading global flags and distinguish a placeholder argument from a placeholder command to preserve the coverage specified in AGENTS.md:127.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, fixed in 6bb97c3. Leading global flags are skipped, along with the value of a flag that takes one, before the command words are read. A placeholder after the words is skipped only when the words name a group (webex cc <resource> list); after a command (webex auth switch <email>) it is an argument, and the flags are still checked. Regression tests: the "leading global flag" and "argument placeholder" cases in TestDocumentCheckFindsStaleExamples.

Comment thread skill_examples_test.go
Comment on lines +128 to +131
tokens := shellWords(line)
switch {
case len(tokens) > 0 && tokens[0] == "webex":
ex := skillExample{line: i + 1, text: line}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P2] Check the Webex invocations embedded in setup shell commands

Requiring webex to be the first token skips both CLI invocations in skill/SETUP.md: mkdir … && webex post-install -y and nohup webex login --device --output json …. Including skill.Setup in the document map therefore does not protect either onboarding step against a rename. Recognize these shell command positions and validate the CLI arguments, as required by AGENTS.md:127.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, fixed in 6bb97c3. webex now counts as a command after a shell operator (&&, ||, ;, |, &) or after nohup, sudo or exec. Its words stop at the next operator or redirection, so both setup steps in SETUP.md are checked. Regression tests: the "after &&" and "after nohup" cases.

Comment thread skill_examples_test.go
Comment on lines +155 to +159
for _, tok := range tokens {
// "[--flag <value>]" marks an optional flag.
if m := flagName.FindStringSubmatch(strings.TrimLeft(tok, "[")); m != nil {
flags = append(flags, m[1])
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[P3] Validate whole flag names and Cobra shorthands

The flag matcher accepts a valid prefix rather than the flag actually passed: --max_results in a people-list example is checked as --max, although Cobra rejects the former. Single-dash flags such as the setup skill's -y are never collected either. Strip only the documentation delimiters and =value, then check the complete long name or shorthand so invalid flags fail as specified in AGENTS.md:127.
The new test passes, but it never checks any skill command table and skips several existing example forms. Some corrected examples also still send an invalid request or operate on a different queue tier than their names suggest.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Valid, fixed in 6bb97c3. Flags are now checked by their whole name, up to any =value and without the list punctuation [, ] and ,; a name that is not a well-formed long flag fails. Single-letter shorthands such as -y are checked with ShorthandLookup. No current document had a prefix-matched flag. Regression tests: the "flag prefix" and "unknown shorthand" cases.

@edumansky

Copy link
Copy Markdown
Contributor Author

Codex review: outcome

All seven findings were valid and are fixed in 6bb97c3:

Finding Outcome
[P2] Read command tables using the skill-relative file key Fixed: tables are checked from the document content; every area skill's rows pass
[P2] Distinguish Basic and Customer Assist queue operations Fixed: the calling skill shows --has-cx-essentials true for Customer Assist queues and supervisors; the site example says the default list is Basic
[P2] Wrap dial-number bulk-save items in the request object Fixed for all five Contact Center bulk examples, which all showed an array
[P2] Use a supported time window for the call-history example Fixed: placeholders with the 5-minute-to-48-hour window and format; checked live, read-only
[P2] Validate commands with leading flags or positional placeholders Fixed: leading global flags are skipped; a placeholder after a command is an argument
[P2] Check the Webex invocations embedded in setup shell commands Fixed: webex after a shell operator or nohup/sudo/exec is checked, up to the next operator or redirection
[P3] Validate whole flag names and Cobra shorthands Fixed: whole names, and shorthands through ShorthandLookup

TestDocumentCheckFindsStaleExamples feeds the checker each kind of stale example from these findings, plus examples that must pass.

Checks at 6bb97c3:

  • go vet ./... and go test -p 1 -timeout 300s ./... pass; gofmt reports no files.
  • make codegen leaves the files unchanged; npm run build in site/ passes.

functions get returns the code as fnCode, while create and update read
only sourceCode; an update body copied from get fails with a wrapper-code
error. functions test takes its inputs as an object and publishes the
latest draft first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAtGHcFAKjQdB6dwDKd8mW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAtGHcFAKjQdB6dwDKd8mW

This branch has not been deployed

No deployments
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.

1 participant