skills/aaa-testing/SKILL.md
AAA (Arrange-Act-Assert) — Enforces the Arrange-Act-Assert pattern for writing clear, structured, and maintainable tests. Use when writing, reviewing, or refactoring any unit or integration tests that are hard to read, mix setup with assertions, have unclear intent, or lack a consistent structure. Applies to any language and any testing framework (Jest, PyTest, JUnit, RSpec, Go testing, etc.).
npx skillsauth add ngmthaq/my-copilot aaa-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.
Every test has exactly three phases:
| Phase | Question | What belongs here | | ----------- | ------------------------------------- | -------------------------------------------------- | | Arrange | What is the world before this action? | Object creation, mocks, test data | | Act | What is being tested? | The single method call or event under test | | Assert | Did it do the right thing? | Expectations on return values, state, side effects |
it("applies 10% discount when order exceeds $100", () => {
// Arrange
const cart = new Cart();
cart.add({ name: "Widget", price: 60 });
cart.add({ name: "Gadget", price: 50 });
// Act
const total = cart.calculateTotal();
// Assert
expect(total).toBe(99); // 110 - 10% discount
});
1. No phase separation — multiple acts/asserts collapsed into one test. Split into one test per behavior. When a test fails, you must know exactly what broke.
2. Assertions in Arrange. Trust your fixtures. If you need to verify fixture state, write a separate test for it.
3. Act buried in Arrange. The thing being tested must be on its own line in the Act phase.
# Bad — register() is the Act, hidden in Arrange
user = UserService(mailer=mailer).register(payload)
# Good
service = UserService(mailer=mailer) # Arrange
service.register(payload) # Act
4. Asserting too much. Assert only what the test is about. Unrelated assertions make tests fragile and failure messages misleading.
Extract repeated setup into beforeEach/fixtures, but keep Act and Assert in each test:
describe("Cart", () => {
let cart;
beforeEach(() => {
cart = new Cart();
cart.add({ name: "Widget", price: 10 });
});
it("calculates correct total", () => {
const total = cart.calculateTotal(); // Act
expect(total).toBe(10); // Assert
});
it("applies coupon discount", () => {
cart.applyCoupon("SAVE10"); // Act
expect(cart.calculateTotal()).toBe(9); // Assert
});
});
Name tests after behavior: [unit]_[scenario]_[expected outcome] or plain prose.
| Bad | Good |
| ------------ | ----------------------------------------------- |
| test_login | returns auth token when credentials are valid |
| test_error | throws ValidationError when email is missing |
beforeEach/fixtures — never repeat Arrange, but keep Act+Assert per test.documentation
Guidelines and protocols for Technical Leaders to manage and oversee technical projects effectively while adhering to the core mandate of being the central orchestration layer for all engineering work.
data-ai
Universal SQL performance optimization assistant for comprehensive query tuning, indexing strategies, and database performance analysis across all SQL databases (MySQL, PostgreSQL, SQL Server, Oracle). Provides execution plan analysis, pagination optimization, batch operations, and performance monitoring guidance.
development
SOLID — Enforces the SOLID principle of object-oriented design (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) for maintainable and scalable code.
development
Separation of Concerns (SoC) — Enforces the Separation of Concerns principle by ensuring each module, layer, and component addresses exactly one well-defined concern. Use when writing, reviewing, or refactoring code that mixes UI with business logic, business logic with data access, presentation with formatting, or cross-cutting concerns (auth, logging, validation) with core logic.