home / skills / codervisor / lean-spec / leanspec-development

leanspec-development skill

/skills/leanspec-development

This skill guides LeanSpec development, helping you set up environments, follow rules, and validate changes across a Turborepo monorepo.

npx playbooks add skill codervisor/lean-spec --skill leanspec-development

Review the files below or copy the command above to add this skill to your agents.

Files (3)
SKILL.md
3.7 KB
---
name: leanspec-development
description: Development workflows and contribution guidelines for LeanSpec. Use when contributing code or setting up development environment.
compatibility: Requires pnpm, Node.js 18+, and Rust toolchain
metadata:
  author: LeanSpec
  version: 0.3.0
  homepage: https://leanspec.dev
---

# LeanSpec Development Skill

**Quick activation context** for AI agents working on LeanSpec development.

## When to Use

Activate when:
- Setting up development environment
- Contributing code or fixing bugs
- Running tests or validation
- Working with the monorepo structure

## Quick Navigation

| Goal | Reference |
|------|-----------|
| **Mandatory rules & conventions** | [RULES.md](./RULES.md) |
| **Monorepo structure & packages** | [STRUCTURE.md](./STRUCTURE.md) |

**Everything else**: Read root `README.md`, `package.json` scripts, or explore the codebase.

## Core Principles

The non-negotiable mental model:

1. **Use pnpm** - Never npm or yarn
2. **DRY** - Extract shared logic, avoid duplication
3. **Test What Matters** - Business logic and data integrity, not presentation
4. **Leverage Turborepo** - Smart caching (19s → 126ms builds)
5. **Maintain i18n** - Update both en and zh-CN translations
6. **Follow Rust Quality** - All code must pass `cargo clippy -- -D warnings`
7. **Delegate Complex Tasks** - Use `runSubagent` for multi-step investigations

## Working with Subagents

**For AI agents**: Delegate complex tasks to subagents rather than attempting extensive manual searches.

### When to Use `runSubagent`

āœ… **Delegate**:
- Searching patterns across multiple files
- Investigating unfamiliar code areas
- Cross-package changes requiring context
- Debugging with comprehensive exploration

āŒ **Don't delegate**:
- Simple single-file edits
- Well-known commands
- Already clear and scoped tasks

### Delegation Pattern

```typescript
runSubagent({
  description: "Find validation logic",
  prompt: `Search for all spec validation logic.
  
  Return:
  1. Where rules are defined
  2. What checks are performed
  3. Where validation is called
  
  Focus on: packages/mcp, rust/leanspec-core`
});
```

## Critical Commands

The 20% you need 80% of the time:

```bash
# Setup
pnpm install              # Install dependencies
pnpm build                # Build all packages

# Development (see package.json for all scripts)
pnpm dev                  # Start all dev servers
pnpm dev:cli              # CLI watch mode
pnpm dev:web              # Web UI only

# Validation (run before PR)
pnpm pre-release          # Full validation: typecheck, test, build, lint
pnpm test:run             # All tests (CI mode)
pnpm lint:rust            # Rust clippy checks
```

**All commands are in root `package.json` - AI agents should read it directly.**

## Critical Rules

Rules enforced by hooks or CI:

1. **Light/Dark Theme** - ALL UI must support both themes
   ```typescript
   // āœ… Good
   className="text-blue-700 dark:text-blue-300"
   ```

2. **i18n** - Update BOTH en and zh-CN locales

3. **Regression Tests** - Bug fixes MUST include failing-then-passing tests

4. **Rust Quality** - Must pass `cargo clippy -- -D warnings`

**See [RULES.md](./references/RULES.md) for complete requirements.**

## Reference Documentation

- [SETUP.md](./references/SETUP.md) - Environment setup, troubleshooting
- [CONTRIBUTING.md](./references/CONTRIBUTING.md) - Workflow, testing patterns, examples
- [RULES.md](./references/RULES.md) - Mandatory requirements with rationale
- [COMMANDS.md](./references/COMMANDS.md) - Complete command reference
- [MONOREPO.md](./references/MONOREPO.md) - Turborepo, versioning, structure
- [RUST-QUALITY.md](./references/RUST-QUALITY.md) - Clippy enforcement, hooks

Overview

This skill describes development workflows and contribution guidelines for LeanSpec. It focuses on setting up the development environment, following mandatory conventions, and safely delegating work to subagents for complex tasks. Use it to streamline contributions, validations, and cross-package investigations in a TypeScript + Rust monorepo.

How this skill works

The skill inspects repository conventions, essential commands, and core principles to ensure consistent contributions. It guides setup (pnpm, build), validation (tests, lint, clippy), and delegation patterns using runSubagent for multi-file or cross-package exploration. It also highlights mandatory rules like i18n updates, theme support, and regression-test requirements.

When to use it

  • Setting up or reproducing the development environment on a new machine
  • Contributing code, fixing bugs, or preparing a PR for CI validation
  • Running full validation before release: typecheck, tests, lint, build
  • Investigating cross-package behavior or searching patterns across the monorepo
  • Deciding whether to delegate complex searches or debugging to a subagent

Best practices

  • Always use pnpm; do not use npm or yarn for this project
  • Run pre-release validation (typecheck, tests, lint, build) before opening a PR
  • Include failing-then-passing regression tests for bug fixes
  • Update both en and zh-CN translations when changing UI text
  • Follow Rust quality rules: run cargo clippy -- -D warnings and fix warnings
  • Prefer DRY: extract shared logic into common packages and leverage Turborepo caching

Example use cases

  • A new contributor sets up the workspace: pnpm install, pnpm build, then pnpm dev:web to run the UI
  • Fixing a validation bug: runSubagent to find all spec validation logic across TypeScript and Rust packages, add tests, and run pnpm pre-release
  • Performance improvement: use Turborepo to verify cache hits and reduce build times locally
  • CLI change: use pnpm dev:cli for watch-mode iteration and run lint:rust when touching Rust code
  • Cross-package refactor: search and update interfaces across packages, then run test:run to validate CI-like behavior

FAQ

When should I use runSubagent vs. edit directly?

Use runSubagent for multi-file searches, unfamiliar code areas, or cross-package investigations. Do simple, well-scoped single-file edits yourself.

What is the quickest validation sequence before a PR?

Run pnpm pre-release for full validation. For faster local checks, run relevant unit tests and cargo clippy -- -D warnings for Rust changes.