Skip to content

Commit f94e380

Browse files
committed
command spec skill restructure
1 parent 60cf115 commit f94e380

1 file changed

Lines changed: 52 additions & 7 deletions

File tree

.agents/skills/add-command-spec/SKILL.md

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,44 @@ description: Guide for adding new command completion specs to warp-command-signa
55

66
# Adding a New Command Spec
77

8-
## Steps
8+
This skill covers the full lifecycle of writing a completion spec in warpdotdev/command-signatures: researching the command, implementing the spec, validating it, submitting a PR, and documenting learnings for future completion spec implementations.
99

10-
1. **Create JSON spec**: `command-signatures/json/<command>.json` following the [Fig completion spec schema](https://fig.io/docs/reference)
11-
2. **Create generator** (if needed): Add `command-signatures/src/generators/<command>.rs`, define a `generator()` function returning `CommandSignatureGenerators`, and register it in `generators/mod.rs`
10+
## Step 1: Research the Command
11+
12+
Before writing any JSON, build a thorough picture of the command's subcommands, flags, and argument types. Commands often have more surface area than you'd expect — nested subcommands, platform-specific flags, mutually exclusive options. Investing time here prevents rework later.
13+
14+
Use these strategies roughly in priority order:
15+
16+
### Start with Fish shell completions
17+
18+
Fish maintains high-quality, community-reviewed completion definitions at https://github.com/fish-shell/fish-shell/tree/master/share/completions — look for `<command>.fish`. These are thorough and well-structured, so they're the fastest way to get a comprehensive picture of a command's subcommands and flags. Read this file first.
19+
20+
### Test with Fish shell completions
21+
22+
You can also use Fish's completion engine to test output interactively:
23+
24+
1. Install Fish if needed (`brew install fish` on UNIX)
25+
2. Run: `fish -c 'complete -C "<command> "'` to see top-level completions
26+
3. Drill into subcommands: `fish -c 'complete -C "<command> <subcommand> "'`
27+
28+
For example, to inspect `gcloud compute ssh` completions: `fish -c 'complete -C "gcloud compute ssh w"'` (where `w` is the start of a known target).
29+
30+
### Install and inspect the command directly
31+
32+
Use the command's own documentation to fill gaps and verify what Fish reports. Install the command if it isn't already available, then:
33+
34+
- Check the `man` page (pipe to `cat` to avoid the pager): `man <command> | cat`
35+
- Run `<command> --help` and `<command> help` at each subcommand level to discover nested structure
36+
- Run the command itself to observe real output — this matters for generators that parse command output
37+
38+
### Use Fig specs as a last resort
39+
40+
The Fig autocomplete repo at https://github.com/withfig/autocomplete/tree/master/src has TypeScript specs for many commands (look for `<command>.ts`). These can help fill gaps, but they vary in quality and may be outdated — always verify against the command's own docs.
41+
42+
## Step 2: Implement the Spec
43+
44+
1. **Create the JSON spec**: `command-signatures/json/<command>.json` following the [Fig completion spec schema](https://fig.io/docs/reference)
45+
2. **Create a generator** (if needed): Add `command-signatures/src/generators/<command>.rs`, define a `generator()` function returning `CommandSignatureGenerators`, and register it in `generators/mod.rs`
1246

1347
## Platform Compatibility
1448

@@ -68,13 +102,24 @@ Format the JSON spec with `npm run format -- command-signatures/json/<command>.j
68102

69103
Run `script/presubmit` to verify formatting, linting, and tests all pass (this runs `cargo fmt --check`, `cargo clippy`, and `cargo test`).
70104

71-
To verify completions end-to-end in a real Warp session, use the **test-local-warp** skill, which covers building and running Warp against a local checkout of this repo.
72-
This requires computer use to be enabled since Warp is a GUI application.
105+
To verify completions end-to-end in a real Warp session, use the **test-local-warp** skill, which covers building and running Warp against a local checkout of this repo. This requires computer use to be enabled since Warp is a GUI application.
73106
Use this when adding generators to make sure they produce reasonable candidates.
74-
If you are running unsupervised (autonomy level is `UNSUPERVISED`), this step is required.
75107
Produce screenshots for each generator added so that a human can review them. You do not need to zoom in.
76108
We only need screenshots for generator functions. Things like sub-commands and options are already well tested.
77-
When running supervised, skip this step.
109+
If you are running unsupervised (autonomy level is `UNSUPERVISED`), screenshot artifacts are required; the generator implementation will not be accepted without them. When running supervised, skip this step.
110+
111+
## Submitting
112+
113+
Ttile the branch: `lucie/test-command-spec-<command-name>`.
114+
Title the PR: **Add completion spec: `<command_name>`**.
115+
116+
A consistent title convention makes it easy to scan PR history and understand what was added at a glance.
117+
118+
## Post-Completion Learnings
119+
120+
If you encounter something genuinely surprising or novel while writing the spec that would help future completion spec writers — an undocumented edge case, a research strategy that saved significant time, a pattern that the existing guidance doesn't cover — update this skill file with what you learned. Open a separate PR titled **Post-completion learnings: `<command_name>`** with those changes.
121+
122+
Skip this if the spec was straightforward and the existing guidance covered everything you needed. The goal is to help future spec implementers, not to generate busywork.
78123

79124
## Reference Examples
80125

0 commit comments

Comments
 (0)