safe-deploy
The safe-deploy command automates application deployment with mandatory safety validations including test execution, uncommitted change verification, and branch confirmation. Use this to deploy to staging or production environments while preventing unsafe deployments, such as pushing production changes from non-main branches or skipping test requirements. The command enforces pre-deployment checks and provides detailed deployment status reporting.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/huangjia2019/claude-code-engineering/HEAD/05-Commands/projects/02-advanced-commands/.claude/commands/safe-deploy.md -o ~/.claude/commands/safe-deploy.mdsafe-deploy.md
Deploy the application to: $ARGUMENTS ## Pre-deployment Checks Before deploying, verify: 1. All tests pass (`npm test`) 2. No uncommitted changes (`git status`) 3. On correct branch (main/master for production) ## Deployment Steps ### For Staging ($ARGUMENTS = "staging") 1. Run tests 2. Build the application 3. Deploy to staging environment 4. Verify deployment health ### For Production ($ARGUMENTS = "production") 1. Run full test suite 2. Check that staging is healthy 3. Create a git tag for the release 4. Build and deploy 5. Verify production health 6. Notify team ## Safety Rules - NEVER deploy to production from a non-main branch - ALWAYS run tests before deploying - If tests fail, STOP and report ## Output ``` ## Deployment Report Environment: [staging/production] Status: [success/failed] Time: [duration] ### Steps Completed ✓ Tests passed ✓ Build successful ✓ Deployed ✓ Health check passed ### Next Steps [Any follow-up actions needed] ```
Deep analysis of code against project standards
API design patterns and conventions for this project. Covers RESTful URL naming, response format standards, error handling, and authentication requirements. Use when writing or reviewing API endpoints, designing new APIs, or making decisions about request/response formats.
Generate comprehensive API documentation by scanning Express route files.
Generate API documentation from code. Use when the user wants to document APIs, create API reference, generate endpoint documentation, or needs help with OpenAPI/Swagger specs.
Explore and analyze API-related code. Use when investigating endpoints, routing, or HTTP handling.
Generate API endpoint documentation from Express route files. Use when the user asks to generate, update, or review API docs for Express.js routes.
Explore and analyze authentication-related code. Use when investigating auth flows, session management, or security.
Analyze root cause of bugs after location is identified. Second step in bug investigation.