gain-backport
Skill9 starsChanged 5 months agoMITView on GitHub
Classify a fix made to a GAIN-generated workspace app and propagate it to the right level — GAIN harness prompt, spec template, or documentation. Prevents the same issue from recurring in future runs.
- Commits and pushes
In this repository18 other files it gives its agents.
- backend/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/adhoc.mdcCursor rule
- .cursor/rules/agents.mdcCursor rule
- .cursor/rules/ai-engineering.mdcCursor rule
- .cursor/rules/backend-python.mdcCursor rule
- .cursor/rules/code-analysis.mdcCursor rule
- .cursor/rules/coding.mdcCursor rule
- .cursor/rules/guardrails.mdcCursor rule
- .cursor/rules/help.mdcCursor rule
- .cursor/rules/questions.mdcCursor rule
- backend-quality-gateSkill
- creating-commitsSkill
- deploy-requirementsSkill
- pr-descSkill
- pr-loc-breakdownSkill
- release-notesSkill
- specflow-usability-checkSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
If empty, ask: "Describe the fix — what was broken, what you changed, and which file(s) you edited in the workspace repo."
- Distinctive: line 21
Ask these questions (all at once, not one by one):
- Distinctive: line 33
Use the answers to classify the fix:
- Distinctive: line 63
If the user is in the GAIN harness repo:
- Very specific: line 64
Read the relevant section of agents_claude_code.py
- Distinctive: line 67
Ask: "Apply this change? (yes/no)"
- Very specific: line 68
If yes: apply the edit, run make unit-tests, confirm tests pass
- Distinctive: line 71
If the user is NOT in the GAIN harness repo:
- Distinctive: line 85
If the user is in the workspace repo:
- Distinctive: line 89
If yes: apply, then ask if they want a PR:
- Distinctive: line 98
After merge, remind them to trigger a redeploy.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
GAIN Backport
You are helping a user classify a fix discovered in a GAIN-generated workspace app and propagate it to the correct level so future runs don't have the same problem.
Input
The user provided: $ARGUMENTS
If empty, ask: "Describe the fix — what was broken, what you changed, and which file(s) you edited in the workspace repo."
Step 1 — Gather context
Ask these questions (all at once, not one by one):
- What was the symptom? (error message, test failure, deployment failure, app misbehaviour)
- What file(s) did you change? (e.g.
helm/recipe-ai/templates/backend-deployment.yaml,backend/src/config.py) - Is this fix specific to this app/spec, or would any GAIN-generated app need it?
- Did the deploy agent fix this on its own in a previous iteration, or did you have to fix it manually?
- Are you currently in the GAIN harness repo, the workspace repo, or neither? (Run
pwdif unsure)
Step 2 — Classify using the decision tree
Use the answers to classify the fix:
Does every GAIN-generated app need this fix regardless of what they do?
YES → Level 1 or 2
Is the fix about what the agent generates (prompts, spec completeness checks)?
YES → Level 1 (GAIN harness — agents_claude_code.py)
NO → Level 2 (spec template — AGENT_GUIDE.md or deployment spec)
Does it only affect certain types of apps (e.g. those using postgres, those with LLM integration)?
YES → Level 2 (spec template — conditional pattern)
Did the deploy agent fix this on its own without human intervention?
YES → Level 3 (acceptable deployment friction — document it, no code change needed)
Is it specific to this one run / deployment environment?
YES → Level 4 (run-specific — no propagation)Tell the user the classification and explain why before proceeding.
Step 3 — Take action based on level
Level 1 — GAIN harness fix
Target file: backend/app/prompts/agents_claude_code.py in the GAIN harness repo.
If the user is in the GAIN harness repo:
- Read the relevant section of
agents_claude_code.py - Identify the right place to add the fix: Part F spec completeness table,
_deployment_instructions(), or the CONTRADICTION definition - Propose the change with a clear before/after diff
- Ask: "Apply this change? (yes/no)"
- If yes: apply the edit, run
make unit-tests, confirm tests pass - Produce a commit message and ask if the user wants to commit
If the user is NOT in the GAIN harness repo:
- Describe exactly what needs to change and in which function/section
- Produce a ready-to-apply patch the user can apply when they're in the right repo
Level 2 — Spec template fix
Target file: specs/deployment/AGENT_GUIDE.md in the workspace repo (this file is copied to each new workspace at generation time).
Sub-cases:
A — Fix the spec in the current workspace (affects this workspace + future workspaces via the GAIN harness template):
If the user is in the workspace repo:
- Read the relevant section of
specs/deployment/AGENT_GUIDE.md - Propose the change
- Ask: "Apply this change? (yes/no)"
- If yes: apply, then ask if they want a PR:
After merge, remind them to trigger a redeploy.git checkout -b fix/spec-{short-description} git add specs/deployment/AGENT_GUIDE.md git commit -m "spec: {description of fix}" git push -u origin fix/spec-{short-description} gh pr create --title "spec: {description}" \ --body "Backport fix from GAIN run. See gain-user-experience-guide.md for context."
B — Also update the GAIN harness so future generated workspaces get this spec from day one:
- Tell the user: "This spec change should also be applied to the GAIN harness so future generated workspaces have it. The source template is in the GAIN harness repo — propagate it there when you have a chance."
Level 3 — Document it (no code change needed)
The deploy agent fixed this autonomously. No propagation required, but it's worth noting if it increased the deploy iteration count.
Output:
Classification: Level 3 — Run-level detail (agent fixed autonomously)
This is expected deployment friction. The agent is designed to absorb these.
No code changes needed in the harness or spec.
If this fix took more than 2–3 deploy iterations to reach:
→ Consider whether a Level 2 spec change would give the agent a better starting point.
Document in your run notes if keeping a record of iteration sources.Level 4 — Run-specific, no action needed
Classification: Level 4 — Run-specific
This fix is specific to this deployment/environment and won't recur in other runs.
No propagation needed.Step 4 — Final summary
Output a summary of what was classified and what was done (or what the user should do):
Backport summary
────────────────
Fix: [brief description]
Classification: Level [N] — [label]
Action taken: [what was done or what needs to be done]
Propagates to: [future runs? this workspace only? nowhere?]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.

