AgentSkillsCN

add-feature

为现有项目新增功能或扩展功能。适用于由本工具构建的项目,或任何现有的GitHub仓库。规划新功能,创建议题,并通过标准流程加以实现。

SKILL.md
--- frontmatter
name: add-feature
description: Add new features or functionality to an existing project. Works with projects built by this tool or any existing GitHub repository. Plans the feature, creates issues, and implements them through the standard pipeline.
disable-model-invocation: true
context: fork
agent: orchestrator

Add Feature

Add new features or functionality to an existing project.

Input

$ARGUMENTS

Expected format: "<feature description>" [--repo <project-name-or-github-url>]

Examples:

  • /add-feature "Add user authentication with JWT" --repo my-kanban-app
  • /add-feature "Add dark mode toggle" --repo my-kanban-app
  • /add-feature "Add export to PDF" --repo https://github.com/user/existing-app
  • /add-feature "Add real-time notifications with WebSockets" --repo my-kanban-app

If --repo is not provided, look for a project in the current directory or ask the user.

Workflow

Step 1: Locate and Understand the Project

For projects built by this tool (found in projects/<name>/):

  • Read plan.md for architecture context
  • Read issues.json for existing issue structure
  • Read the codebase to understand current state

For external repositories (GitHub URL or cloned repo):

  • Clone or navigate to the repo
  • Read README.md, package.json, or equivalent for tech stack
  • Browse the codebase to understand architecture, patterns, and conventions
  • Check for existing staging branch; create one if missing

Step 2: Plan the Feature

Analyze the feature request against the existing codebase:

  • Identify which files need modification
  • Identify new files to create
  • Determine dependencies on existing code
  • Estimate scope (single issue or multiple issues)

Generate a feature plan as new entries for issues.json (or create one if it doesn't exist).

For small features (1-2 files changed):

  • Create a single issue

For larger features (3+ files, multiple components):

  • Break into multiple issues with dependencies
  • Assign them to a new phase (next phase number after existing phases)

Step 3: Create GitHub Issues

For each planned issue:

bash
gh issue create --title "<title>" --body "<formatted body per CLAUDE.md template>"

Label new issues with the appropriate phase label and feature or enhancement.

Step 4: Implement via Standard Pipeline

For each new issue, follow the standard pipeline:

  1. Create feature branch from staging: feature/issue-{N}-{slug}
  2. Implement the code (delegate to implementer agent)
  3. Commit, push, create PR targeting staging
  4. Review PR (delegate to reviewer agent)
  5. Execute test plan (delegate to tester agent)
  6. Squash-merge PR into staging
  7. Close the issue

Step 5: Phase Merge

After all new feature issues are complete:

  • Create PR from staging to main
  • Merge (non-squash, preserves history)
  • Sync staging with main

Handling External Repositories

When working with an existing repo not built by this tool:

  1. Clone if needed:

    bash
    gh repo clone <owner>/<repo> projects/<repo-name>
    cd projects/<repo-name>
    
  2. Set up staging branch (if it doesn't exist):

    bash
    git checkout -b staging
    git push -u origin staging
    
  3. Generate project context (if plan.md doesn't exist):

    • Analyze the codebase
    • Create a lightweight plan.md documenting the existing architecture
    • Create issues.json with only the new feature issues
  4. Proceed with standard pipeline from Step 3 above.

Output

Report:

  • Number of issues created
  • Implementation status for each
  • PR numbers and URLs
  • Final repo URL with the new features merged

Example Usage

code
# Add a feature to a project you built
/add-feature "Add drag-and-drop reordering for tasks" --repo my-kanban-app

# Add multiple related features
/add-feature "Add user profiles with avatar upload and bio editing" --repo my-kanban-app

# Add feature to an external repo
/add-feature "Add dark mode support" --repo https://github.com/user/my-app

# Add feature to repo in current directory
/add-feature "Add API rate limiting with Redis"