Best use case
chai is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Chai assertion library for JavaScript. Use for JS assertions.
Teams using chai should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/chai/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How chai Compares
| Feature / Agent | chai | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Chai assertion library for JavaScript. Use for JS assertions.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Chai
Chai is an assertion library. It pairs naturally with Mocha. It supports TDD (`assert`) and BDD (`expect`, `should`) styles.
## When to Use
- **With Mocha**: The default pair.
- **Expressive Tests**: You want tests to read like English ("expect foo to be a string").
## Quick Start
```javascript
import { expect } from "chai";
const foo = "bar";
const beverages = { tea: ["chai", "matcha", "oolong"] };
expect(foo).to.be.a("string");
expect(foo).to.equal("bar");
expect(foo).to.have.lengthOf(3);
expect(beverages).to.have.property("tea").with.lengthOf(3);
```
## Core Concepts
### Styles
- **Assert**: Classic. `assert.equal(foo, 'bar')`.
- **Expect**: BDD. Chainable. `expect(foo).to.be.equal('bar')`.
- **Should**: BDD. Extends Object prototype. `foo.should.be.equal('bar')`. (Less common now due to side effects).
### Plugins
Chai has a rich ecosystem.
- `chai-http`: For API testing.
- `chai-as-promised`: For asserting promises (`return expect(promise).to.eventually.equal(2)`).
## Best Practices (2025)
**Do**:
- **Stick to one style**: Usually **Expect**. It's clean and doesn't modify prototypes.
- **Use Descriptive Chains**: `to.be.true` reads better than `to.equal(true)`.
**Don't**:
- **Don't mix Assert and Expect**: Confuses the reader.
## References
- [Chai Documentation](https://www.chaijs.com/)Related Skills
langchain
LangChain LLM application framework with chains and agents. Use for LLM orchestration.
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.