add-cli-command
Skill2 starsChanged 6 months agoMITView on GitHub
Add a new command to the jobtrack CLI (src/jobtrack/cli.py). Use this when the user asks for a new `jobtrack <verb>` subcommand. Keeps business logic out of cli.py and reuses the project's resolution + error patterns.
4 other projects use a version of this.
Adopted by
Most recently taken up by
- miruky/harness-sampletheir own version, first seen Nov 15, 2026
- GCarin1/Doctrinatheir own version, first seen Nov 8, 2026
- lbedner/aegis-stacktheir own version, first seen Oct 8, 2026
- dotnet/sdktheir own version, first seen Oct 8, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- dotnet/sdk★ 3.2ksame name
- lbedner/aegis-stack★ 146same name
- GCarin1/Doctrina★ 1same name
- miruky/harness-sample★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- add-application-fieldSkill
- add-mcp-toolSkill
- smart-job-searchSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Format output with
rich: Use the module-level console. - Very specific: line 19
Add a function to
core.py: if there's new business logic. - Very specific: line 42
File path arguments: use typer.Option(..., exists=True, dir_okay=False) to get free validation.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Add a new CLI command
The CLI lives in src/jobtrack/cli.py. It's a typer app with seven commands today: add, list, show, open, status, note, tag. The pattern is consistent — follow it.
Hard rules
- Business logic goes in
core.py, never incli.py. The CLI parses args, calls a core function, formats output. If the new command needs new logic, add a function tocore.pyfirst and call it from the typer command. - Use
_resolve_or_exit(query)for any command that takes an<id|company>argument. It handles ambiguity (prints a numbered list and exits 1) and not-found (exits 1) uniformly. Don't reimplement. - Format output with
rich. Use the module-levelconsole. Tables for lists,console.print_jsonfor structured data,[green]...[/green]/[red]...[/red]for status messages. - Exit codes:
0success,1resolution/runtime failure,2bad input (usage error).
The pattern
- Add a function to
core.pyif there's new business logic. Keep it pure (takes ids/values, returns or mutates viastorage). Don't import typer or rich there. - Add the typer command in
cli.py:@app.command("verb") def verb_cmd( query: str = typer.Argument(..., help="ID or company"), # ... other args ... ): """One-line help string — shown by `jobtrack verb --help`.""" meta = _resolve_or_exit(query) result = core.<the_thing>(meta.id, ...) console.print(f"[green]Did the thing to[/green] {meta.id}") - Naming conflicts with Python builtins: the typer function name can shadow builtins (
list,open, etc.) which makes for awkward Python. The existing pattern is to name the function<verb>_cmdand pass the verb as the first arg to@app.command():@app.command("list") def list_cmd(...): ... - Enum arguments: typer renders
ApplicationStatusnatively as a constrained choice — seestatus_cmd. Use this rather than a free string with manual validation. - File path arguments: use
typer.Option(..., exists=True, dir_okay=False)to get free validation. See theaddcommand's--resumefor the pattern. - Update the README quickstart. New commands belong in the
## Quickstartblock. Keep the example minimal — one realistic invocation. - Test the underlying core function in
tests/test_core.py. CLI tests are intentionally light per the brief — there is notests/test_cli.pytoday, and that's a deliberate choice. If you genuinely need argument-parsing coverage (e.g. a tricky flag combination), createtests/test_cli.pywith typer'sCliRunner; otherwise rely on core tests + manual smoke (uv run jobtrack verb --help).
Skeleton
@app.command("verb")
def verb_cmd(
query: str = typer.Argument(..., help="ID or company"),
flag: bool = typer.Option(False, "--flag", help="Describe."),
):
"""Imperative one-liner. (`jobtrack verb --help` shows this.)"""
meta = _resolve_or_exit(query)
try:
result = core.do_the_thing(meta.id, flag=flag)
except ValueError as e:
console.print(f"[red]{e}[/red]")
raise typer.Exit(2)
console.print(f"[green]Done[/green] {result.id}")If the command should also be exposed via MCP
Decide deliberately. The brief explicitly keeps add CLI-only because it needs files on disk at submit time. Most read-style commands belong in MCP too; most write-style commands do if they're things you'd do from a chat session. If yes, use the add-mcp-tool skill next.
Anti-patterns
- ❌ Calling
storage.*directly from the CLI. Go throughcore. - ❌ Catching
core.AmbiguousQuery/core.NotFoundinline — that's what_resolve_or_exitis for. - ❌ Using
print()instead ofconsole.print(). Loses the rich formatting and the Windows UTF-8 setup at the top ofcli.pywas specifically done for the console object. - ❌ Putting business logic tests in
test_cli.py(if you create it). Business logic belongs intest_core.py; CLI tests are for argument parsing and exit codes only.
Verify
uv run pytest -v
uv run jobtrack verb --help # confirm help text
uv run jobtrack verb <real-id> # smoke test against the dev storeDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

