agentleFS
BostonOrangeBostonOrange/claude-code-framework/skills/factory/SKILL.md

factory

Skill2 starsChanged 6 months agoMITView on GitHub

AI Software Factory — end-to-end pipeline from approved ticket to deployed test environment. Chains readiness gate → develop (factory mode) → PR → CI deploy. Reduces human touchpoints from 5+ to 2.

  • Commits and pushes

9 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 14 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 9 edited versions we read keep these.

  • 14

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Worktree: always (no prompt)

    line 89
  2. Distinctive:

    Before creating the PR, optionally validate the full deployment locally.

    line 98
  3. Distinctive:

    Salesforce: Create scratch org, deploy, run tests

    line 101
  4. Very specific:

    Node.js/Python: Run full test suite, build, lint

    line 102
  5. Distinctive:

    Generic: Run project's validation script

    line 104
  6. Distinctive:

    If validation fails (max 3 attempts):

    line 108
  7. Distinctive:

    After 3 failures → halt and notify.

    line 113
  8. Distinctive:

    Only after validation passes:

    line 117
  9. Distinctive:

    After PR is created, two things happen automatically:

    line 135
  10. Distinctive:

    If CI deployment fails, errors are posted as PR comments.

    line 139
  11. Distinctive:

    After merge, CI handles:

    line 144
  12. Distinctive:

    Wait for human to complete manual config

    line 152
  13. Distinctive:

    Factory mode writes memory: when:

    line 213
  14. Distinctive:

    When a factory PR can't merge (another PR merged to base branch first):

    line 229
  15. Distinctive:

    If resolution is uncertain → halts and notifies for human review

    line 233

“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Factory

End-to-end AI Software Factory: readiness → develop → PR → CI deploy to test environment.

Usage

/factory TICKET-1234
/factory 1234

Overview

The factory pipeline automates the full path from an approved ticket to code deployed in a test environment for review. It chains existing skills with factory-mode defaults that eliminate manual decision points.

Human Touchpoints (reduced from 5+ to 2)

  1. Architect/PM drafts ticket — /draft-story resolves all open questions → ticket is "Ready for Sprint"
  2. Code review — reviewer approves PR. Code is already deployed in test environment (by CI).
  3. Smoke test — users validate in staging after auto-deploy

Everything else is automated.

Architecture

Developer Terminal (Claude Code)     │     CI/CD (automatic)
─────────────────────────────────────┼──────────────────────────────────
                                     │
/factory TICKET-xxx                  │
  ├─ /check-readiness                │
  ├─ Create worktree + branch        │
  ├─ Scaffold + implement            │
  ├─ /validate (code standards only) │
  ├─ Fix code standards issues       │
  ├─ Commit + push                   │
  ├─ Create PR (factory label)  ─────┼──► CI validate workflow
  └─ /improve (background)           │
                                     │      ├─ Deploy to test environment
                                     │      ├─ Run tests
                                     │      └─ Post PR comment with env link
                                     │
                              Review ─┼──► Reviewer tests in environment
                                     │
                        PR Approved ──┼──► CI auto-merge workflow
                                     │
                          PR Merged ──┼──► CI deploy workflow
                                     │      ├─ Deploy to staging
                                     │      ├─ Notify team
                                     │      └─ Update ticket state

Pipeline Classification

The readiness gate classifies tickets into two paths:

TypeMeaningDeploy behavior
AutoAll changes deployable via CI/CDFull automation through staging
Semi-autoRequires manual configurationPipeline pauses → notifies manual steps → human confirms → deploy

Execution

Step 1: Parse Input

Extract ticket ID from input. Accept TICKET-1234 or just 1234.

Step 2: Readiness Gate

Invoke /check-readiness TICKET-{id} --factory.

The --factory flag means:

  • On FAIL: automatically post gap report to tracker, transition to "needs info" state, and stop
  • On PASS: continue to Step 3. Save the classification (auto/semi-auto) for the PR label.

If readiness fails:

Factory halted — TICKET-{id} not ready. Gap report posted to tracker. Ticket returned to architect.

Step 3: Develop (Factory Mode)

Invoke /develop TICKET-{id} --factory.

Factory mode defaults (no user prompts):

  • Worktree: always (no prompt)
  • Validation: code standards only — no deployment (CI handles it)
  • Tracker update: automatic
  • PR label: factory added automatically (+ factory-semi-auto if classified)

Step 4: Pre-Push Validation (Optional)

BLOCKING GATE: Do NOT push or create a PR until this step passes.

Before creating the PR, optionally validate the full deployment locally. This catches deployment errors before human review.

The implementation depends on your deployment target:

  • Salesforce: Create scratch org, deploy, run tests
  • Node.js/Python: Run full test suite, build, lint
  • Docker: Build image, run container tests
  • Generic: Run project's validation script

{{FACTORY_LOCAL_VALIDATION}}

If validation fails (max 3 attempts):

  1. Parse the error
  2. Fix the source
  3. Retry

After 3 failures → halt and notify.

Step 5: Push & Create PR

Only after validation passes:

git push -u origin {branch}
gh pr create --base {{BASE_BRANCH}} --assignee @me \
  --title "{TICKET_ID}: {Story Title}" \
  --label "factory" \
  --body "$(cat <<'EOF'
## Summary
- {short summary of changes}

[Ticket: {TICKET_ID}]({{TRACKER_TICKET_URL}})
EOF
)"

Step 6: Wait for CI + Code Review

After PR is created, two things happen automatically:

  1. CI/CD deploys to test environment and posts PR comment with link
  2. Reviewer tests the code, then approves or requests changes

If CI deployment fails, errors are posted as PR comments. Developer fixes locally and pushes.

Step 7: Deploy to Staging (Post-Merge)

Auto tickets

After merge, CI handles:

  1. Deploy to staging
  2. Notify team
  3. Update ticket state

Semi-auto tickets

After merge:

  1. Post notification listing manual config steps
  2. Wait for human to complete manual config
  3. Human confirms → deploy

Step 8: Report Completion

Factory pipeline complete for TICKET-{id}.

PhaseStatus
ReadinessPASS ({auto/semi-auto})
Branch{worktree_path}
ImplementationComplete
Code StandardsPASS
Local ValidationPASS
PR{pr_url}
CI DeployPending (CI/CD)
Staging Deploy{Auto on merge / Pending manual steps}

Step 9: Framework Improvement (Background)

Spawn /improve in the background per the pattern in /develop Phase 9. This never blocks the factory pipeline — it runs after the completion report.

Execution Logging

Each factory run produces structured logs in docs/stories/{TICKET_ID}/:

FileContent
execution-log.mdPhase-by-phase timestamps, outcomes, durations
build-log.mdValidation failures and fix attempts

execution-log.md Format

# Factory Execution Log — TICKET-{id}

## Run: {timestamp}

| Phase | Started | Duration | Outcome |
|-------|---------|----------|---------|
| Readiness | {time} | {duration} | PASS (auto) |
| Branch | {time} | {duration} | Created worktree |
| Scaffold | {time} | {duration} | {n} files generated |
| Implement | {time} | {duration} | {n} components created |
| Validate (standards) | {time} | {duration} | PASS |
| Validate (deploy) | {time} | {duration} | PASS |
| PR | {time} | {duration} | #{pr_number} |

Total: {total_duration}

## Components Created
{list from solutions-components.md}

Memory Integration

Factory mode reads memory for:

  • Worktree preferences (always worktree in factory, but naming convention matters)
  • Known build fixes (preventive application before validation)
  • Environment aliases (for local validation target)

Factory mode writes memory when:

  • A non-obvious build fix is discovered during fix attempts
  • A new deployment pattern is established

Halt Conditions

ConditionAction
Readiness gate failsReturn to architect, post gap report
Code standards fail after 3 attemptsHalt, notify team
Local validation fails after 3 attemptsHalt, notify team
PR merge conflictRun /merge-resolve TICKET-{id} to auto-resolve
CI deployment failureError posted as PR comment

Merge Conflict Auto-Resolution

When a factory PR can't merge (another PR merged to base branch first):

  1. /merge-resolve reads both features' story docs to understand intent
  2. Applies per-file-type resolution rules (source code: merge methods; permissions: union; config: deduplicate)
  3. Pushes resolved result → CI re-validates
  4. If resolution is uncertain → halts and notifies for human review

Halt Notification

{{NOTIFY_HALT_FACTORY}}

Edge Cases

ScenarioBehavior
No ticket ID providedAsk for it
Ticket already has open PRSkip to review gate, warn user
Ticket already in staging/UATSkip, inform user
Worktree already existsReuse existing worktree
Factory label already on PRSkip labeling
Auth not configuredPrompt user, halt
Notification webhook not setWarn, skip notification, continue
PR has merge conflictsAttempt auto-resolve, halt if complex

Related Skills

  • /check-readiness — readiness gate (Step 2)
  • /develop — implementation pipeline (Step 3)
  • /improve — manual framework improvement (Step 9 runs this automatically)
  • /deploy — manual deployment alternative
  • /validate — code standards validation (called by /develop)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.