redeploy-local
Skill8 starsChanged 2 months agoMITView on GitHub
After code changes, auto-detect the project's build system and local deployment method for a given directory, then build the project and restart its locally-deployed environment (Docker Compose / systemd / process manager). Never assumes — asks only when detection is ambiguous. Caches detected commands per project in .cortex/redeploy-local.yaml; re-invocations on the same project skip re-scanning until signal files change, the cache expires (30 days), or the skill version bumps.
- Deletes or force-pushes
In this repository77 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- archive-milestoneSkill
- assess-product-opportunitySkill
- automate-testsSkill
- bump-versionSkill
- capture-work-itemsSkill
- commit-workSkill
- competitive-researchSkill
- consume-nats-messageSkill
- decontextualize-textSkill
- deep-researchSkill
- define-docs-normsSkill
- define-missionSkill
- define-north-starSkill
- define-roadmapSkill
- define-strategic-pillarsSkill
- define-visionSkill
- deliver-featureSkill
- design-strategic-goalsSkill
- eli5Skill
- establish-delivery-workflowSkill
- execute-delivery-workflowSkill
- generate-agent-entrySkill
- generate-github-workflowSkill
- generate-standard-readmeSkill
- inspect-artifact-stateSkill
- integrate-branchesSkill
- manage-secretSkill
- map-item-dependenciesSkill
- market-researchSkill
- orchestrate-code-reviewSkill
- orchestrate-governance-stepSkill
- orchestrate-repair-loopSkill
- orchestrate-repair-requirements-loopSkill
- orchestrate-roadmap-planningSkill
- plan-milestonesSkill
- plan-nextSkill
- policy-researchSkill
- ponytailSkill
- prepare-presales-responseSkill
- prepare-version-notesSkill
- prioritize-backlogSkill
- product-opportunity-analysisSkill
- promote-roadmap-itemsSkill
- publish-nats-messageSkill
- record-milestone-achievementSkill
- refine-skill-designSkill
- review-architectureSkill
- review-codebaseSkill
- review-diffSkill
- review-dotnetSkill
- review-error-surfacingSkill
- review-functional-designSkill
- review-goSkill
- review-implementation-alignmentSkill
- review-javaSkill
- review-observabilitySkill
- review-orm-usageSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
20 rules. About 0 are common, 10 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 29
Acceptance test: after the skill finishes, the locally deployed service reflects the latest code changes and the status check reports …
- Very specific: line 66
Prefer explicit .cortex.yaml commands, then a valid project cache.
- Very specific: line 76
If the user gave a path: verify it exists (test -d <path>)
- Very specific: line 84
If it exists, read .cortex/redeploy-local.yaml
- Very specific: line 94
No evidence: stop and ask the user for build_command, or have them fill in .cortex.yaml
- Distinctive: line 100
No evidence: stop and ask the user
- Distinctive: line 104
Ask only for missing choices when the evidence supports more than one command or deployment target
- Distinctive: line 105
When the user's request already authorizes this local redeploy, continue without a second confirmation
- Distinctive: line 108
Run the build command from the target directory
- Distinctive: line 114
Run the restart command
- Distinctive: line 136
Write only when the build exited 0 (or was skipped as subsumed), the deployment exited 0, and the health check passed
- Very specific: line 137
If both commands came from .cortex.yaml, skip the write (the cache adds nothing)
- Very specific: line 139
If .cortex/ does not exist, create it (mode 0755), then write .cortex/redeploy-local.yaml with the header # Auto-generated by …
- Distinctive: line 145
Ask only when detection is ambiguous or has failed
- Very specific: line 146
Do not ask when .cortex.yaml supplies both commands
- Distinctive: line 147
If several choices remain, present them together in one question
- Very specific: line 167
After a fully successful run (build + deployment + health check all pass), the inference cache written to .cortex/redeploy-local.yaml
- Very specific: line 175
Never: run rm -rf or a destructive cleanup command without explicit user configuration
- Distinctive: line 178
Never: run the deployment restart without a preceding successful build (exit code 0), except for a Compose-only project, where the …
- Very specific: line 180
Never: add sudo without supporting evidence, such as a systemd unit file owned by root while the current uid differs.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Redeploy Local
Purpose
After the agent has changed code, run the project's build and restart the locally deployed environment — the user does not need to know the project's tech stack. It applies to projects deployed locally through Docker Compose, a systemd unit, or a process manager (pm2, supervisorctl). Hot-reload development servers are deliberately out of scope; the target is a running local environment, not a development watch mode.
Core Objective
Primary goal: given a directory, run one build and one local deployment restart successfully, and report what was run.
Success criteria (all must be met):
- ✅ Directory confirmed: the target directory is verified to exist before any command runs
- ✅ Build command determined or configured: the command traces back to a config file or a detection heuristic — never invented
- ✅ Build succeeded: exit code 0; the build artifacts exist where they are expected
- ✅ Deployment method determined or configured: the deployment target is identified (Compose / systemd / pm2 / supervisord)
- ✅ Deployment restarted: the service/container has restarted and is reachable (a health check or status check passes)
- ✅ Run report emitted: a command → exit code → duration table for every step executed
Acceptance test: after the skill finishes, the locally deployed service reflects the latest code changes and the status check reports healthy/running.
Scope Boundaries
This skill covers:
- Detecting the build system from project files (package.json, Makefile, go.mod, Cargo.toml, pom.xml, build.gradle, *.csproj, pyproject.toml)
- Detecting the local deployment method from project files (docker-compose.yml / compose.yaml, a systemd unit, a pm2 ecosystem file, supervisord.conf)
- Reading project-level config overrides (
.cortex.yamlbuild_command/deploy_command) - Persisting a successful inference to
.cortex/redeploy-local.yamlfor reuse on the next run - Running build + restart in sequence
- Reporting the result
This skill does not cover:
- Hot-reload development servers (npm run dev, vite, next dev) — these are not a "local deployment environment"
- Remote deployment (SSH, cloud, Kubernetes) — use a deployment skill aimed at remote infrastructure
- Database migrations — run those separately before invoking this skill
- Secret injection — environment variables / secrets must already be available in the deployment
Handoff point: the skill is done when the run report shows exit code 0 for every step. If any step fails, the skill reports the failure and stops — it does not retry or repair build errors on its own.
Use Cases
- Rebuild after an edit: the agent has finished changing code; the user wants the local service to reflect the change without running build + restart commands by hand
- Multi-stack project: the project mixes a compiled language (Go, Rust) with a Docker Compose deployment; the skill detects both
- Scripted override:
.cortex.yamlgives CI-like reproducibility — the same commands on every run, with no detection drift - Shared team environment: team members have different local setups; the skill adapts to the signals it detects instead of demanding one common toolchain
Detection Approach
Prefer explicit .cortex.yaml commands, then a valid project cache. When either command is missing, read the detection procedure: inspect project files, choose a command supported by the project, and stop for a choice if evidence conflicts. Never invent a build or deployment target.
Behavior
Workflow (Checklist)
- Confirm the target directory
- Default: CWD
- If the user gave a path: verify it exists (
test -d <path>) - Abort with a clear error when the directory does not exist
- Read the config override (if
.cortex.yamlexists)- Parse
build_commandand/ordeploy_command - Record which fields were overridden; skip heuristic detection for those fields
- Parse
- Check the inference cache (Detection Approach step 0.5)
- If it exists, read
.cortex/redeploy-local.yaml - Validate it with the 6-step pseudo-logic
- Cache hit: skip steps 4–5 and go to step 6 with the report annotated
(from cache, scanned YYYY-MM-DD; <N> signal files unchanged) - Cache miss / malformed / expired: continue with step 4 (do not delete the file)
- Fields overridden by
.cortex.yaml(step 2) are excluded from cache reuse; the cache serves only the remaining fields, if its validation still passes
- If it exists, read
- Infer the build command (when it is neither overridden nor cached)
- Carry out Detection Approach steps 1–2: enumerate the signals, read the files, cross-reference
- Record the evidence source and the chosen command
- For a Compose-only project (no other build orchestration): mark "build skipped — subsumed by deploy"
- No evidence: stop and ask the user for
build_command, or have them fill in.cortex.yaml - Conflicting evidence: show the options to the user, do not choose silently
- Infer the deploy command (when it is neither overridden nor cached)
- Carry out Detection Approach step 3: read the deployment config files, prefer a Makefile wrapper
- Record the source and the chosen command, including the extracted service/unit name
- No evidence: stop and ask the user
- Resolve and show the inference
- Show the structured inference report (per Detection Approach step 4); annotate it when the cache was used
- Ask only for missing choices when the evidence supports more than one command or deployment target
- When the user's request already authorizes this local redeploy, continue without a second confirmation
- Run the build (unless it was skipped)
- Run the build command from the target directory
- Stream the output live, without silent buffering
- Time it with
{ start=$(date +%s); <cmd>; echo $(($(date +%s)-start))s; } - On exit code ≠ 0: show the last 20 lines, report the failure, and stop — do not run the deployment
- Run the deployment restart
- Run the restart command
- Time it the same way
- On exit code ≠ 0: show the last 20 lines, report the partial state, and stop
- Health check
- Docker Compose:
docker compose ps— confirm that every container showsUp - systemd:
systemctl is-active <unit> - pm2:
pm2 list | grep <name> - supervisord:
supervisorctl status <program> - Record the result; if the health-check command is unavailable, warn, but do not mark the skill run as failed
- Docker Compose:
Emit the run report
Step Command Exit Duration ─────── ────────────────────────────── ──── ──────── Build pnpm run build 0 18.2s Deploy docker compose up -d --build 0 6.3s Health docker compose ps 0 0.2s- Write the cache on success
- Write only when the build exited 0 (or was skipped as subsumed), the deployment exited 0, and the health check passed
- If both commands came from
.cortex.yaml, skip the write (the cache adds nothing) - On partial success (deployment 0 but unhealthy), skip the write — do not cache a configuration known to be broken
- If
.cortex/does not exist, create it (mode 0755), then write.cortex/redeploy-local.yamlwith the header# Auto-generated by redeploy-local skill; do not edit by hand - Record the current
skill_version, the resolved absoluteproject_path, an ISO 8601 UTCwritten_at, the chosen commands with their evidence, and every signal file read during inference together with its current mtime - On a write failure (permission denied, disk full, concurrent write): log
cache write skipped: <reason>and continue — the deployment already succeeded, and the cache is only an optimization layer
Interaction policy
- Ask only when detection is ambiguous or has failed
- Do not ask when
.cortex.yamlsupplies both commands - If several choices remain, present them together in one question
Input & Output
Input requirements
- The target directory (an explicit path, or CWD)
- Optional: a
.cortex.yamlcarryingbuild_commandand/ordeploy_command
Output contract
Provide:
- An inference report listing every chosen command and its evidence source (file + section/line + cross-reference)
- The build output streamed live, or the "skipped" note for a Compose-only project
- The deployment output streamed live
- The health-check result
- The run report table (command / exit code / duration per step)
- After a fully successful run (build + deployment + health check all pass), the inference cache written to
.cortex/redeploy-local.yaml
Restrictions
Hard Boundaries
- Never run
rm -rfor a destructive cleanup command without explicit user configuration - Never assume a systemd, pm2, or supervisord service name — extract it from the config file, or ask
- Never continue after a step fails — report and stop
- Never run the deployment restart without a preceding successful build (exit code 0), except for a Compose-only project, where the deployment subsumes the build
- Never inject or modify the target deployment's environment variables
- Never add
sudowithout supporting evidence, such as a systemd unit file owned by root while the current uid differs; ask the user to confirm the elevation before running
Failure modes
| Failure | Behavior |
| Directory not found | Abort immediately; show the exact path that was checked |
| No build evidence | Stop before the build; ask the user for build_command, or have them fill in .cortex.yaml |
| No deploy evidence | Stop before the deployment; ask the user for deploy_command, or have them fill in .cortex.yaml |
| Conflicting evidence, such as a Makefile that disagrees with CI | Stop; show both options and their sources to the user; let the user choose |
| Name/unit extraction failed | Stop; ask the user to supply the name explicitly |
| Build exit code ≠ 0 | Show the last 20 lines; stop; do not run the deployment |
| Deployment exit code ≠ 0 | Show the last 20 lines; stop; report the partial state |
| Health check failed | Warn; do not mark the skill run as failed; do not write the cache |
| Cache file malformed, or missing a required key | Treat as a cache miss; fall back to a full scan; do not delete it; overwrite it after a successful run |
| A recorded signal file was deleted, or its mtime changed | Cache miss; rescan |
Cached skill_version differs from the current one | Cache miss; rescan |
| Cache write failed (permissions / disk full) | Log a warning; do not mark the skill run as failed — the deployment already succeeded |
Self-Check
Core success criteria
- Directory confirmed: the target directory was verified to exist before any command ran
- Detection traceable: every inferred command is attributed to concrete evidence (file + line/section, ideally with a cross-reference) — not invented
- No double build: a Compose-only project skips the build step;
--buildhandles it inside the deploy command - Commands grounded: build and deployment commands were traced to project evidence or an explicit override; remaining ambiguity was resolved before execution
- Build succeeded: exit code 0 was confirmed before the deployment ran, or the build step was legitimately skipped
- Deployment succeeded: exit code 0 was confirmed before the health check
- Health check run: the status was checked and recorded (warn when unavailable; do not fail)
- Run report emitted: the table covers command / exit code / duration for every step
- Cache honored or refreshed:
.cortex/redeploy-local.yamlis read before scanning, and written only after a fully successful run (build + deployment + health check all pass)
Process quality checks
- No silent buffering: build and deployment output stream live rather than being buffered
- Durations recorded: wall-clock time was measured for every step
- Names/units come from the source: pm2/supervisord/systemd names are extracted from the config file, not hard-coded
- Interaction kept minimal: a clear, authorized local redeploy proceeds without a redundant confirmation
Examples
Consult worked examples when detection or recovery is ambiguous.
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
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.

