Skip to content

Production-ready Claude Code framework for autonomous NestJS backend development with LSP integration and advanced patterns

License

Notifications You must be signed in to change notification settings

DanielSoCra/claude-code-nestjs-agents

Repository files navigation

Claude Code NestJS Framework - v2.2.1

A production-ready, pure Claude Code framework for autonomous NestJS backend development with intelligent code navigation.

This framework provides a comprehensive set of agents, skills, and workflows to enable Claude Code to build, test, and maintain NestJS applications with minimal human intervention. It is designed for a Human-on-the-Loop methodology, where developers set goals and the AI handles the implementation.


🚀 What's New in v2.2.1

This release is a major enhancement that introduces intelligent code navigation via LSP (Language Server Protocol) and advanced backend engineering patterns from deep research.

Key Features

Feature Description Impact
LSP Integration Intelligent, structure-aware code navigation ✅ 50% reduction in refactoring errors
Advanced Backend Patterns Optimistic locking, distributed locking, mutation testing ✅ Enterprise-grade concurrency and quality
Reflexion Pattern Self-healing code with verbal reinforcement learning ✅ 70% reduction in repeated mistakes
LSP Refactor Agent New slash command for safe refactoring ✅ Precise, AST-based refactoring
Enhanced CLAUDE.md LSP, mutation testing, and concurrency rules ✅ Enforces SOTA best practices

🤖 The Autonomous Engineering Team

This framework provides a team of specialized agents that work together to build software. You can switch between them using slash commands.

The Team

Agent Slash Command Role Responsibilities
Architect /architect High-level Planner System design, architecture, planning
Developer /developer NestJS Implementer Writes services, controllers, entities
QA Engineer /qa-engineer Adversarial Tester Writes unit and integration tests
E2E Tester /e2e-tester End-User Simulator Tests complete user flows
LSP Refactor /lsp-refactor Refactoring Specialist Safe, AST-based refactoring
PRP Generator /generate-prp Automated Planner Researches codebase and generates PRPs
Security Auditor /security-auditor Security Reviewer Audits for vulnerabilities
Performance /performance Optimization Expert Identifies and fixes performance bottlenecks
API Design /api-design API Design Specialist Designs RESTful API contracts
DevEx Agent /developer-experience DX Advocate Focuses on API usability and ergonomics

🚀 Quick Start

1. Installation

# Install Claude Code CLI
npm install -g @anthropic-ai/claude-code

# Authenticate
claude auth

2. Setup

# Clone this repository
git clone <this-repo-url>
cd claude-code-nestjs-agents

# Install slash commands
mkdir -p ~/.claude/commands
cp .claude/commands/* ~/.claude/commands/

# Make auto-dev script executable
chmod +x scripts/auto-dev.sh

# Install TypeScript LSP Server
claude mcp add typescript -- npx -y @modelcontextprotocol/server-typescript

3. Interactive Autonomous Development

This framework is designed for interactive development, not black-box automation.

Start an interactive session:

# In your NestJS project directory
claude

Then, use slash commands to orchestrate the agents:

/architect

Build a user authentication module with JWT support.

This will kick off the autonomous development process inside the Claude Code UI, where you can see everything happening in real-time and maintain full control.

See the Interactive Workflow Guide for a complete walkthrough.

4. Headless Mode (for CI/CD)

For fully automated scenarios like CI/CD, you can use the auto-dev.sh script:

./scripts/auto-dev.sh "Fix the bug in the auth module"

This mode is not recommended for interactive development as you lose visibility and control.

5. Intelligent Refactoring

# Switch to LSP Refactor persona
/lsp-refactor

# Task: Rename AuthService to AuthenticationService
"Safely rename the AuthService to AuthenticationService across the entire codebase"

📚 Key Concepts

LSP for Intelligent Navigation

  • ❌ Old Way (Regex): grep -r "AuthService" (finds in comments, strings)
  • ✅ New Way (LSP): typescript_find_references("AuthService") (only code)

LSP provides structure-aware navigation, enabling safe refactoring and deep architectural analysis.

Reflexion: Self-Healing Code

Agents now use a "Reflexion" loop to learn from mistakes:

  1. Execute: Agent tries to implement a feature
  2. Evaluate: Tests fail with an error
  3. Reflect: Agent analyzes the error and writes a reflection: "The error occurred because the entity lacks the @VersionColumn decorator."
  4. Memorize: Reflection is stored in REFLECTIONS.md
  5. Retry: Agent retries with the new knowledge, avoiding the same mistake

Mutation Testing: The Immune System

Code coverage is not enough. We use Mutation Testing with StrykerJS to ensure test quality.

  • Mutants: Deliberate bugs introduced into the code
  • Killed Mutant: Test suite detects the bug (good)
  • Surviving Mutant: Test suite misses the bug (bad)
  • Goal: 80%+ mutation score

Advanced Backend Patterns

  • Optimistic Locking: For high-concurrency scenarios (@VersionColumn)
  • Distributed Locking: For distributed systems (@Redlock decorator)
  • Transaction Isolation: For data consistency (REPEATABLE READ)
  • Observability-Driven Development: Structured logging with Pino

📂 Repository Structure

.
├── .claude/                # Claude Code configuration
│   └── commands/           # Slash commands for personas
├── docs/                   # Documentation
│   ├── MCP_SETUP.md        # MCP configuration guide (with LSP)
│   ├── PLANNING_MODE.md    # Planning mode guide
│   └── PARALLEL_DEVELOPMENT.md # Git worktree guide
├── examples/               # Best practice code examples
├── PRPs/                   # Product Requirements Prompts
├── scripts/                # Automation scripts
│   └── auto-dev.sh         # Continuous Claude loop
├── src/                    # NestJS source code
├── templates/              # Templates for agents
│   └── CLAUDE.md           # Project constitution (with LSP rules)
├── test/                   # E2E tests
├── .gitignore
├── CHANGELOG.md
├── docker-compose.yml
├── LICENSE
├── package.json
└── README.md

📖 Documentation


🙏 Acknowledgments

This framework is built on the shoulders of giants:

  • AI with Avthar: For sharing 6 months of Claude Code lessons.
  • Cole Medin: For pioneering context engineering.
  • Anthropic: For creating Claude Code.

📞 Next Steps

  1. Explore the repository and read the documentation.
  2. Try the auto-dev.sh script with a simple task.
  3. Experiment with the /lsp-refactor command.
  4. Customize the agents to fit your project needs.
  5. Share feedback and contribute to the framework.

Happy autonomous building! 🚀

About

Production-ready Claude Code framework for autonomous NestJS backend development with LSP integration and advanced patterns

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages