edit-component
Skill1 starsChanged 4 months agoMITView on GitHub
Edit an existing component in the user's React + TypeScript component library — add or change a prop, add functionality, make styling dynamic/prop-driven — then regenerate that component's section in DESIGN-SYSTEM.md and open a PR into the configured base branch. Use whenever the user wants to modify, extend, refactor, add a prop to, or change the behavior/styling of an existing component, or says things like "add a `loading` prop to CommonButton", "make Card padding configurable", "the Modal should support a custom footer", "ship a PR for this change".
- Reads credentials
- Commits and pushes
In this repository4 other files it gives its agents.
- audit-librarySkill
- create-componentSkill
- delete-componentSkill
- use-componentSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 8 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 53
Bring the component toward the standard while you're in it: If it violates a rule (wrong size scale, wrong axis/prop name, wrong semantic …
- Distinctive: line 57
Close prop gaps (non-breaking, additive): Check the component against §2.1/§2.2 of the standard.
- Distinctive: line 68
Read Foundations + Conventions in the brain so token names are exact.
- Distinctive: line 81
Keep it backwards-compatible unless the user explicitly accepted a break.
- Very specific: line 82
Update *.stories.* to demonstrate the new prop.
- Distinctive: line 108
If the user corrects a convention ("ghost buttons never get a shadow", "default variant is secondary"), append a generalized, scoped rule:
- Very specific: line 139
After the PR opens, offer to run design:accessibility-review and design:design-critique against the diff as automated reviewers.
- Very specific: line 148
Never edit a component absent from the library — offer create-component.
- Distinctive: line 149
Never break an existing prop's contract without explicit confirmation.
- Distinctive: line 150
Never write raw color/spacing when a token exists.
- Distinctive: line 151
Always regenerate the brain section in the same commit as the code — they ship together or not at all.
≈ “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
Forge — Edit Component
Prerequisite: forge.config.json exists at the repo root (run forge init once).
Change an existing component so it matches the design system, self-documents
back into the brain, and ships as a reviewable PR into the base branch from
forge.config.json git.prBase (defaults to main). Closed loop:
code change → brain section regenerated → PR. The brain can't drift because the
same action that edits the code rewrites its section.
When this triggers
The user wants to change a component that already exists in the library. If the
component is not in the brain (and not in source), stop — offer
create-component instead. Never invent a component or props.
Inputs to confirm (ask at most one question)
- Which component and what change, concretely — prop name, type, default, behavior.
- Repo location (path to the local clone) if not already known.
- Backwards-compatibility — breaking change acceptable, or must the default preserve current behavior? Default to non-breaking.
Workflow
1. Locate and load
- Confirm the component exists: find its
## <Name>section in${CLAUDE_PLUGIN_ROOT}/skills/_shared/DESIGN-SYSTEM.md. If absent, stop (see above). - In the repo, read the component file (
src/components/<Name>/<Name>.tsx), its co-located<Name>.css, and its*.stories.*/*.test.*if present. Stories show the prop surface you must not break; tests show behavior to preserve. - Load the rules, in priority order: the rules in
forge.config.json+ the standard at${CLAUDE_PLUGIN_ROOT}/skills/_shared/references/component-standard.md(the enforceable spec — naming, prop API, sizes, a11y, deprecation policy), then.../conventions.md, then.../standing-guidance.md. Standing guidance overrides defaults; the standard overrides the component when they disagree. - Bring the component toward the standard while you're in it. If it violates a
rule (wrong size scale, wrong axis/prop name, wrong semantic color value, raw
hex), fix it non-breaking per the deprecation policy: add the
correct name/prop, keep the old one as a
@deprecatedalias. Never rename in place. - Close prop gaps (non-breaking, additive). Check the component against §2.1/§2.2
of the standard. Add missing baseline/type props with safe defaults (e.g. add
loading/disabled/sizeto a button,error/requiredto an input, controlledopen/onOpenChangeto a disclosure). MakeonClick/onChangepass the native event if they currently drop it (additive second-arg or widened signature). - Fix dead props & type bugs you encounter (unused interface props, documented-but- absent props, required-but-defaulted unions).
- Fix the required ARIA for the type (§4.1) — add
aria-liveto alerts, a real focus trap to overlays, roles/keyboard to menus/tabs/sliders,aria-labelto icon buttons. - Migrate tokens opportunistically — switch any raw
--slate-*/--gray-*/hex text to canonical--text-*, and raw px to--space-*/--radius-*/--font-size-*. - Read Foundations + Conventions in the brain so token names are exact.
2. Make the change, in the library's own style
- Match existing patterns in the file: prop ordering,
forwardRef, how variants are typed (string-literal unions, never enums), how class names are composed (the project'sclsx-style helper, never ad-hoc template strings), how tokens are referenced. Read before you write. - Bias to dynamic, prop-driven design. To change styling/behavior, add a typed
prop with a default that preserves current behavior (e.g.
padding?: 'small' | 'medium' | 'large'defaulting to today's value) rather than hardcoding a new value. - Reference design tokens by canonical name from the brain's Foundations; never introduce raw hex/px when a token exists.
- Keep it backwards-compatible unless the user explicitly accepted a break.
- Update
*.stories.*to demonstrate the new prop; add/adjust a test if behavior changed. A new prop without a story is incomplete.
3. Regenerate the brain section (self-improvement — do not skip)
Rebuild this component's section from the changed source:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/_shared/scripts/sync_design_system.py" \
--repo <repo-path> --component <Name> \
--brain "<repo-path>/DESIGN-SYSTEM.md"It re-extracts props/types/defaults (via react-docgen-typescript when Node is
present, regex fallback otherwise), pulls tokens referenced, regrabs the Usage
snippet from stories, and rewrites the ## <Name> section in place. Props read
from real source become verified (the _(inferred)_ tag is dropped). Read
its JSON output and confirm the section now reflects your change.
The canonical brain lives in the library repo root (
<repo-path>/DESIGN-SYSTEM.md) and is committed in the same PR as the code. The plugin's${CLAUDE_PLUGIN_ROOT}/skills/_shared/DESIGN-SYSTEM.mdstays in sync via the consuming workflow — always target the repo brain on writes. Tokens for any follow-onrebuild_brain.py --brain "<repo-path>/DESIGN-SYSTEM.md"come from<repo-path>/forge.config.jsonrepo.tokensCss(passed as--tokens-css).
4. Capture corrections as durable guidance
If the user corrects a convention ("ghost buttons never get a shadow", "default variant is secondary"), append a generalized, scoped rule:
python3 "${CLAUDE_PLUGIN_ROOT}/skills/_shared/scripts/record_guidance.py" \
--rule "Button-like components: default variant is 'secondary', never 'primary'." \
--scope components \
--store "${CLAUDE_PLUGIN_ROOT}/skills/_shared/references/standing-guidance.md"Chat is forgotten; the store is read on every future run. This is how the same mistake stops recurring.
5. Open the PR (into the configured base branch)
bash "${CLAUDE_PLUGIN_ROOT}/skills/_shared/scripts/open_pr.sh" \
--repo <repo-path> --component <Name> --action edit \
--summary "Add loading prop to <ComponentName>" \
--paths "src/components/<Name>/<Name>.tsx src/components/<Name>/<Name>.css DESIGN-SYSTEM.md"Always pass --paths with exactly the files you changed — open_pr.sh stages
only those, so no stray working-tree file (a local .env, secrets, WIP) is swept
into the PR. Use --no-push to commit without pushing.
Creates branch forge/edit/<name>-<slug>, commits code + regenerated brain
section + any guidance in one commit, pushes, and runs gh pr create --base
<git.prBase from forge.config.json, defaults to main> with a templated body
(what changed, tokens touched, review checklist). If gh is absent it prints
the exact push + PR commands and the branch name.
After the PR opens, offer to run design:accessibility-review and
design:design-critique against the diff as automated reviewers.
Output to the user
Report concisely: component changed, the new/changed prop signature, that the
brain section was regenerated (verified vs inferred), and the PR link (or branch +
command if gh was unavailable). Don't paste the whole diff — link the PR.
Guardrails
- Never edit a component absent from the library — offer
create-component. - Never break an existing prop's contract without explicit confirmation.
- Never write raw color/spacing when a token exists.
- Always regenerate the brain section in the same commit as the code — they ship together or not at all.
- Respect the team rule ("keep components unmodified — discuss with the design
system team"): every change goes through a PR into the configured base branch
(
forge.config.jsongit.prBase, defaults tomain) for review.
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.

