Instructions for AI coding agents working on the Serverless Framework repository.
This is the Serverless Framework monorepo - a command-line tool for deploying serverless applications to AWS Lambda and other managed cloud services. The framework uses YAML configuration to deploy code and cloud infrastructure.
Tech Stack:
- Node.js 24+ (ES Modules)
- Go (for binary installer)
- npm workspaces for package management
- Jest for testing
- ESLint + Prettier for code quality
/workspace
├── packages/ # npm workspaces
│ ├── sf-core/ # Main CLI framework (primary package)
│ ├── serverless/ # Serverless Framework package
│ ├── engine/ # Container framework engine (SCF)
│ ├── mcp/ # MCP server for AI IDEs
│ ├── util/ # Shared utilities
│ └── standards/ # ESLint and Prettier configs
├── binary-installer/ # Go-based binary installer
├── docs/ # Documentation
└── release-scripts/ # Release automation
packages/sf-core: The Serverless Framework CLI that wraps the serverless package. Most development happens here.packages/serverless: Core Serverless Framework functionality and AWS provider implementation.packages/engine: Serverless Container Framework for deploying containers to AWS Lambda/ECS.packages/mcp: Model Context Protocol server for AI-powered IDEs (Cursor, Windsurf).
# Install dependencies (uses npm workspaces)
npm install
# Run the framework locally on a test project
cd /path/to/your/test-project
node /path/to/serverless/packages/sf-core/bin/sf-core.js deploy- No semicolons - Prettier removes them
- Single quotes for strings
- 2-space indentation
- LF line endings
- ES Modules - use
import/export, notrequire()
# Check formatting
npm run prettier
# Fix formatting
npm run prettier:fix
# Run ESLint
npm run lint
# Fix lint issues
npm run lint:fix- Prefer native JavaScript over lodash
- Use async/await for asynchronous code
- Always run
npm run prettier:fixandnpm run lint:fixbefore committing
# Run unit tests for sf-core
npm run test:unit -w @serverlessinc/sf-core
# Run unit tests for serverless package
npm run test:unit -w @serverless/framework
# Run both
npm run testIntegration tests require AWS credentials and Serverless Dashboard access. They run automatically in CI when you submit a PR.
# Full test suite (requires AWS setup)
npm test -w @serverlessinc/sf-core
# Resolver tests
npm run test:resolvers -w @serverlessinc/sf-core# Run engine unit tests
npm test -w @serverless/engineThe CI runs on pull requests targeting main. Jobs include:
- Lint: ESLint + Prettier checks
- Test: Engine: Unit tests for the container engine
- Test: Framework: Unit and integration tests for sf-core and serverless
All CI jobs use Node.js 24.x.
- Create feature branch from
main - Make changes in the appropriate package under
packages/ - Add/update tests in the corresponding
tests/directory - Run
npm run lint:fix && npm run prettier:fix - Run unit tests:
npm run test:unit -w @serverlessinc/sf-core - Commit and push
CLI commands are in packages/sf-core/src/. Look for command handlers and add corresponding tests in packages/sf-core/tests/.
The binary installer is a separate Go project in binary-installer/.
cd binary-installer
go test ./...
make buildpackages/sf-core/bin/sf-core.js- CLI entry pointpackages/sf-core/src/- Core framework sourcepackages/sf-core/tests/- Test suitespackages/standards/src/eslint.js- ESLint configurationpackages/standards/src/prettier.js- Prettier configuration
- Run linting and formatting before committing
- Write unit tests for new functionality
- Use async/await for async operations
- Keep commits focused and descriptive
- Check existing tests for patterns to follow
- Don't use semicolons (Prettier removes them)
- Don't use
require()- this is an ES Modules project - Don't add lodash dependencies - prefer native JS
- Don't skip the lint/format step
- Don't modify integration tests without understanding the AWS setup they require
- Check existing code for patterns
- Review
CONTRIBUTING.mdfor contribution guidelines - Look at recent PRs for examples of changes
- The
docs/directory contains user-facing documentation