AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Refacil:apply

skill-erikole21-refacil-sdd-ai-apply · by Erikole21

Implement the tasks of a proposed change — verifies artifacts and working branch, builds a structured briefing, and delegates to the refacil-implementer sub-agent to execute the implementation in isolated context

No reviews yet
0 installs
30 views
0.0% view→install

Install

$ agentstack add skill-erikole21-refacil-sdd-ai-apply

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-erikole21-refacil-sdd-ai-apply)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
3mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Refacil:apply? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

refacil:apply — Implementation Entrypoint

This skill is a wrapper that verifies the critical preconditions (SDD artifacts and working branch), builds a structured briefing with the key context already extracted, and delegates the implementation to the refacil-implementer sub-agent. The briefing prevents the sub-agent from rediscovering from scratch — it starts implementing, not exploring.

Prerequisites: sdd profile from refacil-prereqs/SKILL.md + rules from METHODOLOGY-CONTRACT.md.

Flow

Step 0: Verify SDD artifacts exist (blocking)

Run refacil-sdd-ai sdd list --json to get the active changes.

  • If there are no active changes: inform to run /refacil:propose and stop.
  • If there is a single active change: use that changeName.
  • If there are multiple active changes: list the names and ask which one to implement. Do not invoke the sub-agent with ambiguous scope.

With the selected changeName, run refacil-sdd-ai sdd status --json and parse the JSON:

{
  "name": "...",
  "artifacts": { "proposal": bool, "design": bool, "tasks": bool, "specs": bool },
  "tasks": { "total": N, "done": N, "pending": N },
  "reviewPassed": bool,
  "ready": { "forApply": bool, "forArchive": bool }
}

Validations:

  • Build missingArtifacts from every false value in artifacts (proposal, design, tasks, specs) and report the complete list. Do not stop at the first missing artifact.
  • If ready.forApply is false or missingArtifacts.length > 0:

`` The change at refacil-sdd/changes/[name]/ is incomplete. Missing: [complete list of artifacts with false] Run: /refacil:propose to complete the artifacts before implementing. `` Stop.

Note: ready.forApply is the contract source of truth and is true only when proposal.md, design.md, tasks.md, and a valid spec source exist. specs is true if non-empty specs.md exists in the root and/or at least one non-empty .md exists under specs/**/*.md (recursive; empty folders do not count). The same source set is used by sdd status, sync-spec, test/verify criteria extraction, and archive.

IMPORTANT: This command NEVER generates SDD artifacts. If they do not exist, the user must use /refacil:propose.

Step 1: Validate working branch (blocking — before delegating)

Run git branch --show-current to get the current branch.

If the current branch is already a working branch (feature/*, fix/*, hotfix/*, refactor/*, etc.), continue without interruption to Step 1.5.

If the current branch is protected, read METHODOLOGY-CONTRACT.md §4 — Protected branch policy before acting, then execute the gate protocol defined there. For this skill, Gates 1 and 2 are merged into a single interaction — propose and confirm in one message, wait for one reply.

See METHODOLOGY-CONTRACT.md §4 — Protected branch policy for the complete gate protocol.

Apply-specific annotations:

  • Default branch name: feature/ (e.g. feature/my-change). If the user provides a ticket or ID → feature/.
  • Stash handling: if uncommitted changes exist, inform the user in the same Gate 1+2 message and stash before creating the branch (git stash push -m "auto-stash-refacil"), restoring after (git stash pop).
  • If the user explicitly says "no" or "cancelar" → stop entirely. Do not create any branch.

Step 1.5a: Detect CodeGraph availability (non-blocking)

Run: refacil-sdd-ai codegraph status --json

Parse the JSON output and set codegraphAvailable:

  • true if and only if the result contains "installed": true AND "initialized": true
  • false in all other cases (not installed, not initialized, command fails, invalid JSON, or any error)

IMPORTANT: if the index is not available, continue silently — do NOT gate, pause, ask, or wait. Apply does not interrupt for CodeGraph. Unlike /refacil:propose, /refacil:explore, or /refacil:bug (which benefit from graph traversal to discover scope), /refacil:apply typically follows a propose that already resolved the architecture. The implementer uses CodeGraph only for structural lookups during implementation, not for scope discovery.

Step 1.5: Build structured briefing (reduces sub-agent tool calls)

Before invoking the sub-agent, extract the key context by reading the artifacts. This prevents the sub-agent from rediscovering them from scratch.

  1. Objective — read the first section of refacil-sdd/changes//proposal.md. Extract the objective in 1-2 sentences.
  2. File scope — read refacil-sdd/changes//design.md. Extract:
  • List of files to create (full paths)
  • List of files to modify (full paths)
  1. Tasks — read refacil-sdd/changes//tasks.md. Extract the full numbered list.
  2. testScope — default scoped. Inspect $ARGUMENTS and the user message invoking this skill for explicit whole-repo regression (e.g. full, all tests, whole suite, suite completa, suite completa del repo). If present → testScope: full. Otherwise scoped.
  3. testBaselineCommand — resolve the §3 baseline command language-agnostically at the affected component root (nearest ancestor of the files in scope.create/scope.modify with a stack manifest — per §3 component principle). Pass it verbatim. The implementer derives its own smoke command dynamically after editing — the BRIEFING must NOT include a precomputed smokeTestCommand. Do not pre-narrow the baseline here; narrowing is the implementer's responsibility.

> Note — component-rooted, no pre-narrowing: the wrapper resolves the baseline at the component root (not necessarily the monorepo root). The implementer uses git diff/git status after editing to discover the actual touched files, then calls sdd test-scope itself (which handles the cd prefix automatically). This keeps the BRIEFING minimal and makes the smoke reflect what was actually changed in this run.

  1. Architecture context — read .agents/stack.md if it exists; if not, .agents/architecture.md; if neither exists, read only the first 60 lines of AGENTS.md. Do not read the entire .agents/ folder.

Build the BRIEFING block that you will include literally in the delegation prompt:

BRIEFING:
changeName: 
objective: 
scope:
  create: [path/new-file-1.ts, path/new-file-2.ts, ...]
  modify: [path/existing-1.ts, path/existing-2.ts, ...]
  doNotTouch: [refacil-sdd/, .claude/, .cursor/, .opencode/, AGENTS.md, package-lock.json]
  # Note: also do not modify global Codex user dir (~/.codex/) — skills/agents/hooks are outside the repo.
tasks:
  1. 
  2. 
  ...
testScope: scoped | full
testBaselineCommand: 
codegraphAvailable: true | false
verificationWarning: 
architectureContext: |
  
specsNote: 

Step 2: Delegate to the refacil-implementer sub-agent

Before delegating, record that implementation has started:

refacil-sdd-ai sdd set-memory  --state apply-in-progress --actor apply-skill

If the command fails, continue silently — it must not block the flow.

Invoke the refacil-implementer sub-agent passing it the BRIEFING from the previous step plus:

  • changeName (redundant with the briefing, but the guardrail needs it)
  • If the user requested detailed mode, indicate it. Default: concise.

The sub-agent will use the briefing as the primary guide and will only read the files in scope.modify to understand existing interfaces — it will not re-read the already-extracted artifacts.

Returns ONE single message with the report + JSON block fenced as `refacil-apply-result .

Step 2.5: Save cross-skill memory (memory.yaml)

After parsing the refacil-apply-result block and only if result is not "FAILED":

  • Extract touchedFiles from the result (list of files actually created/modified by the implementer).

Run:

refacil-sdd-ai sdd set-memory  \
  --last-step apply \
  --touched-files "" \
  --state applied \
  --actor apply-skill

This command merges into memory.yaml at the repo root using findProjectRoot() — no manual path construction needed.

If result is "FAILED", skip and wait for user instructions.

Step 2.6: Log CodeGraph telemetry (silent)

After parsing the refacil-apply-result block, run once (do not mention it to the user unless it fails):

refacil-sdd-ai compact log-codegraph-event --skill implementer --has-graph  --tool-calls  --tokens 
  • --has-graph: use the codegraphAvailable value detected in Step 1.5a (true or false).
  • --tool-calls: number of codegraph_* tool calls the sub-agent made (0 if it did not use the graph).
  • --tokens: conservative estimate of tokens saved (~800–1500 per useful tool call; 0 if no graph or no calls).

Estimate --tool-calls and --tokens from the sub-agent's ` block using the same criteria as explore/SKILL.md` Step 1.5. If the command fails, ignore it; it must not block the flow.

Step 3: Present result and next step

Show the user the report (everything before the refacil-apply-result block). Do not show the JSON block — it is internal metadata.

After the report add:

The next step is to generate/adjust unit tests.
Do you want me to continue with /refacil:test?
(The flow then continues with /refacil:verify)

If the sub-agent returned result: "PARTIAL" or "FAILED", present the issues to the user and ask for instructions before continuing.

Rules

  • NEVER generate SDD artifacts from this command — that is exclusively /refacil:propose's responsibility.
  • Meet the preconditions of Step 0 (complete artifacts) and Step 1 (valid working branch) before delegating.
  • Always build the briefing (Step 1.5) before delegating — it is the key piece that reduces the sub-agent cost.
  • Always delegate implementation to the sub-agent. Do not replicate implementation logic or SDD artifact-apply logic here.
  • Even when artifacts are Spanish, implementation output is English-only: created file/folder names, source code, test code, identifiers, and code comments.
  • Flow continuity: if the user confirms affirmatively ("yes", "ok", "go", "continue", etc.) the continuity question in Step 3, immediately execute /refacil:test. Do not describe it in text or wait for the user to type it. (See METHODOLOGY-CONTRACT.md §5.)

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.