cmd-productionize

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Productionize App Agent Rules

应用投产Agent规则

When asked to productionize an application for deployment:
当你被要求将应用投产以进行部署时:

Overview

概述

Transform development code into production-ready applications through systematic, methodical analysis, improvement, and deployment preparation. Supports multiple frameworks and deployment targets.
Quality Over Speed Mandate: Take time to be thorough and comprehensive. Focus on quality implementation over rapid completion. This is production-critical work that requires careful attention to detail.
通过系统性、有条理的分析、改进和部署准备,将开发代码转换为可投产的应用。支持多种框架和部署目标。
质量优先于速度要求:请花时间做到全面详尽。专注于高质量的实现,而非快速完成。这是事关生产的关键工作,需要对细节高度关注。

Usage Patterns

使用模式

bash
/cmd-productionize                          # Auto-detect framework, general production prep
/cmd-productionize flutter testflight       # Flutter app for TestFlight
/cmd-productionize react vercel            # React app for Vercel deployment
/cmd-productionize nodejs docker           # Node.js app for Docker deployment
/cmd-productionize python heroku           # Python app for Heroku
/cmd-productionize vue netlify             # Vue app for Netlify
bash
/cmd-productionize                          # 自动识别框架,通用投产准备
/cmd-productionize flutter testflight       # 适配TestFlight的Flutter应用
/cmd-productionize react vercel            # 适配Vercel部署的React应用
/cmd-productionize nodejs docker           # 适配Docker部署的Node.js应用
/cmd-productionize python heroku           # 适配Heroku的Python应用
/cmd-productionize vue netlify             # 适配Netlify的Vue应用

Workflow

工作流

1. Initial Analysis & Planning

1. 初始分析与规划

  • Always start with TodoWrite tool to create a comprehensive task list
  • Breadth AND Depth Navigation: Look beyond immediate scope to understand:
    • Related systems that might be affected
    • Broader architectural implications
    • Integration points and dependencies
    • Edge cases and potential failure modes
    • Long-term maintenance considerations
  • Analyze codebase structure and identify the framework/stack
  • Read existing documentation (README, package.json, pubspec.yaml, etc.)
  • Identify deployment target and requirements
  • Create systematic task breakdown covering all productionization phases
  • Proactive Question Analysis: Identify critical production questions the user hasn't asked yet
  • 始终从TodoWrite工具开始,创建全面的任务清单
  • 广度与深度兼顾的调研:不要局限于当前范围,要了解:
    • 可能受影响的关联系统
    • 更广泛的架构影响
    • 集成点和依赖项
    • 边界场景和潜在故障模式
    • 长期维护考量
  • 分析代码库结构,识别所用框架/技术栈
  • 阅读现有文档(README、package.json、pubspec.yaml等)
  • 确认部署目标和要求
  • 创建覆盖所有投产阶段的系统性任务分解
  • 主动问题分析:识别用户尚未提及的关键生产相关问题

2. Codebase Analysis Phase

2. 代码库分析阶段

  • Architecture review: Analyze project structure, dependencies, and patterns with methodical thoroughness
  • Comprehensive Production Readiness Audit: Systematically identify potential issues:
    • Hardcoded values and missing environment configurations
    • Missing error handling and edge case coverage
    • Performance bottlenecks and optimization opportunities
    • Security vulnerabilities and data exposure risks
    • Missing caching and state management
    • API pagination and data fetching issues
    • UI/UX polish and accessibility concerns
    • Rate limiting and abuse protection
    • Offline support and network failure handling
    • Data validation and sanitization
    • Memory leaks and resource cleanup
    • Cross-platform compatibility issues
    • Third-party service dependencies and fallbacks
  • Framework-specific checks: Apply framework-appropriate best practices with deep domain knowledge
  • Critical Questions Analysis: Document what production concerns the user should consider but hasn't addressed
  • 架构评审:有条不紊地全面分析项目结构、依赖项和设计模式
  • 全面投产就绪审计:系统性识别潜在问题:
    • 硬编码值和缺失的环境配置
    • 缺失的错误处理和边界场景覆盖
    • 性能瓶颈和优化机会
    • 安全漏洞和数据暴露风险
    • 缺失的缓存和状态管理
    • API分页和数据拉取问题
    • UI/UX打磨和无障碍访问问题
    • 限流和防滥用机制
    • 离线支持和网络故障处理
    • 数据校验和 sanitization
    • 内存泄漏和资源清理问题
    • 跨平台兼容性问题
    • 第三方服务依赖和降级方案
  • 框架特定检查:结合深度领域知识应用适配对应框架的最佳实践
  • 关键问题分析:记录用户应当考虑但尚未提及的生产相关顾虑

3. Implementation Phase

3. 实施阶段

Execute improvements systematically with methodical attention to detail, updating TodoWrite progress frequently:
Quality Focus: Each implementation step should be thorough and well-tested. Don't rush through tasks - take time to implement robust, production-grade solutions.
有条不紊地执行改进,关注细节,频繁更新TodoWrite进度:
质量优先:每个实施步骤都应当全面且经过充分测试。不要匆忙完成任务,花时间实现健壮的生产级解决方案。

Configuration & Environment

配置与环境

  • Add environment-based configurations (dev/staging/prod)
  • Implement feature toggles and debug modes
  • Secure API keys and sensitive data
  • Add configuration validation
  • 添加基于环境的配置(开发/预发/生产)
  • 实现功能开关和调试模式
  • 保护API密钥和敏感数据
  • 添加配置校验

Performance & Reliability

性能与可靠性

  • Implement proper caching mechanisms (memory, disk, network)
  • Add error handling and retry logic
  • Optimize network requests and pagination
  • Add loading states and offline handling
  • Implement proper state persistence
  • 实现合理的缓存机制(内存、磁盘、网络)
  • 添加错误处理和重试逻辑
  • 优化网络请求和分页
  • 添加加载状态和离线处理
  • 实现合理的状态持久化

User Experience

用户体验

  • Polish UI/UX with loading indicators and feedback
  • Add proper error messages and user guidance
  • Implement accessibility improvements
  • Test edge cases and error scenarios
  • 通过加载指示器和反馈打磨UI/UX
  • 添加合理的错误提示和用户引导
  • 实现无障碍访问改进
  • 测试边界场景和错误场景

Code Quality

代码质量

  • Add comprehensive logging and monitoring
  • Implement proper testing coverage
  • Clean up technical debt and code smells
  • Add documentation and comments
  • 添加全面的日志和监控
  • 实现合理的测试覆盖率
  • 清理技术债务和代码坏味道
  • 添加文档和注释

4. Framework-Specific Optimizations

4. 框架特定优化

Flutter

Flutter

  • Implement SharedPreferences for persistent caching
  • Add proper error handling for network requests
  • Optimize widget rebuilds and state management
  • Add platform-specific configurations (iOS/Android)
  • Implement proper navigation and state restoration
  • 实现SharedPreferences持久化缓存
  • 为网络请求添加合理的错误处理
  • 优化widget重绘和状态管理
  • 添加平台特定配置(iOS/Android)
  • 实现合理的导航和状态恢复

React/Next.js

React/Next.js

  • Implement proper state management (Redux, Zustand, Context)
  • Add error boundaries and suspense loading
  • Optimize bundle size and code splitting
  • Implement proper caching (SWR, React Query)
  • Add SEO and meta tag optimizations
  • 实现合理的状态管理(Redux、Zustand、Context)
  • 添加错误边界和Suspense加载
  • 优化包体积和代码分割
  • 实现合理的缓存(SWR、React Query)
  • 添加SEO和meta标签优化

Node.js

Node.js

  • Add proper middleware for error handling and logging
  • Implement rate limiting and security headers
  • Optimize database queries and connections
  • Add health checks and monitoring endpoints
  • Implement proper environment configuration
  • 添加用于错误处理和日志的合理中间件
  • 实现限流和安全头
  • 优化数据库查询和连接
  • 添加健康检查和监控端点
  • 实现合理的环境配置

Python

Python

  • Add proper error handling and logging
  • Implement caching (Redis, in-memory)
  • Optimize database queries and ORM usage
  • Add input validation and sanitization
  • Implement proper testing and CI/CD
  • 添加合理的错误处理和日志
  • 实现缓存(Redis、内存缓存)
  • 优化数据库查询和ORM使用
  • 添加输入校验和 sanitization
  • 实现合理的测试和CI/CD

5. Documentation Phase

5. 文档阶段

Create comprehensive production-ready documentation:
创建全面的可投产文档:

README.md Structure (based on proven patterns):

README.md结构(基于经过验证的模式):

markdown
undefined
markdown
undefined

Project Name - Production Ready

项目名称 - 已就绪可投产

Brief compelling description with value proposition
包含价值主张的简短醒目描述

Quick Start

快速开始

  • One-command setup instructions
  • Environment requirements
  • Configuration steps
  • 单命令启动说明
  • 环境要求
  • 配置步骤

Features

功能

  • Core functionality overview
  • Production-ready capabilities
  • Toggle configurations
  • 核心功能概览
  • 可投产能力
  • 开关配置

Deployment

部署

  • Platform-specific deployment guides
  • Environment variable setup
  • Testing and validation steps
  • 平台特定部署指南
  • 环境变量设置
  • 测试和验证步骤

Development

开发

  • Local development setup
  • Testing procedures
  • Contributing guidelines
  • 本地开发环境搭建
  • 测试流程
  • 贡献指南

Architecture

架构

  • High-level system overview
  • Key design decisions
  • Production considerations
undefined
  • 高层系统概览
  • 关键设计决策
  • 生产相关考量
undefined

Additional Documentation

额外文档

  • Deployment checklists for each target platform
  • API documentation if applicable
  • Troubleshooting guides
  • Performance optimization notes
  • 每个目标平台的部署检查清单
  • 适用情况下的API文档
  • 故障排查指南
  • 性能优化说明

6. Deployment Preparation Phase

6. 部署准备阶段

TestFlight (iOS)

TestFlight(iOS)

  • Verify App Store Connect configurations
  • Test provisioning profiles and certificates
  • Validate Info.plist settings
  • Create build and upload scripts
  • Prepare app description and screenshots
  • 校验App Store Connect配置
  • 测试配置文件和证书
  • 验证Info.plist设置
  • 创建构建和上传脚本
  • 准备应用描述和截图

Google Play (Android)

Google Play(Android)

  • Configure Play Console settings
  • Test signing configurations
  • Validate manifest permissions
  • Create release notes and store listing
  • Test different device configurations
  • 配置Play Console设置
  • 测试签名配置
  • 验证manifest权限
  • 创建发布说明和应用商店 listing
  • 测试不同设备配置

Web Deployment (Vercel/Netlify/AWS)

Web部署(Vercel/Netlify/AWS)

  • Configure build scripts and environment variables
  • Set up domain and SSL certificates
  • Test deployment pipeline
  • Configure CDN and caching headers
  • Set up monitoring and analytics
  • 配置构建脚本和环境变量
  • 设置域名和SSL证书
  • 测试部署流水线
  • 配置CDN和缓存头
  • 设置监控和分析

Container Deployment (Docker/Kubernetes)

容器部署(Docker/Kubernetes)

  • Create optimized Dockerfiles
  • Configure health checks and resource limits
  • Set up environment variable management
  • Test scaling and load balancing
  • Configure logging and monitoring
  • 创建优化的Dockerfile
  • 配置健康检查和资源限制
  • 设置环境变量管理
  • 测试扩缩容和负载均衡
  • 配置日志和监控

7. Quality Assurance Checklist

7. 质量保证检查清单

Before marking productionization complete:
  • All configurations are environment-aware
  • Error handling covers edge cases
  • Caching is implemented and tested
  • Performance is optimized for target platforms
  • Security best practices are followed
  • Documentation is comprehensive and accurate
  • Deployment process is tested and reliable
  • Monitoring and logging are configured
  • User experience is polished and accessible
  • All TodoWrite tasks are completed
标记投产完成前:
  • 所有配置都适配多环境
  • 错误处理覆盖边界场景
  • 缓存已实现并经过测试
  • 针对目标平台完成性能优化
  • 遵循安全最佳实践
  • 文档全面且准确
  • 部署流程经过测试且可靠
  • 监控和日志已配置
  • 用户体验经过打磨且支持无障碍访问
  • 所有TodoWrite任务已完成

8. Proactive Question Analysis & Next Steps

8. 主动问题分析和后续步骤

After completing productionization, ALWAYS provide:
投产完成后,始终提供:

Critical Questions the User Should Have Asked

用户应当提出的关键问题

Systematically identify and present production concerns the user hasn't considered:
Example Framework-Specific Questions:
  • Flutter: "Have you considered rate limiting for API calls? What happens when the device goes offline? How will you handle app store review rejections?"
  • React/Web: "What's your strategy for SEO and social media previews? How will you handle bot traffic? What about GDPR compliance for user data?"
  • Node.js: "How will you monitor server health in production? What's your database backup strategy? How will you handle traffic spikes?"
  • Python: "What's your strategy for handling memory leaks in long-running processes? How will you manage database migrations in production?"
系统性识别并呈现用户尚未考虑到的生产相关顾虑:
框架特定问题示例:
  • Flutter:"你是否考虑过API调用的限流?设备离线时会发生什么?你将如何处理应用商店审核被拒的情况?"
  • React/Web:"你的SEO和社交媒体预览策略是什么?你将如何处理爬虫流量?用户数据的GDPR合规如何处理?"
  • Node.js:"你将如何监控生产环境的服务健康状况?你的数据库备份策略是什么?你将如何处理流量峰值?"
  • Python:"你处理长时运行进程内存泄漏的策略是什么?你将如何管理生产环境的数据库迁移?"

Actionable Next Steps Checklist

可执行的后续步骤清单

Provide a prioritized, concrete list of post-productionization actions:
markdown
undefined
提供优先级明确的具体投产后续行动清单:
markdown
undefined

Immediate Next Steps (Complete within 48 hours)

紧急后续步骤(48小时内完成)

  1. Test deployment pipeline end-to-end in staging environment
  2. Set up monitoring alerts for critical metrics
  3. Create rollback procedures and test them
  4. Validate all environment variables are properly configured
  1. 在预发环境端到端测试部署流水线
  2. 为关键指标设置监控告警
  3. 创建回滚流程并进行测试
  4. 验证所有环境变量已正确配置

Short-term (Complete within 1 week)

短期(1周内完成)

  1. Implement comprehensive logging for production debugging
  2. Set up automated backup procedures
  3. Create incident response playbook
  4. Conduct load testing with realistic traffic patterns
  1. 实现用于生产调试的全面日志
  2. 设置自动备份流程
  3. 创建事件响应手册
  4. 使用符合实际的流量模式进行压力测试

Medium-term (Complete within 1 month)

中期(1个月内完成)

  1. Establish performance benchmarking and alerting
  2. Implement A/B testing framework if applicable
  3. Create comprehensive user documentation
  4. Plan for scaling based on usage growth projections
undefined
  1. 建立性能基准和告警机制
  2. 适用情况下实现A/B测试框架
  3. 创建全面的用户文档
  4. 根据使用增长预测制定扩缩容计划
undefined

9. Framework Detection Logic

9. 框架识别逻辑

Auto-detect framework based on:
  • Flutter:
    pubspec.yaml
    ,
    .dart
    files
  • React:
    package.json
    with React dependencies
  • Vue:
    package.json
    with Vue dependencies
  • Node.js:
    package.json
    with server dependencies
  • Python:
    requirements.txt
    ,
    pyproject.toml
    ,
    .py
    files
  • Go:
    go.mod
    ,
    .go
    files
基于以下内容自动识别框架:
  • Flutter
    pubspec.yaml
    .dart
    文件
  • React:包含React依赖的
    package.json
  • Vue:包含Vue依赖的
    package.json
  • Node.js:包含服务端依赖的
    package.json
  • Python
    requirements.txt
    pyproject.toml
    .py
    文件
  • Go
    go.mod
    .go
    文件

10. Best Practices

10. 最佳实践

  • Use TodoWrite religiously - Track every phase and task with granular detail
  • Quality over speed mentality - Take time to implement robust solutions rather than rushing through tasks
  • Be methodically systematic - Don't skip phases even if they seem obvious; thoroughness is critical
  • Breadth AND depth analysis - Always consider broader architectural implications beyond immediate scope
  • Document decisions comprehensively - Explain why certain production choices were made with context for future maintainers
  • Proactive questioning - Always identify what the user should have asked but didn't
  • Test deployment rigorously - Verify the deployment process works before completion
  • Focus on real-world user experience - Production means real users with real problems will interact with this
  • Plan for scale and failure - Consider what happens when usage grows AND when things break
  • Security first mindset - Never compromise on security for convenience
  • Measure twice, deploy once - Thorough testing and validation prevents production issues
  • Always provide actionable next steps - Give users concrete, prioritized actions to take post-productionization
  • 严格使用TodoWrite - 精细追踪每个阶段和任务
  • 质量优先于速度的理念 - 花时间实现健壮的解决方案,不要匆忙完成任务
  • 有条不紊地推进 - 即使看起来很明确也不要跳过阶段,全面性至关重要
  • 广度与深度兼顾的分析 - 始终考虑超出当前范围的更广泛架构影响
  • 全面记录决策 - 为未来的维护者说明特定生产选择的原因和上下文
  • 主动提问 - 始终识别用户应当提出但尚未提及的问题
  • 严格测试部署 - 完成前验证部署流程可正常运行
  • 关注真实用户体验 - 投产意味着真实用户会带着真实问题使用这个应用
  • 为扩缩容和故障做规划 - 考虑使用量增长和出现故障时的应对方案
  • 安全第一的思维 - 永远不要为了便利牺牲安全
  • 三思而后行,一次部署成功 - 全面的测试和验证可以避免生产问题
  • 始终提供可执行的后续步骤 - 为用户提供投产之后明确、优先级清晰的行动指引

11. Success Criteria

11. 成功标准

The application is production-ready when:
  • It handles real-world usage patterns gracefully
  • Error scenarios are covered with appropriate user feedback
  • Performance is optimized for the target deployment platform
  • Configuration can be managed without code changes
  • Documentation enables others to deploy and maintain the application
  • The deployment process is reliable and repeatable
  • Monitoring and observability are in place for production operations
  • Critical questions analysis has been completed - All important production concerns have been identified and addressed
  • Actionable next steps have been provided - User has clear, prioritized guidance for post-productionization actions
  • Breadth and depth analysis is complete - Related systems, architectural implications, and dependencies have been thoroughly considered
应用达到可投产状态的判定标准:
  • 可以优雅处理真实使用模式
  • 错误场景有对应的用户反馈覆盖
  • 针对目标部署平台完成性能优化
  • 无需修改代码即可管理配置
  • 文档可以支撑其他人部署和维护应用
  • 部署流程可靠且可复现
  • 生产运维所需的监控和可观测能力已就位
  • 已完成关键问题分析 - 所有重要的生产相关顾虑都已被识别和解决
  • 已提供可执行的后续步骤 - 用户有清晰、优先级明确的投产后行动指引
  • 已完成广度和深度分析 - 关联系统、架构影响和依赖项都已被充分考量

Notes

注意事项

  • Methodical thoroughness is paramount - Take time to be comprehensive rather than rushing through tasks
  • Always adapt to the specific framework and deployment target with deep domain expertise
  • Prioritize based on the application's critical user flows and real-world usage patterns
  • Focus on production concerns, not development convenience
  • Document architectural decisions comprehensively for future maintainers
  • Test the complete user journey, not just individual features
  • Always conclude with proactive question analysis and actionable next steps - This is not optional
  • Consider broader architectural implications and related systems impact
  • Quality over speed - production readiness cannot be rushed
  • 有条不紊的全面性是首要原则 - 花时间做到全面,不要匆忙完成任务
  • 始终结合深度领域知识适配特定框架和部署目标
  • 根据应用的核心用户流程和真实使用模式确定优先级
  • 关注生产相关顾虑,而非开发便利性
  • 为未来的维护者全面记录架构决策
  • 测试完整的用户旅程,而非仅测试单个功能
  • 始终以主动问题分析和可执行后续步骤收尾 - 这不是可选项
  • 考虑更广泛的架构影响和关联系统影响
  • 质量优先于速度 - 投产就绪不能急于求成