agentleFS
james5101james5101/jobtrack/.claude/skills/add-application-field/SKILL.md

add-application-field

Skill2 starsChanged 6 months agoMITView on GitHub

Add a new field to the ApplicationMeta schema (the meta.json shape). Use this when the user wants to track additional per-application data. Covers the cross-cutting parts that are easy to half-do — backwards compatibility with existing snapshots, CLI/MCP surface decisions, and invariants.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Required fields break every existing snapshot: Don't do this unless you're prepared to write a migration that backfills the field for every …

    line 12
  2. Distinctive:

    Default to optional unless there's a strong reason.

    line 15
  3. Distinctive:

    README: Add the field to the user-facing README only if a user of the CLI/MCP needs to know about it.

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Add a field to ApplicationMeta

The schema is defined in src/jobtrack/models.py. Every existing meta.json on disk is a record someone already submitted — backwards compatibility is not optional. This skill covers the cross-cutting changes a new field requires.

Decide first: required or optional?

  • Required fields break every existing snapshot. Don't do this unless you're prepared to write a migration that backfills the field for every meta.json already on disk.
  • Optional fields are safe. Pydantic loads existing snapshots fine if the field has a default (= None, = "", = Field(default_factory=list), etc.). This is almost always what you want.

Default to optional unless there's a strong reason. The flight-recorder principle: old snapshots are historical artifacts; we don't rewrite them.

Decide second: capture surface

How does the field get populated?

  • At add time — new flag on jobtrack add (CLI) and a new parameter on core.add_application(...).
  • Post-hoc edit — new CLI command (use add-cli-command skill) and likely a new MCP write tool (use add-mcp-tool skill). Examples in-tree: note, tag.
  • Computed from existing files at add-time — like resume_hash. Computed in core.add_application after the file is copied into the snapshot dir; never trust the source path.

The pattern

  1. Add the field to ApplicationMeta in models.py. Group it with the existing optional fields:
    class ApplicationMeta(BaseModel):
        # ... required fields ...
        status_history: list[StatusEvent]
    
        # Optional
        jd_url: str | None = None
        cover_letter_file: str | None = None
        notes: str = ""
        tags: list[str] = Field(default_factory=list)
        my_new_field: str | None = None   # <-- here
  2. If the field has an invariant, encode it in a @model_validator(mode="after"). See the existing _check_initial_status validator for the canonical pattern (status_history[0] agreement with applied_at). Invariants enforced by pydantic stay enforced everywhere — CLI, MCP, direct edits to meta.json.
  3. Populate it where the data comes from:
    • At-add fields: thread the parameter through core.add_application(...) and a typer.Option(...) in cli.py::add. Pass it into the ApplicationMeta(...) constructor.
    • Post-hoc fields: add a core.set_<field>(app_id, value) function that reads via storage.read_meta, mutates, writes via storage.write_meta. Mirror the add_note / edit_tags shape.
    • File-snapshot fields (like an extra captured document): copy into the snapshot dir via storage.copy_into_snapshot(...), store the filename (not the path) in the field. Same pattern as cover_letter_file.
  4. MCP exposure decision. Two helpers in mcp_server.py shape MCP output:

    • _full(meta) calls meta.model_dump(mode="json") — new fields appear automatically in get_application, get_recent, and anywhere else _full is used.
    • _summary(meta) builds a dict by hand with explicit fields (id, company, role, applied_at, status, tags) — new fields do NOT appear unless you edit _summary. Used by list_applications, search_applications, and as the "updated" payload in write-tool responses.

    Decide whether the field belongs in the small list view (edit _summary) or only in the detailed view (do nothing, _full already shows it).

  5. Search consideration. If the field is text the user might search by, update search_applications in mcp_server.py to include it in the matched-fields scan. Note that file-based content (resume text, JD, cover letter) is searched by reading the snapshot file, not by reading meta.json — only notes is searched out of meta.json today.
  6. Tests — three places:
    • tests/test_storage.py if the field affects on-disk shape
    • tests/test_core.py for the business logic (capture, mutation, invariants)
    • tests/test_mcp_server.py only if you're adding new tool surface — otherwise the existing tests catch regressions via _full / _summary
  7. Backwards-compat test. Worth adding a test that loads a fixture meta.json without the new field and confirms ApplicationMeta.model_validate(...) succeeds. One-line guardrail that prevents anyone from accidentally making the field required later.
  8. README. Add the field to the user-facing README only if a user of the CLI/MCP needs to know about it. Internal/computed fields don't warrant a mention.

Worked example — adding recruiter_email

A user wants to record the recruiter's email per application, set at add-time, editable post-hoc.

  1. models.py: recruiter_email: str | None = None under the optional block.
  2. core.add_application: add recruiter_email: str | None = None parameter, pass into the constructor.
  3. cli.py::add: add recruiter_email: Optional[str] = typer.Option(None, "--recruiter-email"). Pass through.
  4. core.py: add set_recruiter_email(app_id, email) — mirror add_note.
  5. cli.py: add recruiter_email_cmd command (use the add-cli-command skill). Or fold it into a more general edit command — design call.
  6. mcp_server.py: add set_recruiter_email write tool (use the add-mcp-tool skill). It'll show up in _full automatically because pydantic dumps it; consider whether _summary should include it (probably not — too long for a list view).
  7. Tests: round-trip in test_core.py, write tool in test_mcp_server.py, backwards-compat in test_storage.py.

Anti-patterns

  • ❌ Making the field required without writing a backfill. Existing snapshots will fail to load.
  • ❌ Storing absolute paths. Always store filenames relative to the snapshot dir (see resume_file, jd_file, cover_letter_file).
  • ❌ Mutating existing snapshots to backfill a new optional field. Snapshots are immutable — that's a load-bearing invariant from the brief.
  • ❌ Adding a field that duplicates information already on disk. If the data can be computed from existing snapshot files, compute it; don't denormalize into meta.json.

Verify

uv run pytest -v

And manually load an old snapshot:

uv run python -c "from jobtrack import storage; print(storage.list_meta())"

This must not error on any pre-existing meta.json.

Download now (ZIP)

Does 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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.