agentleFS
pyrite-wikipyrite-wiki/pyrite/.claude/skills/pyrite-dev/SKILL.md

pyrite-dev

Skill19 starsChanged 6 days agoMITView on GitHub

This skill should be used by an agent developing Pyrite code — fixing a bug, adding a feature, writing or running tests, debugging, completing a backlog item, changing or removing a CLI flag, MCP argument, REST field or error code, or writing a proposal, groom or refactor plan for the codebase — on its own branch in its own worktree. Enforces TDD, root-cause debugging and evidence-before-claims, the rules for public surfaces (no one-step removals; removals are the maintainer's call), and checked references in proposals; ends with a report for the PR. Opens a draft PR after the first push; the maintainer reviews and merges it. Process commands (setup, hooks, branches, PRs) live in CONTRIBUTING.md.

  • Deletes or force-pushes
  • Commits and pushes

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. markramm/pyrite★ 19100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    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 repository6 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

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

    Use the worktree's .venv/bin/....

    line 40
  2. Very specific:

    Read kb/design.md. A ticket's suggested fix is evidence, not the plan: if the work as described runs against a principle there, stop and …

    line 48
  3. Very specific:

    Read the ticket and its ## Groom (gh issue view N, pyrite get <id> -k pyrite), then the contracts and pointers it names.

    line 51
  4. Distinctive:

    Run the tests before you change anything: If they are already red, report that and stop: a red baseline hides whether your change broke …

    line 72
  5. Distinctive:

    Write the choice and your recommendation on the issue or PR, and wait.

    line 98
  6. Distinctive:

    Run the command that proves the claim, read its output, then claim.

    line 148
  7. Distinctive:

    Commit each passing step as you reach it, with the reason in the message.

    line 197
  8. Very specific:

    Test each tree once, and after a load-caused failure re-run only the failures (scripts/test-affected --run -- --lf).

    line 204
  9. Distinctive:

    Put each finding where the next person will meet it, the first that fits:

    line 212
  10. Distinctive:

    Use the CLI on your branch.

    line 224

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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

Pyrite Development Skill

Announce at start: "I'm using the pyrite-dev skill."

You develop Pyrite on one branch, in one worktree, on one theme, and you never push to dev. Review and merge are the maintainer's. Every process fact (setup, hooks, branches, the PR, the heavy-run lock) has one home, CONTRIBUTING.md, "Branches, hooks and pull requests"; this skill gives the method and links there rather than repeating it.

A theme produces code and what was learned building it; record both. Why each rule exists: history.md.

The Iron Laws

1. NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
2. NO FIX ATTEMPTS WITHOUT ROOT CAUSE INVESTIGATION
3. NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
4. NO BACKLOG CHANGES WITHOUT USING THE CLI (`pyrite update`, `pyrite create`)

Where you are

git branch --show-current     # fix/*, feature/*, docs/*, kb/* or process/* -- never dev
pwd                           # your checkout; a worktree under ../pyrite-wt/ if others share the clone
.venv/bin/pyrite kb list      # the `pyrite` KB path must be THIS worktree's kb/
  • On dev, or sharing a clone with another session or agent, or a wrong pyrite KB path: stop and set up a worktree (CONTRIBUTING, Initial Setup).
  • Use the worktree's .venv/bin/...; the main checkout's venv imports the main checkout's code.
  • Sub-agents share your branch and worktree: give them disjoint files, never isolation: "worktree".
  • Stage explicit paths, never git add -A.

Before you build

  1. Read kb/design.md. A ticket's suggested fix is evidence, not the plan: if the work as described runs against a principle there, stop and say so on the ticket.
  2. Read the ticket and its ## Groom (gh issue view N, pyrite get <id> -k pyrite), then the contracts and pointers it names. With no groom, find them: pyrite search "<topic>" -k pyrite, pyrite sw adrs, architecture.md.
  3. Test the groom's riskiest assumption first: its "this groom is wrong if" line, then its out-of-scope list. Use one command or one failing test, and post the result on the draft PR. If it changes the scope, stop.
  4. A mission brief (a goal state and invariants, not steps) gets a plan before code: one page on the draft PR, led by the result of step 2. It states the goal as properties, the surfaces and callers found by grep, what must not change, the tests (negative, environment and concurrency cases included), what is out of scope, and open questions. Wait for the answer.
  5. The groom's open questions are yours to explore; overturn its recommendation when the evidence says so.
  6. When the property says "every" or "all", list the instances before you write code. Find them by searching the code, not from the ticket: each caller, reader, writer, entry point and extension the property covers. Put the list on the draft PR, each marked guarded (and the test that proves it, run through that caller's own entry point), already safe (why), or out of scope (why). A review of your own diff cannot find the guard you never wrote; this list can. It becomes the report's Covers line.
  7. Run the tests before you change anything. If they are already red, report that and stop: a red baseline hides whether your change broke something.

Bugs and user requests live in GitHub Issues, the roadmap (epics, backlog items, ADRs) in kb/, never both (ADR-0033). A bug you fix here needs no issue. A bug you find and do not fix: gh issue create --label bug --label <area>, with placeholders for anything private. A security finding goes to the maintainer privately (SECURITY.md), never to a public issue.

Editing a function on the tests/test_layer_boundaries.py allowlist? Remove its entry: move the storage access behind a service.

Changing a public surface

A public surface is anything users or agents call or read: a CLI command or flag, an MCP tool or argument, a REST field, an error code, a file format. Code that is right can still break these, so they carry rules of their own:

  • Nothing public leaves in one step. Removing or renaming an option takes a release that warns (a runtime warning naming the replacement and the removal release; a --help label is not a warning), then a later release that removes it everywhere at once. CONTRIBUTING, "Removing or renaming a public option", has the steps.
  • Whether to remove or redesign a public option is the maintainer's decision, and so is a choice between two designs that both look right. Write the choice and your recommendation on the issue or PR, and wait. An issue that lists removals asks you to carry out decisions already made; if one has no recorded decision, ask.
  • Update every place the interface is described in the same PR: the tool description and input schema, the other surfaces, docs/json-contracts.md, the goldens, a changelog fragment (CONTRIBUTING, "Regenerating goldens").
  • A test you are told not to edit stops you. Some guard tests are protected because they catch exactly the change you are making. If one blocks you, say so on the PR and ask; never weaken it to pass. The maintainer may let you remove one entry; that is their call, not yours.

Proposing instead of building

A proposal, a groom or a refactor plan is read as authoritative, so its references must be real. Cite every function as file:function (and a line only if you read it), checked on a named dev commit, and mark each claim checked (you read the code) or assumed (you did not). A name that does not exist, or a line range that is off, costs the reviewer more than leaving it out. Search for what already tracks each part (gh issue list --search, pyrite search -k pyrite) and say what is new.

Test-driven development

RED, verify RED (it fails for the right reason), GREEN (the minimal code), verify GREEN, REFACTOR, commit with a conventional prefix. Code written before its test is deleted and started over. Patterns: tdd.md.

A test's expected value comes from the property, never from the code under test. Never build an expected value, model or checker by restating the module's own scan, model or check: a copy shares the code's blind spots, so the test passes for the wrong reason and verify-red cannot see it. Where the property is about bytes ("everything not named is unchanged"), compare bytes directly, before against after. Where it is about behaviour, write the expected value by hand or take it from a reference tool (YAML, git, the OS). (#732: an "independent" oracle copied the module's line scan character for character, and three comment-losing edits passed 2,602 cases.)

Debugging

Find the root cause before any fix: reproduce, trace the bad value to its origin, test one hypothesis at a time (debugging.md). After three failed fixes, stop and question the design in your report.

You may stop and say so: when the work is churning, when the fix you are asked for would patch one instance of a missing rule, or when it runs against kb/design.md, comment on the ticket with the evidence and stop. That is a finding, not a failure.

Verification

Run the command that proves the claim, read its output, then claim. "Should work" is not evidence.

CI is the verification gate. Locally, run the tests of the files you changed; then push to your draft PR and read its CI. Don't hold a push for a slow local run of the whole affected set (how the hooks, the heavy-run lock and a verified commit work: CONTRIBUTING, Running the tests).

The exception: run the full suite before pushing a change to a public surface, storage or migrations, or anything cross-cutting (PYRITE_PUSH_FULL=1 git push, which runs it in the pre-push hook, or scripts/test-affected --run --full on a committed tree, which stamps the tree so the push skips; a bare pytest run records nothing and the hook would test again). Tests across the repo pin flags, keys and messages by name, and the affected selection does not find them all: a removed flag once failed 25 to 37 tests per CI shard in files the change never touched.

ClaimRunLook for
Backend tests pass (local)scripts/test-affected --runN passed, 0 failed
Backend tests pass (all)the draft PR's CI: gh pr checks <n> (the whole suite locally: scripts/heavy_lock.py -- .venv/bin/pytest tests/ extensions/*/tests/ -n 4 -q)gate passes (it waits for every test (<py>, <shard>) leg)
The tests guard the change (every branch that changes code, feat included)scripts/verify-red.sh, once (CI's verify-red job runs the same code)verify-red: N red · 0 import-only · 0 unexpected pass · 0 n/a; paste its summary line into the report
Each guard is testeddelete that guard alone, run the testsa test fails, for every guard you added
A new error class, refusal message, result key or error code obeys the contracts (the tests that read the source, which your own tests never run)the tests named in gotchas.md, "A New Error Class or Message: Run the Source-Reading Tests", and the rest its grep findsall pass, before the push; CI is otherwise the first place they fail (#1542)
A new CLI command or option passes the tests that walk the CLI treethe tests named in gotchas.md, "A new CLI option"all pass before the push
Frontend passescd web && npm run check && npm run test:unit && npm run buildall green
Lint passes.venv/bin/ruff check . && .venv/bin/ruff format --check .clean
  • A test meant to pass without the fix gets @pytest.mark.control(reason="..."); a bare marker is rejected.
  • experimental marks tests of experimental surfaces (#657). It is applied from tests/experimental_surface.py, never by hand. Those tests do not block a merge or a push; CI's experimental job runs them against tests/experimental_known_failures.txt, which can only shrink. Run them with scripts/test-affected --run --experimental. A security test is never experimental: list a new one in that file's NEVER_EXPERIMENTAL if its path is mapped experimental. test_experimental_surface.py fails on an experimental test that touches security vocabulary until you list it there or in REVIEWED_EXPERIMENTAL with the reason it is not one.
  • A branch that changes pyrite/ or extensions/ code, feat: as much as fix:, whose line shows 0 red, or only import-only reds, is not done: write a test that fails on the bug's or the feature's behaviour without the change, or say why none can. A passing test proves nothing until it has been seen to fail without the change (retro 2026-10-03: in 2 of 3 themes a cold read found tests that passed with the change removed; #701's 15 parity tests passed with alias handling disabled, and its worker had skipped verify-red as "a feat branch with no bug").
  • Commit each passing step as you reach it, with the reason in the message. Uncommitted work and the thinking behind it are lost when a session stops (2026-10-02: a worker died with eight files edited and no note of why).
  • Open a draft PR right after your first push, with Fixes #N in the body; its CI is the authority. Leave it a draft until your report is done (steps and fork flags: CONTRIBUTING, Branches, hooks and pull requests).
  • Test each tree once, and after a load-caused failure re-run only the failures (scripts/test-affected --run -- --lf). Never start a second heavy run while one is running; the lock and its wrapper are in CONTRIBUTING, "Running the tests".
  • A test that passes alone and fails in parallel is a bug in that test.

Capture what you learned

Put each finding where the next person will meet it, the first that fits:

  • behaviour the code must keep: a test named for the property;
  • code that looks wrong and is right, or the reverse: a comment at that line;
  • how a component works, where its doc is silent or wrong: kb/components/;
  • the groom was wrong: a comment on the ticket, with file:line;
  • a decision that could have gone another way: pyrite sw new-adr "Title" -k pyrite --status proposed (accepting it is the maintainer's);
  • a trap with no closer home: gotchas.md.

KB bookkeeping

Use the CLI on your branch; never hand-edit frontmatter.

  • Closed a backlog item: pyrite update <id> -k pyrite -f status=done && git mv kb/backlog/<id>.md kb/backlog/done/ (done, never completed).
  • New component: pyrite create -k pyrite -t component ....
  • Then .venv/bin/pyrite index sync, and check pyrite search "<feature>" -k pyrite finds it.
  • One user-visible change, one fragment changelog.d/<slug>.<section>.md (added changed deprecated removed fixed security). Never edit CHANGELOG.md; a test asserts [Unreleased] is empty.

Finishing: the report

Done means the whole theme, with evidence for every claim. Then, in order:

  1. Diff your footprint: git diff --name-only origin/dev...HEAD. A file on the out-of-scope list is not yours: find how it got in.
  2. Clean the history. You committed at every passing step; the reviewer reads commits, not checkpoints. Rewrite the branch into the few commits the idea needs, each one coherent with a message that says why: git fetch origin dev, git rebase origin/dev, note that head, then git reset --soft origin/dev and recommit by explicit paths (or git commit --fixup as you go and GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash origin/dev). git diff <noted-head> HEAD must be empty: the rewrite changes history, never content. Then git push --force-with-lease. Only your own branch, and only before the PR is marked ready.
  3. Push: in a cloud container, first run python3 scripts/known_cloud_failures.py, the reading path for scripts/known-cloud-failures.json. Compare exact test nodes; do not spend a task rediscovering a recorded cloud-only failure. Do not waive a changed test or CI. Keep newly observed failures distinct. (CONTRIBUTING, "Branches, hooks and pull requests"). A red pre-push in a test your change touches is yours to fix. If you push past an unrelated flake as that section allows, name the test in the report.
  4. Report with the pushed SHA. The PR stays a draft.
Branch:      fix/what-it-fixes      Worktree: ../pyrite-wt/fix-what-it-fixes
Pushed:      <sha> == origin/<branch>
Commits:     <n>, one line each
Closes:      #N, #M  (or backlog item ids)
Evidence:    the test-affected line; the draft PR's CI on the pushed SHA; the
             `verify-red: ...` line, with a reason for each non-red test; lint;
             Regimes, one line each
Guards:      each check you added -> the test that fails when it alone is removed
Changed:     files, new vs existing; the count against the groom's prediction
Covers:      for a property that says "every" or "all": the list from "Before
             you build" step 5, updated: guarded (test) | already safe (why) |
             out of scope (why)
Learned:     the riskiest-assumption result, then what the groom got wrong,
             what the code turned out to do, contracts you found; one line
             each, with file:line
Captured in: per Learned line, the test, doc path or commented line holding it
Tokens:      as the harness reports them, or "not reported"
Unsure:      what a reviewer should look at twice
Left:        anything in the theme you did not finish, and why

A Learned line with nothing in Captured in is not captured yet.

References

testing.md; data-pipelines.md (the entry lifecycle); extensions.md (building a plugin); gotchas.md (read before touching hooks, DB access or entry ids).

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.