@pratikpsl/agent-skills 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +58 -22
  2. package/dist/cli/index.js +4 -3
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/core/ide-map.js +3 -3
  5. package/dist/core/ide-map.js.map +1 -1
  6. package/dist/core/install-template.d.ts +2 -2
  7. package/dist/core/install-template.d.ts.map +1 -1
  8. package/dist/core/install-template.js +124 -43
  9. package/dist/core/install-template.js.map +1 -1
  10. package/dist/core/resolve-template.d.ts.map +1 -1
  11. package/dist/core/resolve-template.js +1 -1
  12. package/dist/core/resolve-template.js.map +1 -1
  13. package/package.json +3 -1
  14. package/templates/default/instructions.md +9 -2
  15. package/templates/dotnet/AgentSkills/skills/index.md +14 -0
  16. package/templates/python/AgentSkills/agents/architect.md +13 -0
  17. package/templates/python/AgentSkills/agents/developer.md +23 -0
  18. package/templates/python/AgentSkills/skills/index.md +14 -0
  19. package/templates/python/AgentSkills/skills/performance/SKILL.md +26 -0
  20. package/templates/python/AgentSkills/skills/python-best-practices/SKILL.md +59 -0
  21. package/templates/python/AgentSkills/skills/python-typing/SKILL.md +42 -0
  22. package/templates/python/AgentSkills/skills/testing/SKILL.md +42 -0
  23. package/templates/react/AgentSkills/skills/index.md +13 -0
  24. package/templates/rust/AgentSkills/agents/architect.md +14 -0
  25. package/templates/rust/AgentSkills/agents/developer.md +24 -0
  26. package/templates/rust/AgentSkills/skills/index.md +14 -0
  27. package/templates/rust/AgentSkills/skills/performance/SKILL.md +43 -0
  28. package/templates/rust/AgentSkills/skills/rust-best-practices/SKILL.md +48 -0
  29. package/templates/rust/AgentSkills/skills/rust-ownership/SKILL.md +40 -0
  30. package/templates/rust/AgentSkills/skills/testing/SKILL.md +60 -0
  31. package/templates/shared/AgentSkills/OPERATING.md +2 -2
  32. package/templates/shared/AgentSkills/agents/{reviewer.agent.md → reviewer.md} +2 -0
  33. package/templates/shared/AgentSkills/skills/index.md +10 -0
  34. package/templates/shared/AgentSkills/skills/principles/SKILL.md +1 -1
  35. package/templates/shared/AgentSkills/skills/review/SKILL.md +33 -0
  36. package/templates/shared/AgentSkills/skills/standards/SKILL.md +12 -3
  37. package/templates/shared/entry-points/instructions.md +4 -3
  38. /package/templates/dotnet/AgentSkills/agents/{architect.agent.md → architect.md} +0 -0
  39. /package/templates/dotnet/AgentSkills/agents/{developer.agent.md → developer.md} +0 -0
  40. /package/templates/react/AgentSkills/agents/{developer.agent.md → developer.md} +0 -0
  41. /package/templates/shared/AgentSkills/agents/{architect.agent.md → architect.md} +0 -0
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: performance
3
+ description: Python profiling, generator patterns, async concurrency, and memory optimization.
4
+ ---
5
+
6
+ # Python Performance
7
+
8
+ ## Profiling First
9
+ - Measure before optimizing: use `cProfile`/`profile` for CPU and `memray` or `tracemalloc` for memory.
10
+ - Profile realistic workloads, not microbenchmarks, to find true hot paths.
11
+
12
+ ## Memory Efficiency
13
+ - Prefer generators and iterators (`yield`) over materializing full lists in memory for large data sets.
14
+ - Use `__slots__` on classes with many instances to eliminate per-instance `__dict__` overhead.
15
+ - Use `functools.lru_cache` or `functools.cache` for pure, referentially transparent functions called repeatedly with the same arguments.
16
+
17
+ ## Async Concurrency
18
+ - Use `asyncio.gather(*tasks)` or `asyncio.TaskGroup` for I/O-bound fan-out; avoid sequential `await` in a loop when tasks are independent.
19
+ - Use connection pools (e.g. `asyncpg` pool, `httpx.AsyncClient`) — never create a new connection per request.
20
+ - Offload CPU-bound work to a `ProcessPoolExecutor` via `loop.run_in_executor`; do not block the event loop.
21
+
22
+ ## Data & Algorithm Choices
23
+ - Use built-in types (`list`, `dict`, `set`) over third-party equivalents for simple cases; they are implemented in C.
24
+ - Use `collections.deque` for queue workloads; avoid `list.pop(0)` (O(n)).
25
+ - Avoid repeated string concatenation in loops; use `"".join(parts)` instead.
26
+ - Prefer comprehensions over `map`/`filter` with lambdas for readability and slight speed advantages.
@@ -0,0 +1,59 @@
1
+ ---
2
+ name: python-best-practices
3
+ description: >
4
+ Load when writing, reviewing, refactoring, or optimizing Python code.
5
+ Covers PEP conventions, uv project management, async patterns, error handling,
6
+ structured logging, and maintainability.
7
+ ---
8
+
9
+ # Python Best Practices
10
+
11
+ ## Naming Conventions (PEP 8)
12
+ - **Modules & packages**: `snake_case` (`user_service.py`, `auth/`)
13
+ - **Functions & variables**: `snake_case` (`get_user`, `is_valid`)
14
+ - **Classes**: `PascalCase` (`UserService`, `OrderRepository`)
15
+ - **Constants**: `UPPER_SNAKE_CASE` (`MAX_RETRIES`, `DEFAULT_TIMEOUT`)
16
+ - **Private members**: single underscore prefix (`_internal_helper`)
17
+ - **Dunder methods**: reserved for Python protocols (`__init__`, `__repr__`)
18
+
19
+ ## Project Setup with uv
20
+ ```bash
21
+ uv init my-project # scaffold pyproject.toml, src layout
22
+ uv add fastapi pydantic # add runtime dependencies
23
+ uv add --dev pytest mypy ruff # add dev dependencies
24
+ uv sync # install from uv.lock
25
+ uv run pytest # run commands in the managed venv
26
+ ```
27
+ - Always use `uv`; never run bare `pip install` against the global environment.
28
+ - Declare all metadata in `pyproject.toml` (`[project]`, `[build-system]`, tool configs).
29
+
30
+ ## Code Quality & Formatting
31
+ - Use `ruff` for linting and formatting (replaces `flake8`, `isort`, `black`).
32
+ - Enable `ruff` rules `E`, `F`, `I`, `UP`, `ANN` at minimum in `pyproject.toml`.
33
+ - Run `mypy --strict` in CI; no type errors are acceptable in production code.
34
+
35
+ ## Async & I/O
36
+ - Use `async`/`await` for all I/O-bound operations (HTTP, database, file, queue).
37
+ - Never call blocking functions (`time.sleep`, `open()`, sync DB calls) inside an async context; use their async equivalents.
38
+ - Use `asyncio.TaskGroup` (Python 3.11+) for structured concurrent tasks.
39
+ - Propagate `asyncio.CancelledError`; never catch it without re-raising.
40
+
41
+ ## Error Handling
42
+ - Define domain-specific exception classes inheriting from a project base (`AppError`).
43
+ - Catch the narrowest exception type possible; never use bare `except:` or `except Exception:` without logging and re-raising.
44
+ - Use `contextlib.suppress` only for explicitly expected, recoverable errors.
45
+
46
+ ## Logging
47
+ - Use structured logging (`structlog` or `logging` with a JSON formatter) — never `print()` in production code.
48
+ - Bind contextual fields (request IDs, user IDs) to the logger at request scope.
49
+ - Never log secrets, tokens, passwords, or PII.
50
+
51
+ ## Review Checklist
52
+ - [ ] All names follow PEP 8 conventions.
53
+ - [ ] `uv` used for dependency management; `pyproject.toml` up to date.
54
+ - [ ] No bare `pip install` or unpinned dependencies.
55
+ - [ ] `ruff` passes with zero errors.
56
+ - [ ] `mypy --strict` passes with zero errors.
57
+ - [ ] No blocking calls inside `async` functions.
58
+ - [ ] Structured logging used; no `print()` statements remain.
59
+ - [ ] Narrow exception handling; no silent swallowing of errors.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: python-typing
3
+ description: >
4
+ Load when writing or reviewing Python code. Covers strict static typing with mypy/pyright,
5
+ pydantic data models, Protocol, TypeVar, Literal, and TypedDict patterns.
6
+ ---
7
+
8
+ # Python Static Typing
9
+
10
+ ## Module Setup
11
+ - Add `from __future__ import annotations` as the first import in every module to enable postponed evaluation of annotations (PEP 563).
12
+ - Enable strict mode in `pyproject.toml`:
13
+ ```toml
14
+ [tool.mypy]
15
+ strict = true
16
+ warn_return_any = true
17
+ disallow_untyped_defs = true
18
+ ```
19
+
20
+ ## Function & Variable Annotations
21
+ - Annotate every function parameter, return type, and class attribute without exception.
22
+ - Use `None` as an explicit return type for functions that return nothing; never omit the annotation.
23
+ - Avoid `Any` — use `object` for truly unknown types, or narrow with generics and `TypeVar`.
24
+
25
+ ## Type Constructs
26
+ - **`TypeAlias`**: Use `type Alias = ...` (Python 3.12+) or `TypeAlias` from `typing` for readable compound types.
27
+ - **`Protocol`**: Prefer structural subtyping (`Protocol`) over ABCs for dependency injection and testability.
28
+ - **`TypeVar` / `ParamSpec`**: Use for generic functions and decorators; constrain with `bound=` where applicable.
29
+ - **`Literal`**: Use `Literal["value"]` to narrow string/int constants in type signatures.
30
+ - **`TypedDict`**: Use for dict shapes at external boundaries (JSON, config); prefer `pydantic.BaseModel` for mutable internal models.
31
+
32
+ ## Pydantic Models
33
+ - Define all data contracts as `pydantic.BaseModel` subclasses; never pass raw `dict` across layer boundaries.
34
+ - Use `model_config = ConfigDict(frozen=True)` for immutable value objects.
35
+ - Validate external inputs at the outermost boundary (API, CLI, queue consumer) before passing into application logic.
36
+
37
+ ## Review Checklist
38
+ - [ ] `from __future__ import annotations` present in every module.
39
+ - [ ] No `Any` without a documented justification comment.
40
+ - [ ] All function signatures fully annotated (parameters + return).
41
+ - [ ] Pydantic models used at all data boundaries.
42
+ - [ ] `mypy --strict` passes with zero errors.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: testing
3
+ description: Python unit, async, and property-based testing with pytest, pytest-asyncio, and hypothesis.
4
+ ---
5
+
6
+ # Python Testing
7
+
8
+ ## Testing Principles
9
+ - Test observable behavior and public interfaces, not internal implementation details.
10
+ - Follow the **Arrange-Act-Assert (AAA)** pattern in every test.
11
+ - Keep tests isolated, deterministic, and independent of execution order or external state.
12
+
13
+ ## Project Setup
14
+ - Use `pytest` as the sole test runner; install via `uv add --dev pytest pytest-asyncio pytest-mock hypothesis`.
15
+ - Configure in `pyproject.toml`:
16
+ ```toml
17
+ [tool.pytest.ini_options]
18
+ asyncio_mode = "auto"
19
+ ```
20
+ - Run tests with `uv run pytest`.
21
+
22
+ ## Test Naming & Structure
23
+ - Name test files `test_<module>.py` and place them under a top-level `tests/` directory mirroring the `src/` layout.
24
+ - Name test functions: `test_<function>_<scenario>_<expected>` (e.g., `test_create_user_duplicate_email_raises_conflict`).
25
+ - Match test class names to the class under test: `TestUserService` for `UserService`.
26
+
27
+ ## Fixtures & Parametrize
28
+ - Use `@pytest.fixture` for shared setup; prefer function-scoped fixtures unless sharing is explicitly required.
29
+ - Use `@pytest.mark.parametrize` for data-driven cases covering multiple inputs and edge cases.
30
+ - Mock external I/O boundaries (HTTP, DB, file system) using `pytest-mock` (`mocker.patch`) — never hit real services in unit tests.
31
+
32
+ ## Async Testing
33
+ - Annotate async test functions with `async def`; `asyncio_mode = "auto"` removes the need for `@pytest.mark.asyncio`.
34
+ - Use `AsyncMock` from `unittest.mock` to mock async callables and coroutines.
35
+
36
+ ## Property-Based Testing
37
+ - Use `hypothesis` for algorithmic and data-parsing logic where exhaustive edge-case enumeration is impractical.
38
+ - Define `@given(st.text(), st.integers())` strategies; always run with a fixed `settings(max_examples=200)` in CI.
39
+
40
+ ## Coverage & Quality
41
+ - Target 100% coverage on domain and application layers; exclude infrastructure adapters only with justification.
42
+ - Run `uv run pytest --cov=src --cov-report=term-missing` in CI.
@@ -0,0 +1,13 @@
1
+ # Skills Index
2
+
3
+ Consult this index to load only the skills relevant to the current task.
4
+
5
+ | Skill | Path | Description / When to Load |
6
+ | --- | --- | --- |
7
+ | principles | AgentSkills/skills/principles/SKILL.md | Foundational simplicity ladder, KISS, YAGNI, surgical changes |
8
+ | standards | AgentSkills/skills/standards/SKILL.md | Code quality, 50-line limits, shallow nesting, clean signatures |
9
+ | security | AgentSkills/skills/security/SKILL.md | Input validation, secrets handling, safe queries, least privilege |
10
+ | review | AgentSkills/skills/review/SKILL.md | Code review framework, five review dimensions, verification rules |
11
+ | react-typescript | AgentSkills/skills/react-typescript/SKILL.md | React & TypeScript props typing, custom hooks, discriminated unions |
12
+ | testing | AgentSkills/skills/testing/SKILL.md | Vitest & React Testing Library, user-event, test coverage |
13
+ | performance | AgentSkills/skills/performance/SKILL.md | Render optimization, lazy loading, state colocation, memoization |
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: architect
3
+ description: Rust workspace design, crate boundaries, trait-based API design, and visibility rules.
4
+ ---
5
+
6
+ # Rust Architect
7
+
8
+ ## Architectural Principles
9
+ - **Workspace Layout**: Use a Cargo workspace (`[workspace]` in root `Cargo.toml`) to separate concerns: e.g. `crates/domain`, `crates/api`, `crates/infra`, `crates/cli`. Each crate has one responsibility.
10
+ - **Visibility Minimization**: Default to `pub(crate)` for intra-workspace sharing; expose items as `pub` only when they form the deliberate public API of the crate.
11
+ - **Trait-Based Design**: Define behavior through traits; depend on trait abstractions (not concrete types) at crate boundaries to enable testing and future substitution without coupling.
12
+ - **Contract-First**: Define data types (`struct`, `enum`) and trait interfaces before implementing business logic. Types are the primary design artifact.
13
+ - **Dependency Direction**: Application crates depend on domain crates; infrastructure crates depend on application traits; no domain crate imports from infrastructure.
14
+ - **Genuine Reusability**: Extract shared code into a library crate only when two or more crates genuinely share the same logic. Avoid premature abstraction (YAGNI).
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: developer
3
+ description: Rust feature implementation, ownership, async with tokio, and idiomatic error propagation.
4
+ ---
5
+
6
+ # Rust Developer
7
+
8
+ ## Implementation Principles
9
+ - **Ownership First**: Design types and function signatures to express ownership intent clearly. Prefer borrowing (`&T`, `&mut T`) over cloning in hot paths; clone only when ownership transfer is genuinely required.
10
+ - **Idiomatic Error Handling**: Use `Result<T, E>` and propagate errors with `?`. Never `unwrap()` or `expect()` in production code paths — reserve them for tests and infallible cases with a comment explaining why.
11
+ - **Zero-Cost Abstractions**: Prefer traits over dynamic dispatch (`Box<dyn Trait>`) unless runtime polymorphism is a firm requirement. Use generics for static dispatch.
12
+ - **Complexity Limits**: Keep functions under 50 lines; maximum 2 levels of nesting; use early `return` or `?` to flatten control flow.
13
+ - **No Magic Literals**: Replace all magic numbers and strings with named constants (`const`) or `enum` variants.
14
+
15
+ ## Tooling Discipline
16
+ - Format every file with `rustfmt` before committing (`cargo fmt`).
17
+ - Fix all `clippy` warnings before committing (`cargo clippy -- -D warnings`).
18
+ - Use `cargo check` as the fast feedback loop during development.
19
+
20
+ ## Async & Concurrency
21
+ - Use `tokio` as the async runtime for all I/O-bound work.
22
+ - Annotate async entry points and test functions with `#[tokio::main]` and `#[tokio::test]`.
23
+ - Use `tokio::spawn` for independent concurrent tasks; use `tokio::join!` or `tokio::try_join!` to await multiple tasks.
24
+ - Protect shared mutable state with `Arc<Mutex<T>>` or `Arc<RwLock<T>>`; prefer message-passing (`tokio::sync::mpsc`) over shared state where possible.
@@ -0,0 +1,14 @@
1
+ # Skills Index
2
+
3
+ Consult this index to load only the skills relevant to the current task.
4
+
5
+ | Skill | Path | Description / When to Load |
6
+ | --- | --- | --- |
7
+ | principles | AgentSkills/skills/principles/SKILL.md | Foundational simplicity ladder, KISS, YAGNI, surgical changes |
8
+ | standards | AgentSkills/skills/standards/SKILL.md | Code quality, 50-line limits, shallow nesting, clean signatures |
9
+ | security | AgentSkills/skills/security/SKILL.md | Input validation, secrets handling, safe queries, least privilege |
10
+ | review | AgentSkills/skills/review/SKILL.md | Code review framework, five review dimensions, verification rules |
11
+ | rust-best-practices | AgentSkills/skills/rust-best-practices/SKILL.md | API guidelines, cargo clippy/fmt, thiserror/anyhow, tracing logging |
12
+ | rust-ownership | AgentSkills/skills/rust-ownership/SKILL.md | Ownership, borrowing, lifetimes, Arc/Mutex, Send+Sync safety |
13
+ | testing | AgentSkills/skills/testing/SKILL.md | cargo test, tokio::test, proptest property testing, mockall |
14
+ | performance | AgentSkills/skills/performance/SKILL.md | criterion benchmarking, zero-copy parsing, allocation reduction |
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: performance
3
+ description: Rust benchmarking with criterion, zero-copy design, allocation reduction, and async task efficiency.
4
+ ---
5
+
6
+ # Rust Performance
7
+
8
+ ## Measure First
9
+ - Profile before optimizing: use `criterion` for micro-benchmarks and `cargo flamegraph` (or `perf`) for real workload profiling.
10
+ - Compile with `--release` for all performance measurements; debug builds have no optimizations.
11
+
12
+ ## Allocation & Copy Reduction
13
+ - Prefer borrowing (`&str`, `&[T]`) over owned types (`String`, `Vec<T>`) in hot paths; clone only when ownership transfer is necessary.
14
+ - Use `Cow<'_, str>` to defer allocation until a mutation is actually needed.
15
+ - Use `SmallVec` or fixed-size arrays for collections that are almost always small.
16
+ - Avoid boxing (`Box<T>`) in hot paths; prefer stack allocation for small, fixed-size types.
17
+
18
+ ## Zero-Copy Parsing
19
+ - Use `bytes::Bytes` and slicing for zero-copy network data parsing.
20
+ - Avoid intermediate `String` allocations when parsing structured data; work with `&[u8]` slices directly where possible.
21
+
22
+ ## Async Task Efficiency
23
+ - Minimize the number of `tokio::spawn` calls; spawning is cheap but not free — batch work where possible.
24
+ - Avoid holding `Mutex` guards across `.await` points; release before yielding.
25
+ - Use `tokio::sync::watch` or `tokio::sync::broadcast` for fan-out notifications instead of multiple `Mutex`-protected `Vec` callbacks.
26
+
27
+ ## Iterator Pipelines
28
+ - Use lazy iterator adapters (`map`, `filter`, `flat_map`) over imperative loops; the compiler optimizes chains to a single pass.
29
+ - Prefer `collect::<Vec<_>>()` once at the end of a pipeline rather than intermediate materialization.
30
+ - Use `par_iter()` from `rayon` for CPU-bound parallel data processing — only after profiling confirms a bottleneck.
31
+
32
+ ## Benchmarking
33
+ ```rust
34
+ use criterion::{criterion_group, criterion_main, Criterion};
35
+
36
+ fn bench_parse(c: &mut Criterion) {
37
+ c.bench_function("parse_record", |b| b.iter(|| parse(INPUT)));
38
+ }
39
+
40
+ criterion_group!(benches, bench_parse);
41
+ criterion_main!(benches);
42
+ ```
43
+ Run with `cargo bench`.
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: rust-best-practices
3
+ description: >
4
+ Load when writing, reviewing, refactoring, or optimizing Rust code.
5
+ Covers naming conventions, clippy/rustfmt enforcement, error handling with
6
+ thiserror/anyhow, structured logging with tracing, and Cargo workspace layout.
7
+ ---
8
+
9
+ # Rust Best Practices
10
+
11
+ ## Naming Conventions (Rust API Guidelines)
12
+ - **Types & Traits**: `PascalCase` (`UserRepository`, `Deserialize`)
13
+ - **Functions, methods, variables, modules**: `snake_case` (`get_user`, `user_service`)
14
+ - **Constants & statics**: `UPPER_SNAKE_CASE` (`MAX_CONNECTIONS`, `DEFAULT_TIMEOUT`)
15
+ - **Lifetime parameters**: short lowercase single letters (`'a`, `'db`)
16
+ - **Crates**: `snake_case` for library crates, `kebab-case` in `Cargo.toml` names
17
+
18
+ ## Tooling Discipline
19
+ - **Format**: `cargo fmt` — enforce in CI with `cargo fmt --check`.
20
+ - **Lint**: `cargo clippy -- -D warnings` — all warnings are errors in CI; suppress individually only with a comment explaining the justification.
21
+ - **Audit**: `cargo audit` — run in CI to catch known vulnerabilities in dependencies.
22
+ - **Build**: `cargo check` for fast feedback; `cargo build --release` for benchmarks and deployment.
23
+
24
+ ## Error Handling
25
+ - Use `thiserror` to define typed, domain-specific errors for library crates.
26
+ - Use `anyhow` for application-level error aggregation and context chaining (`context()`, `with_context()`).
27
+ - Never use `unwrap()` or `expect()` in production paths; propagate with `?`.
28
+ - Return `Result<T, E>` from all fallible functions; reserve `panic!` for truly unrecoverable programmer errors.
29
+
30
+ ## Logging & Observability
31
+ - Use `tracing` for structured, async-aware logging: `tracing::info!`, `tracing::error!`, `tracing::instrument`.
32
+ - Attach contextual fields with `#[tracing::instrument(fields(user_id = %id))]`.
33
+ - Initialize the subscriber once at the application entry point (`tracing_subscriber::fmt::init()`).
34
+ - Never log secrets, tokens, passwords, or sensitive personal data.
35
+
36
+ ## Dependency Management
37
+ - Minimize external dependencies; evaluate the maintenance status and license before adding a new crate.
38
+ - Add dev-only dependencies under `[dev-dependencies]` in `Cargo.toml`.
39
+ - Use feature flags to keep the dependency graph lean (`default-features = false`).
40
+
41
+ ## Review Checklist
42
+ - [ ] `cargo fmt --check` passes.
43
+ - [ ] `cargo clippy -- -D warnings` passes with zero warnings.
44
+ - [ ] No `unwrap()` / `expect()` in non-test production code.
45
+ - [ ] `thiserror` used for library errors; `anyhow` for application errors.
46
+ - [ ] Structured `tracing` logging used; no `println!` in production.
47
+ - [ ] `cargo audit` passes; no known vulnerabilities.
48
+ - [ ] All public API items documented with `///` doc comments.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: rust-ownership
3
+ description: >
4
+ Load when writing or reviewing Rust code. Covers ownership, borrowing, lifetimes,
5
+ shared-state concurrency with Arc/Mutex, and Send + Sync safety.
6
+ ---
7
+
8
+ # Rust Ownership & Borrowing
9
+
10
+ ## Core Rules
11
+ - A value has exactly one owner at a time; ownership transfers on move.
12
+ - Borrow immutably (`&T`) as many times as needed, or mutably (`&mut T`) exactly once — never both simultaneously.
13
+ - References must never outlive the value they point to; the compiler enforces this via lifetimes.
14
+
15
+ ## Lifetime Annotations
16
+ - Add explicit lifetime annotations (`'a`) only when the compiler cannot infer them — let elision work first.
17
+ - For structs that hold references, annotate struct lifetime parameters and bound them on the relevant fields.
18
+ - Prefer owned types (`String`, `Vec<T>`) over references in public APIs to avoid lifetime propagation into callers.
19
+
20
+ ## Shared State
21
+ - Use `Arc<Mutex<T>>` for shared mutable state across threads; use `Arc<RwLock<T>>` when reads dominate.
22
+ - Lock mutexes for the shortest scope possible; never hold a lock across an `.await` point.
23
+ - Prefer message-passing (`tokio::sync::mpsc`, `std::sync::mpsc`) over shared state when tasks are naturally producer/consumer.
24
+
25
+ ## Send & Sync
26
+ - Ensure types shared across thread boundaries implement `Send + Sync`; the compiler enforces this.
27
+ - Avoid `Rc<T>` and `Cell<T>` in async or multi-threaded contexts; use `Arc` and `Mutex` instead.
28
+ - Use `#[derive(Clone)]` sparingly on types that are expensive to clone; document where clones occur.
29
+
30
+ ## Common Pitfalls
31
+ - Never use `unwrap()` or `expect()` in production paths — propagate errors with `?` instead.
32
+ - Avoid `clone()` as a workaround for borrow-checker conflicts; restructure ownership or use a reference instead.
33
+ - Do not hold a `MutexGuard` across an `await` point — drop it explicitly before awaiting.
34
+
35
+ ## Review Checklist
36
+ - [ ] No `unwrap()` / `expect()` in non-test production code.
37
+ - [ ] No `clone()` used to paper over borrow-checker issues.
38
+ - [ ] Explicit lifetime annotations present only where elision fails.
39
+ - [ ] `Mutex` guards released before any `.await` points.
40
+ - [ ] `Arc<Mutex<T>>` used for all cross-thread mutable state.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: testing
3
+ description: Rust unit, async, integration, and property-based testing with cargo test, tokio::test, and proptest.
4
+ ---
5
+
6
+ # Rust Testing
7
+
8
+ ## Testing Principles
9
+ - Test observable behavior through public interfaces, not internal implementation details.
10
+ - Follow the **Arrange-Act-Assert (AAA)** pattern in every test.
11
+ - Keep tests isolated, deterministic, and independent of execution order or external state.
12
+
13
+ ## Unit Tests
14
+ - Place unit tests in the same file as the code under test inside a `#[cfg(test)]` module:
15
+ ```rust
16
+ #[cfg(test)]
17
+ mod tests {
18
+ use super::*;
19
+
20
+ #[test]
21
+ fn create_user_valid_input_returns_ok() {
22
+ // Arrange / Act / Assert
23
+ }
24
+ }
25
+ ```
26
+ - Use descriptive names: `fn <function>_<scenario>_<expected>`.
27
+
28
+ ## Async Tests
29
+ - Use `#[tokio::test]` for async test functions:
30
+ ```rust
31
+ #[tokio::test]
32
+ async fn fetch_user_not_found_returns_error() { ... }
33
+ ```
34
+ - Mock async I/O boundaries with `mockall` (`#[automock]`) — never hit real services in unit tests.
35
+
36
+ ## Integration Tests
37
+ - Place integration tests in the top-level `tests/` directory; each file is a separate test binary.
38
+ - Use `common/mod.rs` (or `common.rs`) under `tests/` for shared test helpers and fixtures.
39
+ - Run with `cargo test --test <name>`.
40
+
41
+ ## Property-Based Testing
42
+ - Use `proptest` for algorithmic and parsing logic where exhaustive edge-case enumeration is impractical.
43
+ ```rust
44
+ proptest! {
45
+ #[test]
46
+ fn parse_roundtrip(s in "\\PC*") { ... }
47
+ }
48
+ ```
49
+
50
+ ## Mocking
51
+ - Use `mockall` to generate mocks for traits: annotate the trait with `#[automock]` and import `MockMyTrait` in tests.
52
+ - Verify expectations explicitly with `.expect(n)` or `.times(n)` on mock methods.
53
+
54
+ ## Running Tests
55
+ ```bash
56
+ cargo test # all tests
57
+ cargo test --lib # unit tests only
58
+ cargo test --test integration # integration tests only
59
+ cargo test -- --nocapture # show stdout during tests
60
+ ```
@@ -2,10 +2,10 @@
2
2
 
3
3
  ## Workflow
4
4
  1. **Memory & Context**: Read `AgentSkills/memory/index.md` (create if missing); load only relevant domain lessons to avoid repeating past mistakes.
5
- 2. **Role & Skill Discovery**: Load relevant role guidance from `AgentSkills/agents/` and skills from `AgentSkills/skills/`.
5
+ 2. **Role & Skill Discovery**: Consult `AgentSkills/skills/index.md` to identify and load task-specific skills from `AgentSkills/skills/` (including `AgentSkills/skills/review/SKILL.md`). Load relevant role guidance from `AgentSkills/agents/` (`architect.md`, `reviewer.md`, `developer.md`).
6
6
  3. **Pre-flight Inspection**: Inspect current codebase patterns, dependencies, and baseline build/test state.
7
7
  4. **Surgical Implementation**: Apply the minimal change required; adhere strictly to DRY, KISS, and YAGNI.
8
- 5. **Verification**: Run the project's build and test commands (e.g. `npm test`, `dotnet test`, or project test suite) to verify happy paths and edge cases.
8
+ 5. **Verification**: Run the project's build and test commands (e.g. `npm test`, `dotnet test`, `cargo test`, `uv run pytest`, or project test suite) to verify happy paths and edge cases per `AgentSkills/skills/review/SKILL.md`.
9
9
  6. **Learning Loop**: If a mistake was made and corrected or a durable rule discovered, record a concise lesson in `AgentSkills/memory/lessons/<domain>.md` and update `index.md`.
10
10
 
11
11
  ## Completion Checklist
@@ -11,6 +11,7 @@ Universal review guidance for AI agents and human reviewers across all stacks. S
11
11
  - **Principles**: Adhere strictly to `AgentSkills/skills/principles/SKILL.md`.
12
12
  - **Standards**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md`.
13
13
  - **Security**: Adhere strictly to `AgentSkills/skills/security/SKILL.md`.
14
+ - **Review**: Adhere strictly to `AgentSkills/skills/review/SKILL.md`.
14
15
 
15
16
  ## Verification & Automated Checks
16
17
  - [ ] **Clean Build**
@@ -22,6 +23,7 @@ Universal review guidance for AI agents and human reviewers across all stacks. S
22
23
  - [ ] **Principles**: `AgentSkills/skills/principles/SKILL.md`
23
24
  - [ ] **Standards**: `AgentSkills/skills/standards/SKILL.md`
24
25
  - [ ] **Security**: `AgentSkills/skills/security/SKILL.md`
26
+ - [ ] **Review**: `AgentSkills/skills/review/SKILL.md`
25
27
 
26
28
  ## Memory & Learning Loop
27
29
  - [ ] **Agent Memory**: `AgentSkills/memory/index.md`
@@ -0,0 +1,10 @@
1
+ # Skills Index
2
+
3
+ Consult this index to load only the skills relevant to the current task.
4
+
5
+ | Skill | Path | Description / When to Load |
6
+ | --- | --- | --- |
7
+ | principles | AgentSkills/skills/principles/SKILL.md | Foundational simplicity ladder, KISS, YAGNI, surgical changes |
8
+ | standards | AgentSkills/skills/standards/SKILL.md | Code quality, 50-line limits, shallow nesting, clean signatures |
9
+ | security | AgentSkills/skills/security/SKILL.md | Input validation, secrets handling, safe queries, least privilege |
10
+ | review | AgentSkills/skills/review/SKILL.md | Code review framework, five review dimensions, verification rules |
@@ -28,4 +28,4 @@ Bug fix = root cause, not symptom. A bug report names a symptom. Grep every call
28
28
  - **Surgical Changes**: Make the smallest change that satisfies the request; touch only what is explicitly required.
29
29
  - **Simplicity First (KISS / YAGNI)**: Favor simple, clear, maintainable solutions over clever abstractions. Do not add unrequested features.
30
30
  - **Zero-Error Builds**: Every change must compile cleanly and pass existing and newly added tests.
31
- - **Standards & Security**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md` and `AgentSkills/skills/security/SKILL.md`.
31
+ - **Standards, Security & Review**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md`, `AgentSkills/skills/security/SKILL.md`, and `AgentSkills/skills/review/SKILL.md`.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: review
3
+ description: Code review framework, verification criteria, correctness, and review output standards.
4
+ ---
5
+
6
+ # Code Review Guidelines
7
+
8
+ Universal review framework and verification standards for AI agents and human reviewers across all stacks.
9
+
10
+ ## Five Review Dimensions
11
+ 1. **Correctness**: Verify behavior matches specifications, handle boundary/edge cases (null, empty, limits, errors), and ensure changes are free of race conditions.
12
+ 2. **Readability**: Ensure naming is domain-meaningful, control flow is simple (depth <= 2), and functions do not exceed 50 lines.
13
+ 3. **Architecture**: Adhere to SOLID, DRY, and KISS; keep clean module boundaries; avoid circular dependencies and speculative abstractions (YAGNI).
14
+ 4. **Security**: Validate untrusted inputs, use parameterized queries, never commit or log credentials/PII, and check for safe error handling.
15
+ 5. **Performance**: Avoid N+1 queries, unbounded loops, blocking operations in async flows, and redundant re-computations.
16
+
17
+ ## Verification & Automated Checks
18
+ - [ ] **Clean Build**: Project builds cleanly with zero errors or warnings.
19
+ - [ ] **Zero Lint Errors**: Code adheres to project formatting and static analysis rules.
20
+ - [ ] **Tests Pass**: Run test suite; all existing and newly added tests must pass.
21
+ - [ ] **Test Robustness**: Tests must cover failure paths, edge cases, and boundary conditions, not just happy paths.
22
+
23
+ ## Review Output Format
24
+ Categorize every review finding clearly:
25
+ - **Critical**: Must fix before merge (security flaw, data corruption, broken functionality).
26
+ - **Important**: Should fix before merge (missing test coverage, poor error recovery, rule violation).
27
+ - **Suggestion**: Optional improvements (naming, non-critical refactoring).
28
+
29
+ ## Review Rules
30
+ - Review tests first to understand intent and coverage.
31
+ - Address root causes over symptoms; fix shared logic once rather than patching callers.
32
+ - Never weaken, skip, or delete existing tests to force a pass.
33
+ - Provide concrete, actionable fixes for every Critical and Important finding.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: standards
3
- description: Core code quality, complexity limits, naming, and structural conventions.
3
+ description: Core code quality, simplicity, complexity limits, naming, and structural conventions.
4
4
  ---
5
5
 
6
6
  # Code Standards
@@ -11,11 +11,20 @@ description: Core code quality, complexity limits, naming, and structural conven
11
11
  - **Clean Signatures**: Maximum 4 parameters per function; use an options object or record for complex signatures.
12
12
 
13
13
  ## Design & Clean Code
14
- - **SOLID / DRY / KISS**: Single-responsibility components; eliminate duplicated logic; prefer clear, direct implementations over speculative abstractions (YAGNI).
14
+ - **Simplicity First (KISS / YAGNI)**: Favor simple, clear, maintainable solutions over clever abstractions. Do not add unrequested features.
15
+ - **SOLID / DRY**: Single-responsibility components; eliminate duplicated logic; prefer clear, direct implementations over speculative abstractions (YAGNI).
16
+ - **Less is more**: Avoid over-engineering; prefer fewer moving parts and simpler designs.
17
+ - **Consistent Style**: Follow the repository's style guide; use linters and formatters to enforce consistency.
18
+ - **Configuration & Defaults**: Provide sensible defaults and configuration options; avoid hardcoding values.
19
+ - **separation of Concerns**: Keep business logic, data access, and presentation layers distinct; avoid mixing responsibilities.
20
+ - **Modular Design**: Break down large components into smaller, reusable modules; prefer composition over inheritance.
21
+ - **Dependency Management**: Minimize external dependencies; prefer standard libraries and well-maintained packages; avoid unnecessary bloat.
22
+ - **self-Documenting Code**: Write code that is clear and understandable without excessive comments; use meaningful names and expressive constructs.
23
+ - **security & Privacy**: Follow best practices for secure coding; validate inputs, sanitize outputs, and protect sensitive data.
15
24
  - **Naming & Clarity**: Use descriptive, domain-meaningful names for classes, functions, and variables.
16
25
  - **No Magic Literals**: Replace magic numbers and strings with named constants or enums.
17
26
  - **Contracts & Schemas**: Design explicit, human- and machine-readable data contracts, schemas, and self-describing APIs.
18
- - **Intentional Comments**: Comment only where non-obvious rationale is required, never restate what the code itself expresses.
27
+ - **Intentional Comments**: Comment only where non-obvious rationale is required, never restate what the code itself expresses. Comments should explain "why" not "what". CODE SHOULD BE SELF-DESCRIBING.
19
28
 
20
29
  ## Concurrency & Safety
21
30
  - **Async Safety**: Use idiomatic non-blocking `async`/`await`; ensure operations are free of race conditions and deadlocks.
@@ -3,23 +3,24 @@
3
3
  > Operating instructions and engineering guidelines for AI agents and human contributors.
4
4
 
5
5
  ## Operating Contract
6
- Always follow `AgentSkills/OPERATING.md` before making changes. Review relevant agent personas in `AgentSkills/agents/` and skills in `AgentSkills/skills/`.
6
+ Always follow `AgentSkills/OPERATING.md` before making changes. Consult `AgentSkills/skills/index.md` to load task-relevant skills (including `AgentSkills/skills/review/SKILL.md`), and review relevant agent personas in `AgentSkills/agents/` (`architect.md`, `reviewer.md`, `developer.md`).
7
7
 
8
8
  ## Goal
9
9
  Implement requested changes with production-quality code, preserving existing behavior and
10
10
  minimizing the diff, following the project's own architecture, standards, and conventions.
11
11
 
12
12
  ## Core Principles
13
- - **Core Principles**: Adhere strictly to `AgentSkills/skills/principles/SKILL.md`.
13
+ - **Principles**: Adhere strictly to `AgentSkills/skills/principles/SKILL.md`.
14
14
  - **Standards**: Adhere strictly to `AgentSkills/skills/standards/SKILL.md`.
15
15
  - **Security**: Adhere strictly to `AgentSkills/skills/security/SKILL.md`.
16
+ - **Review**: Adhere strictly to `AgentSkills/skills/review/SKILL.md`.
16
17
  - **Think Before Coding**: Thoroughly understand requirements. If ambiguous, ask before guessing.
17
18
  - **Surgical Changes**: Make the smallest change that satisfies the request; touch only what is explicitly required.
18
19
  - **Simplicity First (KISS / YAGNI)**: Favor simple, clear, maintainable solutions over clever abstractions. Do not add unrequested features.
19
20
  - **Zero-Error Builds**: Every change must compile cleanly and pass existing and newly added tests.
20
21
 
21
22
  ## Definition of Done
22
- - Builds cleanly and all tests pass without errors or warnings.
23
+ - Builds cleanly without any errors.
23
24
  - No debug code, dead code, unused imports, or temporary files left behind.
24
25
  - Changes are minimal, focused, covered by tests, and easy to review.
25
26