agentleFS
sponge-b0bsponge-b0b/Polaris/.agents/skills/verify-architecture/SKILL.md

verify-architecture

Skill4 starsChanged 4 months agoApache-2.0View on GitHub

Enforce Polaris's mechanically observable architecture invariants by running the complete architecture guard suite, repairing violations when current authority determines the correct state, and failing closed when durable architecture is unresolved.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 13 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

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

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

    Keep accepted Polaris architecture continuously executable and regression-protected.

    line 11
  2. Distinctive:

    Do not invoke it merely because unrelated documentation, tracker state, Project projection, or other non-architecture administrative state …

    line 29
  3. Distinctive:

    Do not turn style preferences, speculative future architecture, subjective design taste, or ordinary code-quality concerns into …

    line 42
  4. Distinctive:

    Do not make a new architecture rule merely because a verifier would prefer one.

    line 44
  5. Distinctive:

    Before every pytest invocation, perform the mandatory test-service preflight from AGENTS.md.

    line 56
  6. Distinctive:

    Run the complete suite with the locked environment:

    line 62
  7. Very specific:

    Do not delete, ignore, regenerate, or modify uv.lock merely to make verification proceed.

    line 74
  8. Distinctive:

    When a parent caller has a stricter repository-state rule, preserve that stricter caller rule.

    line 76
  9. Distinctive:

    Do not replace the complete suite with only the live-repository assertion.

    line 83
  10. Distinctive:

    Update the checker and its independent acceptance/falsifier coverage together.

    line 119
  11. Very specific:

    Do not repair toward whichever state makes pytest pass.

    line 127
  12. Distinctive:

    When delegated by another workflow, this skill owns only the repository mutations required to restore already-determined mechanically …

    line 137
  13. Very specific:

    Do not recursively invoke $verify-code when $verify-code is the caller.

    line 147
  14. Distinctive:

    Do not make the architecture gate green by:

    line 151
  15. Distinctive:

    If a mechanically enforced rule has become wrong, first establish the authoritative architecture change through the owning architecture …

    line 161
  16. Very specific:

    When applicable, $verify-code invokes this gate in addition to its targeted Ruff, Mypy, and behavioral-test verification.

    line 167
  17. Very specific:

    If this skill repairs executable source/tests, return the changed paths so $verify-code expands/re-runs its affected target verification …

    line 169
  18. Very specific:

    When current migration Python changes, $database-migrations invokes this gate because current migrations are part of the architecture …

    line 173
  19. Distinctive:

    When unresolved architecture remains, return:

    line 199
  20. Distinctive:

    Do not report PASS with a non-zero suite failure count, a non-zero live repository violation count, incomplete suite execution, unresolved …

    line 210

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

Architecture Invariant Verification

Objective

Keep accepted Polaris architecture continuously executable and regression-protected.

This skill owns one repository invariant gate:

The complete architecture suite passes with zero failures, and the live greenfield repository has zero mechanically detectable architecture violations.

The architecture guard and its tests are executable representations of accepted architecture. They are not architecture authority themselves. Resolve architectural meaning from the current non-legacy authority ordering in AGENTS.md.

Applicability

Invoke this skill when the candidate can affect a mechanically enforced architecture invariant, including when it changes:

  • current Python source under src/polaris/;
  • current tests under tests/;
  • current Python migrations scanned by tests/architecture_guard.py;
  • tests/architecture_guard.py or any architecture-guard test;
  • accepted architecture authority whose mechanically enforceable rule is represented by the architecture guard.

Do not invoke it merely because unrelated documentation, tracker state, Project projection, or other non-architecture administrative state changed.

Applicability controls whether the gate runs. Once applicable, verification scope is the complete architecture suite; do not narrow it to changed files, one ticket, one Spec obligation, or one rule.

Architecture Rule Admission Invariant

A rule belongs in the architecture guard only when all of the following are true:

  1. current accepted authority establishes a durable architectural invariant;
  2. the invariant is mechanically observable from the repository surface the guard can inspect;
  3. detection can be implemented with sufficiently low false-positive risk;
  4. the checker and independent falsifier tests can express both prohibited and adjacent-valid states where material.

Do not turn style preferences, speculative future architecture, subjective design taste, or ordinary code-quality concerns into architecture rules.

Do not make a new architecture rule merely because a verifier would prefer one. If current authority does not establish the durable semantic, the result is unresolved architecture.

Complete Architecture Suite

The current suite is:

tests/test_architecture_guard.py
tests/test_architecture_guard_identity_aliases.py
tests/test_architecture_guard_legacy_loaders.py

Before every pytest invocation, perform the mandatory test-service preflight from AGENTS.md. Re-derive prerequisites from the current complete suite rather than assuming they remain service-free forever. Do not use pytest startup, timeout, skip, or connection failure as the preflight.

Locked Verification Environment

Architecture verification uses the committed Polaris development environment. uv.lock is expected tracked project state, and pytest is a canonical project development dependency.

Run the complete suite with the locked environment:

POLARIS_BROAD_VERIFY_AUTHORIZED=verify-architecture \
  uv run --locked pytest -q \
  tests/test_architecture_guard.py \
  tests/test_architecture_guard_identity_aliases.py \
  tests/test_architecture_guard_legacy_loaders.py

uv may synchronize .venv and build/install Polaris as normal generated local environment state. Those actions are not repository mutation. The --locked gate must, however, refuse to rewrite dependency state: if uv.lock is missing or stale relative to pyproject.toml, classify the result environment-or-tooling-blocker and repair dependency state through intentional dependency management before retrying verification.

Do not delete, ignore, regenerate, or modify uv.lock merely to make verification proceed. Any intentional dependency change must update and commit the project dependency declaration and lockfile through the normal dependency-management workflow.

When a parent caller has a stricter repository-state rule, preserve that stricter caller rule.

The suite is intentionally complete because it proves two distinct things together:

  • the guard still detects the prohibited architecture states it claims to detect while permitting adjacent-valid states; and
  • the current greenfield repository satisfies those mechanically enforced rules.

Do not replace the complete suite with only the live-repository assertion.

Failure Classification and Repair Loop

A non-zero architecture-suite failure count is non-terminal.

For every failure, inspect current authority and classify it as exactly one of:

repository-violation
guard-defect
authority-realization
unresolved-architecture
environment-or-tooling-blocker

repository-violation

Current accepted authority already determines the correct architecture and current repository code violates it.

Repair the narrowest authoritative implementation point, then rerun the complete architecture suite.

Examples include an inward layer importing an outward layer, current code depending on legacy/, or a vendor-native representation crossing a boundary that accepted architecture already forbids.

guard-defect

Current accepted authority is clear, but the checker or its falsifier tests encode it incorrectly or incompletely.

Repair the checker/test representation from current authority. Keep independent expectation matrices independent of checker implementation constants; do not make tests self-confirming merely to restore green.

Then rerun the complete architecture suite.

authority-realization

Accepted architecture intentionally changed and current checker/tests have not yet been updated to represent that already-authorized rule.

Update the checker and its independent acceptance/falsifier coverage together. Do not treat stale executable architecture as higher authority than the accepted decision.

Then rerun the complete architecture suite.

unresolved-architecture

Proceeding would require inventing, changing, or choosing a durable architectural owner, boundary, dependency direction, identity/key semantic, lifecycle rule, failure semantic, or other architectural invariant not determined by current authority.

Do not repair toward whichever state makes pytest pass. Return the complete blocker set to the owning lifecycle so it can route through $architecture-remediation.

environment-or-tooling-blocker

The complete suite cannot be executed or interpreted reliably because a required tool/environment prerequisite is unavailable or broken.

Report the exact blocker. Do not claim PASS from partial execution.

Repair Authority

When delegated by another workflow, this skill owns only the repository mutations required to restore already-determined mechanically enforced architecture:

  • fixing a repository architecture violation;
  • fixing the guard/tests to match current accepted authority;
  • realizing an already-accepted architecture change in the guard/tests.

This is explicit repository-wide architecture-gate repair authority. It does not authorize unrelated cleanup or new architectural decisions.

Return every changed path and failure disposition to the caller. The caller remains responsible for rerunning any non-architecture verification invalidated by those repairs, such as Ruff, Mypy, targeted behavioral tests, migration lifecycle proof, exact-HEAD certification, or candidate-state checks.

Do not recursively invoke $verify-code when $verify-code is the caller.

Forbidden Pass-Only Repairs

Do not make the architecture gate green by:

  • deleting or weakening a valid architecture rule without current authority;
  • changing an independent expected matrix to derive from the checker implementation it is supposed to challenge;
  • adding skip, xfail, marker filtering, test deselection, or path exclusions merely to hide a failing invariant;
  • treating tests as a fifth product layer or inventing another scope category unless current authority establishes it;
  • excluding a current source/test/migration path because it now violates the guard;
  • preserving a forbidden dependency behind a wrapper, alias, loader indirection, compatibility shim, or other concealment;
  • changing architecture authority inside this verification skill merely to fit implementation reality.

If a mechanically enforced rule has become wrong, first establish the authoritative architecture change through the owning architecture lifecycle. Then update its executable representation.

Parent Workflow Composition

$verify-code

When applicable, $verify-code invokes this gate in addition to its targeted Ruff, Mypy, and behavioral-test verification. Architecture remains whole-suite even though those other checks stay targeted.

If this skill repairs executable source/tests, return the changed paths so $verify-code expands/re-runs its affected target verification before reporting success.

$database-migrations

When current migration Python changes, $database-migrations invokes this gate because current migrations are part of the architecture guard's scan universe. If this skill repairs a migration, the migration owner reruns every invalidated migration lifecycle proof.

$verify-spec

When the integrated Spec contains architecture-capable changes, $verify-spec invokes this gate as an explicit repository-wide delegated invariant. Architecture repairs are authorized by this child gate even when the repaired surface is outside the ordinary Spec semantic repair scope; that exception applies only to mechanically enforced architecture repair under this skill.

Any repair changes the candidate and invalidates prior exact-HEAD semantic certification normally.

Terminal Result

Report PASS only after the complete suite actually passes and the live-repository assertion establishes zero violations:

ARCHITECTURE INVARIANT: PASS

Architecture suite: <passed>/<collected>
Architecture suite failures: 0
Live repository architecture violations: 0
Unresolved architecture questions: 0
Environment/tooling blockers: 0
Repairs:
- Repository violations repaired: <n>
- Guard defects repaired: <n>
- Accepted-authority realizations repaired: <n>

When unresolved architecture remains, return:

ARCHITECTURE INVARIANT: UNRESOLVED

Architecture suite failures: <n>
Unresolved architecture questions: <n>
Blockers:
- <question/conflict + current authority evidence + material consequence>

Do not report PASS with a non-zero suite failure count, a non-zero live repository violation count, incomplete suite execution, unresolved architectural semantics, or verification-environment mutation.

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.