AgentSkillsCN

elevate-code

运用成熟可靠的模式,将项目提升至生产级质量。当您启动新项目、审查架构、审计代码,或当用户提到“提升代码质量”、“打造生产就绪的解决方案”、“采用标准化模式”、“让项目达到生产级水准”时,可使用此功能。

SKILL.md
--- frontmatter
name: elevate-code
description: Elevate projects to production quality using proven patterns. Use when starting a project, reviewing architecture, auditing code, or when user mentions "elevate-code", "production ready", "patterns", "make it production grade".

Elevate Code

Transform any project into production-quality software using proven patterns.

The Problem: Most projects fail in predictable ways—users can't set them up, accidents cause data loss, crashes waste hours of progress, code becomes unmaintainable, errors are cryptic. These aren't bugs; they're missing patterns.

The Solution: Elevate systematically applies 12 battle-tested patterns that distinguish amateur code from production software.


Quick Start

ModeWhen to UseWhat Happens
New ProjectStarting from scratchDetect type → Generate scaffold with all patterns
AuditReviewing existing codeDetect type → Scan → Gap report
TransformElevating existing projectAudit + Propose + Generate missing pieces

The 12 Patterns

The Foundation: The Triad (Patterns 1-3)

Three non-negotiable properties. If your project lacks any of these, fix them first.

Setup should verify. Mistakes should undo. Crashes should resume.

#PatternLitmus Test
1Health (Doctor)Can a new user run tool doctor and know what's missing?
2Safety (Safety Net)Can a mistake be undone in under 60 seconds?
3Resilience (Statekeeper)Can interrupted work resume without losing progress?

The Complete Set (Patterns 4-12)

#PatternProblem It Solves
4Architecture"The code is a tangled mess"
5Data Models"What shape is this data?"
6Code Organization"Where does this code go?"
7Error Handling"It failed but I don't know why"
8Testing"I'm afraid to change anything"
9Build & Deploy"How do I ship this?"
10CLI UX"This tool is confusing"
11Documentation"How does this work?"
12State Persistence"Where did my data go?"

Elevation Workflow

Step 1: Detect Project Type

Scan for file markers to identify project type and load the appropriate checklist:

File MarkersProject TypeChecklist
pyproject.toml + [project.scripts]Python CLIpython-cli.md
package.json + "bin" fieldNode.js CLInode-cli.md
manifest.json + "background"Browser Extensionbrowser-extension.md
pyproject.toml + fastapi in depsREST API (Python)rest-api.md
package.json + express/hono/fastifyREST API (Node)rest-api.md
mcp.json OR @modelcontextprotocol importsMCP Servermcp-server.md
action.yml or action.yamlGitHub Actiongithub-action.md

Step 2: Scan for Existing Patterns

For each of the 12 patterns, grep for indicators and score as Present, Partial, or Missing:

bash
# Triad
grep -rE "(doctor|check|verify|preflight)" .         # Health
grep -rE "(undo|restore|trash|dry-run)" .            # Safety
grep -rE "(checkpoint|resume|state\.json)" .         # Resilience

# Structure
grep -rE "(@dataclass|interface |TypedDict)" .       # Data Models
grep -rE "(pytest|vitest|conftest|\.test\.)" .       # Testing

# Quality
grep -rE "(retry|backoff|graceful)" .                # Error Handling

Step 3: Generate Gap Report

markdown
## Gap Analysis: <project-name>

**Project Type**: <detected-type>
**Patterns Detected**: X/12

### Present
- [x] Pattern Name - evidence found

### Partial
- [~] Pattern Name - what exists, what's missing

### Missing
- [ ] Pattern Name - why it matters

Step 4: Propose Transformations

For each gap, propose specific changes. Prioritize by impact:

  1. Triad first (Doctor, Safety, Statekeeper)
  2. Data Models (foundation for everything else)
  3. Error Handling (user experience)
  4. Testing (confidence to change)
  5. Everything else

Step 5: Generate Scaffold

For missing patterns, generate files from templates/<project-type>/:

  • Customize with project name
  • Show diff preview before writing

Success Criteria

A fully elevated project passes:

  • Triad: doctor ✓, undo ✓, resume ✓
  • Type Safety: All data structures typed (dataclass/interface)
  • Module Separation: One module = one responsibility
  • Error Messages: Include what + why + fix
  • Tests: Mocked external deps, >80% coverage on core
  • Build Config: Standard tooling (pyproject.toml / package.json)
  • AI Collaboration: CLAUDE.md with architecture
  • Output Modes: Human + --json + --quiet

Elevate: Because production-quality isn't about perfection—it's about patterns.