Repository navigation
feat: add an agent skill for coding assistants #193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rayslava
wants to merge
13
commits into
anodized-rs:main
Choose a base branch
from
rayslava:feat/agent-skill
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
76777f4
feat: add the agent skill and plugin manifests
rayslava e618e29
[anodized] docs: repair the examples in REFERENCE.md
rayslava eec470b
[skill-tools] feat: generate and validate the agent skill
rayslava 76723ba
docs: add a contributor guide
rayslava 5002c7c
docs: organize repair guidance around what is wrong
rayslava 54ea234
docs: follow the upstream invariant and output-pattern changes
rayslava a9cc36c
Merge branch 'main' into feat/agent-skill
mkovaxx 5e0b4c8
Merge branch 'main' into feat/agent-skill
mkovaxx c492233
Apply suggestion from @mkovaxx
mkovaxx d38ea92
Apply batched suggestions from code review
mkovaxx 1d347b5
fix: align agent skill with current spec behavior
MauScheff 7835b94
Merge branch 'main' into feat/agent-skill
mkovaxx 63883e2
Apply batched suggestions from code review
mkovaxx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "name": "anodized", | ||
| "interface": { | ||
| "displayName": "Anodized" | ||
| }, | ||
| "plugins": [ | ||
| { | ||
| "name": "anodized", | ||
| "source": { | ||
| "source": "local", | ||
| "path": "./plugins/anodized" | ||
| }, | ||
| "policy": { | ||
| "installation": "AVAILABLE" | ||
| }, | ||
| "category": "Developer Tools" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "$schema": "https://anthropic.com/claude-code/marketplace.schema.json", | ||
| "name": "anodized", | ||
| "owner": { | ||
| "name": "anodized-rs" | ||
| }, | ||
| "metadata": { | ||
| "description": "The Anodized agent skill: write and review `#[spec]` specifications in Rust." | ||
| }, | ||
| "plugins": [ | ||
| { | ||
| "name": "anodized", | ||
| "source": "./plugins/anodized", | ||
| "description": "Write, review, and debug Anodized `#[spec]` specifications on Rust functions, traits, loops, structs, and enums, and run the runtime-check build configurations.", | ||
| "version": "0.7.0", | ||
| "author": { | ||
| "name": "anodized-rs" | ||
| }, | ||
| "homepage": "https://github.com/anodized-rs/anodized", | ||
| "repository": "https://github.com/anodized-rs/anodized", | ||
| "license": "MIT OR Apache-2.0", | ||
| "category": "development", | ||
| "keywords": [ | ||
| "anodized", | ||
| "rust", | ||
| "specification", | ||
| "design-by-contract", | ||
| "verification" | ||
| ] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,3 +15,6 @@ Cargo.lock | |
|
|
||
| # macOS specific files | ||
| .DS_Store | ||
|
|
||
| # Local agent configuration | ||
| .claude/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| CLAUDE.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| # Working on Anodized | ||
|
|
||
| This file is for agents changing *this repository*. The skill under | ||
| `plugins/anodized/skills/anodized/` is a different thing: it teaches people who *use* the | ||
| crate how to write specs. Both exist; do not confuse them. | ||
|
|
||
| ## Layout | ||
|
|
||
| | Crate | Owns | | ||
| | --- | --- | | ||
| | `anodized` | The user-facing facade: re-exports `spec`, plus `result` and `try_call!`. | | ||
| | `anodized-macros` | The proc macro, and the `cfg` dispatch that decides what it emits. | | ||
| | `anodized-core` | Parsing and instrumentation. The real logic, and the tool interop layer. | | ||
| | `anodized-logic` | `int`, `implies!`, `opaque!`, `forall`, `exists`. | | ||
| | `anodized-fmt` | Formatter library and CLI for `#[spec(...)]`. | | ||
| | `test-util` | Internal test helpers. Not published. | | ||
| | `skill-tools` | Generates and validates the agent skill. Not published. | | ||
|
|
||
| `README.md` is a symlink to `crates/anodized/README.md`, which is included as the crate's | ||
| rustdoc via `#![doc = include_str!]` — so **its examples are doctested**. | ||
|
|
||
| ## Build configurations | ||
|
|
||
| There are **no Cargo features**. Behavior is controlled entirely by `--cfg` flags: | ||
|
|
||
| | Flag | Effect | | ||
| | --- | --- | | ||
| | *(none)* | Specs embedded and type-checked; no checks run. | | ||
| | `anodized_discard_specs` | Specs dropped entirely; incompatible with all other flags. | | ||
| | `anodized_embed_specs` | Specs emitted as separate items for analysis; incompatible with runtime-check flags. | | ||
| | `anodized_charon` | Embedding with Charon contract attributes; requires nightly and Charon tool registration. | | ||
| | `anodized_print` | Violations report to stderr and continue. | | ||
| | `anodized_panic` | Violations panic. | | ||
| | `anodized_try` | Enables `try_call!`. Requires `anodized_panic`. | | ||
|
|
||
| CI passes them as `cargo --config 'build.rustflags=["--cfg","anodized_panic"]' test`. Adding a | ||
| new flag means updating `check-cfg` in **both** `crates/anodized/Cargo.toml` and | ||
| `crates/anodized-macros/Cargo.toml`; `skill-tools` fails if the documented set drifts. | ||
|
|
||
| ## Commands | ||
|
|
||
| ```bash | ||
| cargo fmt --all -- --check | ||
| cargo clippy -p <crate> --all-targets -- -D warnings | ||
| cargo test -p anodized --tests --no-fail-fast | ||
| cargo test -p skill-tools --tests --no-fail-fast | ||
| cargo run -p skill-tools --bin skill-gen -- --write | ||
| ``` | ||
|
|
||
| ## Conventions | ||
|
|
||
| Clippy must be clean. **No `#[allow]`** — fix the cause, or delete the code. No `unwrap`, | ||
| `expect`, or `panic!` in production paths; propagate with `?`. Files stay under 500 lines. | ||
|
|
||
| Unit tests live in a sibling file, wired up with `#[cfg(test)] #[path = "x_tests.rs"] mod`. | ||
| Integration tests are one file per feature under `crates/anodized/tests/`. UI tests use | ||
| trybuild with `.stderr` goldens — regenerate with `TRYBUILD=overwrite`. `anodized-fmt` uses | ||
| golden fixtures under `tests/fixtures/`. | ||
|
|
||
| ## Editing the agent skill | ||
|
|
||
| `plugins/anodized/skills/anodized/` is a shipped artifact. | ||
|
|
||
| - Every ```` ```rust ```` block in it is compiled by `cargo test -p skill-tools`. So is every | ||
| block in `crates/anodized/REFERENCE.md`. | ||
| - The tables between `<!-- anodized:generated:... -->` markers are generated. Edit | ||
| `crates/skill-tools/src/generate.rs`, then run `skill-gen --write`. Do not hand-edit inside | ||
| the markers. | ||
| - Change a clause keyword, a qualifier, a `cfg` flag, or a macro error message and the tests | ||
| will name the document that needs updating. | ||
|
|
||
| Loop conditions are dropped before they reach the compiler, so "every block compiles" proves | ||
| nothing about their validity. Read them by eye. Both `struct` and `enum` conditions generate | ||
| a type-checked `Spec::predicate`; test that predicate or enforce it at a `Spec!(T)` function | ||
| boundary to check the invariant at runtime. | ||
|
|
||
| **No test covers meaning.** The coverage tests assert that a term *appears*; they cannot tell | ||
| whether the sentence around it is still true. Changing spec semantics requires a manual read | ||
| of `SKILL.md` and `reference.md`. This is the residual risk and it is not automatable. | ||
|
|
||
| ## Which documents are verified | ||
|
|
||
| | Document | Verified? | | ||
| | --- | --- | | ||
| | `crates/anodized/README.md` | Yes — doctested as crate rustdoc. | | ||
| | `crates/anodized/REFERENCE.md` | Examples only, via `skill-tools`. Prose is not. | | ||
| | The agent skill | Examples, tables, and runtime claims, via `skill-tools`. Prose is not. | | ||
|
|
||
| When they disagree, the skill and the README win. | ||
|
|
||
| ## Releasing | ||
|
|
||
| Bump, in one commit: `[workspace.package] version` and the `[workspace.dependencies]` | ||
| `anodized*` lines; the `anodized = "x.y.z"` snippet in `crates/anodized/README.md`; | ||
| `version` in `.claude-plugin/marketplace.json`, `plugins/anodized/.claude-plugin/plugin.json`, | ||
| and `plugins/anodized/.codex-plugin/plugin.json`; and `CHANGELOG.md`. | ||
|
|
||
| The plugin version is always the workspace version. `skill-tools` reads its own | ||
| `CARGO_PKG_VERSION` — which is the workspace version — and fails if a manifest disagrees, so a | ||
| mismatched plugin cannot be released. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| [package] | ||
| name = "skill-tools" | ||
| description = "Generates and validates the Anodized agent skill and its plugin manifests" | ||
| publish = false | ||
|
|
||
| version.workspace = true | ||
| edition.workspace = true | ||
| rust-version.workspace = true | ||
| license.workspace = true | ||
| repository.workspace = true | ||
|
|
||
| [dependencies] | ||
| anodized-core.workspace = true | ||
| serde_json = "1" | ||
|
|
||
| [dev-dependencies] | ||
| anodized.workspace = true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| //! Rewrites, or verifies, the generated tables in the Anodized agent skill. | ||
|
|
||
| use std::process::ExitCode; | ||
|
|
||
| use skill_tools::generate; | ||
|
|
||
| fn main() -> ExitCode { | ||
| let mode = std::env::args().nth(1); | ||
| match mode.as_deref() { | ||
| Some("--write") => run(write), | ||
| Some("--check") | None => run(check), | ||
| Some(other) => { | ||
| eprintln!("unknown argument `{other}`; expected `--write` or `--check`"); | ||
| ExitCode::FAILURE | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn run(action: fn() -> skill_tools::Result<bool>) -> ExitCode { | ||
| match action() { | ||
| Ok(true) => ExitCode::SUCCESS, | ||
| Ok(false) => ExitCode::FAILURE, | ||
| Err(error) => { | ||
| eprintln!("error: {error}"); | ||
| ExitCode::FAILURE | ||
| } | ||
| } | ||
| } | ||
|
|
||
| fn write() -> skill_tools::Result<bool> { | ||
| let changed = generate::write()?; | ||
| if changed.is_empty() { | ||
| println!("generated regions are already up to date"); | ||
| } else { | ||
| for file in changed { | ||
| println!("updated {file}"); | ||
| } | ||
| } | ||
| Ok(true) | ||
| } | ||
|
|
||
| fn check() -> skill_tools::Result<bool> { | ||
| let stale = generate::check()?; | ||
| if stale.is_empty() { | ||
| println!("generated regions are up to date"); | ||
| return Ok(true); | ||
| } | ||
| for region in stale { | ||
| eprintln!("stale generated region: {region}"); | ||
| } | ||
| eprintln!("run `cargo run -p skill-tools --bin skill-gen -- --write`"); | ||
| Ok(false) | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.