Sruja Project Skill
Procedural workflows for working with the Sruja architecture-as-code platform.
Project Overview
- Type: Rust workspace with 14 crates
- Primary language: Rust (core), TypeScript (extension)
- Architecture: Layered monolith with clear tier boundaries
Workflows
Adding a New Crate
Identify the tier for your crate:
- Core Engine (sruja-diagnostics, sruja-language, sruja-engine, sruja-export, sruja-scan, sruja-graph-core)
- Extraction (sruja-graph, sruja-extract)
- Delivery (sruja-cli, sruja-wasm)
- Secondary (sruja-diff, sruja-intent, sruja-agent, sruja-memory)
Add to workspace in root Cargo.toml:
[workspace]
members = ["crates/sruja-new-crate"]
Add dependencies in crates/sruja-new-crate/Cargo.toml
Update CLI if exposing new commands:
- Add command definition in
src/cli/commands.rs
- Add handler in
src/cli/run.rs
- Add to
src/commands/mod.rs
Validate:
cargo build --release
cargo test -p sruja-new-crate
cargo clippy -- -D warnings
Adding a New CLI Command
Define the command in src/cli/commands.rs:
#[command(name = "my-command")]
MyCommand {
#[arg(long = "repo", short = 'r', default_value = ".")]
repo: String,
},
Add handler in src/cli/run.rs:
Commands::MyCommand { repo } => {
commands::my_module::my_command(&repo)
}
Implement the command in src/commands/my_module.rs
Export in src/commands/mod.rs:
pub use my_module::my_command;
Test:
cargo test -p sruja-cli
./target/release/sruja my-command --help
Validating Architecture Changes
After any .sruja file change:
sruja lint repo.sruja
Check for drift:
sruja sync -r .
sruja drift -r .
Verify no layer violations:
sruja classify -r .
sruja drift -r . -a repo.sruja
Running Tests
# All tests
cargo test --workspace
# Specific crate
cargo test -p sruja-cli
# Single test
cargo test test_name
# With coverage
just test-coverage
Layer Boundaries
Respect these tier dependencies:
| Tier |
Crates |
Can Depend On |
| Core Engine |
sruja-diagnostics, sruja-language, sruja-engine, sruja-export, sruja-scan, sruja-graph-core |
Only core crates |
| Extraction |
sruja-graph, sruja-extract |
Core Engine |
| Delivery |
sruja-cli, sruja-wasm |
Core Engine, Extraction |
| Secondary |
sruja-diff, sruja-intent, sruja-agent, sruja-memory |
Core Engine, Extraction |
Forbidden Patterns
- Lower-tier crates must not depend on higher-tier crates
- sruja-cli is the top-level aggregator — no other crate should depend on it
- WASM-only crates must not use native-only APIs (tree-sitter, fastembed)
Progressive Discovery
| Task |
Load only |
| Add crate |
rules/add-crate.md |
| Add CLI command |
rules/add-cli-command.md |
| Validate changes |
rules/validate-changes.md |
| Run tests |
rules/run-tests.md |
| Common patterns |
rules/common-patterns.md |
| Anti-patterns |
rules/anti-patterns.md |
Auto-Capturing Knowledge
When users share conventions, patterns, or workflows in conversation, automatically record them using the existing sruja_record_learning MCP tool.
Detect these patterns:
- "Always do X", "Never do Y", "We use Z for..."
- "When you see X, do Y", "For X, use Y"
- "The convention is...", "The pattern is..."
Capture using MCP tool sruja_record_learning:
{
"context": "user convention: [brief description]",
"hypothesis": "the convention/pattern shared",
"outcome": "success",
"guardrail_advice": "how to apply this"
}
This creates an auto-learning loop without explicit user action.
Quick Start
Use sruja-project skill. Help me add a new crate to the workspace.
Versioning
Skills use CalVer: YYYY.MM.MICRO
- YYYY — Year
- MM — Month (01-12)
- MICRO — Patch increment within the month (1, 2, 3...)
Bump the version when:
- Adding new workflows or rules
- Changing existing behavior
- Fixing incorrect guidance
The version field in frontmatter is required for discoverability and compatibility checking.
1---2name: sruja-project3description: Procedural workflows for working with the Sruja codebase. Teaches AI editors how to add components, validate changes, and follow patterns.4license: Apache-2.05---67# Sruja Project Skill89Procedural workflows for working with the Sruja architecture-as-code platform.1011## Project Overview1213- **Type:** Rust workspace with 14 crates14- **Primary language:** Rust (core), TypeScript (extension)15- **Architecture:** Layered monolith with clear tier boundaries1617## Workflows1819### Adding a New Crate20211. **Identify the tier** for your crate:22 - **Core Engine** (sruja-diagnostics, sruja-language, sruja-engine, sruja-export, sruja-scan, sruja-graph-core)23 - **Extraction** (sruja-graph, sruja-extract)24 - **Delivery** (sruja-cli, sruja-wasm)25 - **Secondary** (sruja-diff, sruja-intent, sruja-agent, sruja-memory)26272. **Add to workspace** in root `Cargo.toml`:28 ```toml29 [workspace]30 members = ["crates/sruja-new-crate"]31 ```32333. **Add dependencies** in `crates/sruja-new-crate/Cargo.toml`34354. **Update CLI** if exposing new commands:36 - Add command definition in `src/cli/commands.rs`37 - Add handler in `src/cli/run.rs`38 - Add to `src/commands/mod.rs`39405. **Validate**:41 ```bash42 cargo build --release43 cargo test -p sruja-new-crate44 cargo clippy -- -D warnings45 ```4647### Adding a New CLI Command48491. **Define the command** in `src/cli/commands.rs`:50 ```rust51 #[command(name = "my-command")]52 MyCommand {53 #[arg(long = "repo", short = 'r', default_value = ".")]54 repo: String,55 },56 ```57582. **Add handler** in `src/cli/run.rs`:59 ```rust60 Commands::MyCommand { repo } => {61 commands::my_module::my_command(&repo)62 }63 ```64653. **Implement the command** in `src/commands/my_module.rs`66674. **Export** in `src/commands/mod.rs`:68 ```rust69 pub use my_module::my_command;70 ```71725. **Test**:73 ```bash74 cargo test -p sruja-cli75 ./target/release/sruja my-command --help76 ```7778### Validating Architecture Changes79801. **After any .sruja file change**:81 ```bash82 sruja lint repo.sruja83 ```84852. **Check for drift**:86 ```bash87 sruja sync -r .88 sruja drift -r .89 ```90913. **Verify no layer violations**:92 ```bash93 sruja classify -r .94 sruja drift -r . -a repo.sruja95 ```9697### Running Tests9899```bash100# All tests101cargo test --workspace102103# Specific crate104cargo test -p sruja-cli105106# Single test107cargo test test_name108109# With coverage110just test-coverage111```112113## Layer Boundaries114115Respect these tier dependencies:116117| Tier | Crates | Can Depend On |118|------|--------|---------------|119| **Core Engine** | sruja-diagnostics, sruja-language, sruja-engine, sruja-export, sruja-scan, sruja-graph-core | Only core crates |120| **Extraction** | sruja-graph, sruja-extract | Core Engine |121| **Delivery** | sruja-cli, sruja-wasm | Core Engine, Extraction |122| **Secondary** | sruja-diff, sruja-intent, sruja-agent, sruja-memory | Core Engine, Extraction |123124## Forbidden Patterns1251261. **Lower-tier crates must not depend on higher-tier crates**1272. **sruja-cli is the top-level aggregator** — no other crate should depend on it1283. **WASM-only crates must not use native-only APIs** (tree-sitter, fastembed)129130## Progressive Discovery131132| Task | Load only |133|------|-----------|134| Add crate | `rules/add-crate.md` |135| Add CLI command | `rules/add-cli-command.md` |136| Validate changes | `rules/validate-changes.md` |137| Run tests | `rules/run-tests.md` |138| Common patterns | `rules/common-patterns.md` |139| Anti-patterns | `rules/anti-patterns.md` |140141## Auto-Capturing Knowledge142143When users share conventions, patterns, or workflows in conversation, automatically record them using the existing `sruja_record_learning` MCP tool.144145**Detect these patterns:**146- "Always do X", "Never do Y", "We use Z for..."147- "When you see X, do Y", "For X, use Y"148- "The convention is...", "The pattern is..."149150**Capture using MCP tool `sruja_record_learning`:**151```json152{153 "context": "user convention: [brief description]",154 "hypothesis": "the convention/pattern shared",155 "outcome": "success",156 "guardrail_advice": "how to apply this"157}158```159160This creates an auto-learning loop without explicit user action.161162## Quick Start163164```165Use sruja-project skill. Help me add a new crate to the workspace.166```167168## Versioning169170Skills use CalVer: `YYYY.MM.MICRO`171172- **YYYY** — Year173- **MM** — Month (01-12)174- **MICRO** — Patch increment within the month (1, 2, 3...)175176Bump the version when:177- Adding new workflows or rules178- Changing existing behavior179- Fixing incorrect guidance180181The version field in frontmatter is required for discoverability and compatibility checking.