skills/abdelstark/testing/SKILL.md
Comprehensive testing strategies for Guts including unit tests, integration tests, property-based testing, and fuzzing
npx skillsauth add aiskillstore/marketplace testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are writing tests for a distributed system that requires high reliability.
/\
/ \ E2E Tests (few)
/ \ Integration Tests (some)
/ \ Unit Tests (many)
/________\ Property Tests (extensive)
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
// Group related tests
mod repository_tests {
use super::*;
#[test]
fn create_repository_success() {
let repo = Repository::new("test-repo");
assert_eq!(repo.name(), "test-repo");
}
#[test]
fn create_repository_invalid_name() {
let result = Repository::new("");
assert!(matches!(result, Err(RepositoryError::InvalidName(_))));
}
}
}
#[tokio::test]
async fn async_operation_completes() {
let service = TestService::new().await;
let result = tokio::time::timeout(
Duration::from_secs(5),
service.long_running_operation(),
)
.await;
assert!(result.is_ok());
}
// tests/common/mod.rs
pub struct TestNode {
pub node: Node,
pub temp_dir: TempDir,
}
impl TestNode {
pub async fn new() -> Self {
let temp_dir = TempDir::new().unwrap();
let config = Config::test_default(temp_dir.path());
let node = Node::new(config).await.unwrap();
Self { node, temp_dir }
}
}
// tests/integration/repository_tests.rs
#[tokio::test]
async fn can_create_and_clone_repository() {
let node = TestNode::new().await;
// Create repository
let repo_id = node.create_repository("test").await.unwrap();
// Clone should succeed
let cloned = node.clone_repository(repo_id).await;
assert!(cloned.is_ok());
}
#[tokio::test]
async fn nodes_sync_repository() {
// Start 3 nodes
let nodes: Vec<_> = futures::future::join_all(
(0..3).map(|_| TestNode::new())
).await;
// Connect nodes
for i in 1..nodes.len() {
nodes[i].connect_to(&nodes[0]).await.unwrap();
}
// Create repo on node 0
let repo_id = nodes[0].create_repository("sync-test").await.unwrap();
// Wait for sync
tokio::time::sleep(Duration::from_secs(2)).await;
// Verify all nodes have the repo
for node in &nodes {
assert!(node.has_repository(repo_id).await);
}
}
Using proptest:
use proptest::prelude::*;
proptest! {
#[test]
fn repository_name_roundtrip(name in "[a-z][a-z0-9-]{0,63}") {
let repo = Repository::new(&name).unwrap();
prop_assert_eq!(repo.name(), name);
}
#[test]
fn signature_verification(data in any::<Vec<u8>>()) {
let identity = Identity::new();
let signature = identity.sign(&data);
prop_assert!(identity.verify(&data, &signature).is_ok());
}
}
Using cargo-fuzz:
// fuzz/fuzz_targets/parse_message.rs
#![no_main]
use libfuzzer_sys::fuzz_target;
use guts_protocol::Message;
fuzz_target!(|data: &[u8]| {
// Parsing should never panic
let _ = Message::parse(data);
});
# Run all tests
cargo test --workspace
# Run with coverage
cargo llvm-cov --workspace --html
# Run specific test
cargo test repository_tests::create_repository
# Run integration tests only
cargo test --test '*' --workspace
# Run benchmarks
cargo bench --workspace
# Run fuzzer
cargo +nightly fuzz run parse_message
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable, beta, nightly]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --workspace --all-features
use mockall::automock;
#[automock]
pub trait Storage {
async fn get(&self, key: &[u8]) -> Result<Vec<u8>>;
async fn put(&self, key: &[u8], value: &[u8]) -> Result<()>;
}
#[tokio::test]
async fn service_uses_storage() {
let mut mock = MockStorage::new();
mock.expect_get()
.returning(|_| Ok(vec![1, 2, 3]));
let service = Service::new(Box::new(mock));
let result = service.fetch_data(b"key").await;
assert_eq!(result.unwrap(), vec![1, 2, 3]);
}
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.