mcpField
S
setup-rules

setup-rules

github.com/jinsyinAgent workflows142 installsUpdated 1w ago
Repository

About setup-rules

setup-rules is a skill for configuring project rules for Agents. It interviews for selections, assembles convention files in a fixed order, and installs selected adapters, subagents, and sensitive-file restrictions; an update mode refreshes existing items.

Key features

  1. 01Interview for rule and component selections
  2. 02Assemble convention files in a fixed order
  3. 03Install selected Agent and editor adapters
  4. 04Merge sensitive-file access restrictions
  5. 05Update installed items while preserving unmatched sections

Use cases

  1. 01Initialize Agent conventions for a project
  2. 02Configure selected Cursor or Antigravity adapters
  3. 03Restrict Agent access to specified sensitive files
  4. 04Refresh existing rule configuration from current assets

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/jinsyin/skills --skill setup-rules

After installing, type/setup-rulesin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

assets/
skillsw
assets/adapters/antigravity/
gemini.md
assets/adapters/claude/agents/
superpowers-final-reviewer.md
superpowers-fixer.md
superpowers-implementer.md
superpowers-re-reviewer.md
superpowers-task-reviewer.md
assets/adapters/codex/agents/
superpowers-final-review.toml
superpowers-fixer.toml
superpowers-implementer.toml
superpowers-re-reviewer.toml
superpowers-task-reviewer.toml
assets/adapters/cursor/
hooks.json
assets/adapters/cursor/agents/
general-purpose.md
superpowers-final-reviewer.md
superpowers-fixer.md
superpowers-implementer.md
superpowers-re-reviewer.md
superpowers-task-reviewer.md
assets/adapters/cursor/hooks/
enforce-subagent-model.sh
assets/adapters/cursor/rules/
subagent-model-policy.mdc
assets/conventions/
core.md
design.md
gsd.md
karpathy.md
matt.md
ponytail.md
superpowers.md
vibecoding.md
assets/templates/prototype/
AGENTS.md

Details

From the project README

setup-rules

Assemble, never author. Conventions live verbatim in assets/conventions/; concatenate selected files byte-for-byte in the fixed order. Merge sensitive-file restrictions into native Agent configuration without replacing unrelated settings.

Modes: setup-rules → Workflow; setup-rules update → Update.

Workflow requires an interactive interview: ask, wait, clarify, and confirm the final manifest before writing. Never infer optional selections from project evidence or defaults. Ask at most four focused questions per round; leave ambiguous items pending.

CategorySourceTargetCondition
Conventionsassets/conventions/*.mdCLAUDE.local.mdcore required; others independently selectable
Subagentsassets/adapters/<tool>/agents/.<tool>/agents/per tool/workflow
Cursor adapterassets/adapters/cursor/rules/, assets/adapters/cursor/hooks/, assets/adapters/cursor/hooks.json.cursor/rules/, .cursor/hooks/, .cursor/hooks.jsonindependently selectable
Antigravity adapterassets/adapters/antigravity/gemini.mdGEMINI.mdindependently selectable
skillswassets/skillswskillsw (project root, executable)independently selectable
Sensitive-file restrictionsreferences/sensitive-file-access.mdnative Agent configurationdefault set plus optional extras

Convention order is fixed: core → design → vibecoding → ponytail → karpathy → gsd → matt → superpowers. Skip unselected files.

Convention files:

  • assets/conventions/core.md
  • assets/conventions/design.md
  • assets/conventions/vibecoding.md
  • assets/conventions/ponytail.md
  • assets/conventions/karpathy.md
  • assets/conventions/gsd.md
  • assets/conventions/matt.md
  • assets/conventions/superpowers.md

Subagent bundles:

Agent bundleSourceProject targetCondition
Cursor general-purposeassets/adapters/cursor/agents/general-purpose.md.cursor/agents/general-purpose.mdindependently selectable
Superpowers agentsassets/adapters/<tool>/agents/superpowers-*.<tool>/agents/only when Superpowers is selected

Cursor adapter mapping:

Adapter fileProject target
assets/adapters/cursor/rules/subagent-model-policy.mdc.cursor/rules/subagent-model-policy.mdc
assets/adapters/cursor/hooks/enforce-subagent-model.sh.cursor/hooks/enforce-subagent-model.sh
assets/adapters/cursor/hooks.jsonmerged into .cursor/hooks.json

The Cursor adapter constrains Cursor subagent model and effort only. It is not Superpowers-specific; SDD is merely one workflow that may create Cursor subagents. Its selection is independent from agent definitions under assets/adapters/cursor/agents/. Do not create a Superpowers-specific model rule, command, wrapper, or model profile directory.

The Antigravity adapter copies assets/adapters/antigravity/gemini.md to the project-root GEMINI.md. The file contains general, composable rules.

skillsw wraps npx skills: ./skillsw clean install prunes stale skills, then restores from skills-lock.json; clean/install run either half; other args pass through.

Workflow

1. Locate project root. Git root, else working directory; user-given path wins.

2. Start the interview with Core. Print assets/conventions/core.md in full. Ask whether to include optional conventions (Design, Vibecoding, Ponytail, Karpathy, GSD, Matt and Superpowers), briefly summarize each, and offer GSD/Superpowers only when used. Wait for the response.

3. Ask about Cursor general-purpose. Independently ask whether to install assets/adapters/cursor/agents/general-purpose.md to .cursor/agents/general-purpose.md.

4. If Superpowers was selected, ask about its subagents. Offer only bundles with files under assets/adapters/<tool>/agents/; allow any combination, and copy each match to .<tool>/agents/.

5. If Cursor subagents are in scope from the interview, ask about the Cursor adapter. Explain that it installs the model/effort rule and fail-closed hook for every Cursor subagent.

6. Ask about the Antigravity adapter. Ask whether to install assets/adapters/antigravity/gemini.md as the project-root GEMINI.md.

7. Ask about skillsw. Independently ask whether to install assets/skillsw as project-root skillsw.

8. Collect sensitive files. Preselect every project file named .env, .env.dev, .env.test, or .env.prod. Ask for extra project-relative files or directories. Empty means only this set; remove it only by explicit opt-out. Never infer beyond it or read protected contents. Follow sensitive-file access controls.

9. Ask about Git tracking. Default for each applicable .<tool>/, .agent/ (Antigravity) and .agents/: track all except its skills/ subtree—add those exact directories to .gitignore, untrack their tracked files. Ask only: keep default, or custom per directory; use custom only when user asks. If skills-lock.json exists and skills end up ignored, also plan these skills-lock entries:

  • Keep skills-lock.json tracked and git add it; restores rebuild skills from it.

  • Add this block to .worktreeinclude so Claude Code/Codex copy skills into new worktrees; copying .claude/skills/ too would stop Claude Code reading main checkout's. Entry exists uncommented → add comment:

    # Copy installed skills to new worktrees; omit .claude/skills/ so Claude Code reads the main checkout's
    /.agents/skills/
    
  • .cursor/ in scope → add mkdir -p .agents && cp -R "$ROOT_WORKTREE_PATH/.agents/skills" .agents/ to .cursor/worktrees.json setup-worktree-unix.

10. Confirm the manifest. List outputs, sensitive targets, external settings, per-directory Git choices, exact ignore entries, tracked removals, and step 9 skills-lock entries. Confirm before writing.

11. Assemble and write CLAUDE.local.md. Always replace it with the selected files in fixed order; do not read or preserve the old file. Add the trailing blank line and verify the result matches the selected concatenation.

12. Install selected subagents, adapters, and rules. Copy only selected agent files and exact adapter mappings; never recursively copy an assets/adapters/<tool>/ directory. Create target directories if needed and copy files byte-for-byte. For the Antigravity adapter, copy assets/adapters/antigravity/gemini.md to the project-root GEMINI.md. For skillsw, copy assets/skillsw to project-root skillsw and chmod +x it. Merge the selected Cursor hook into an existing .cursor/hooks.json without dropping unrelated hooks. Before replacing a different existing file, show the conflict and ask for confirmation; never silently overwrite active edits or delete unrelated files.

13. Apply Git decisions. Add confirmed ignore entries and run git rm -r --cached on declined tracked files, preserving local files and unrelated rules. Apply step 9 skills-lock entries, merging into existing .worktreeinclude/.cursor/worktrees.json without dropping lines or commands. Stop for unmanaged active files; never rewrite history, delete worktree files, or commit/push without authorization.

14. Install sensitive-file restrictions. Merge the confirmed denies per the reference. Preserve unrelated or stricter settings; stop on incompatible policy. Report unenforced Antigravity UI and Cursor terminal/MCP paths.

15. Ensure CLAUDE.md and AGENTS.md. Leave existing files unchanged. Otherwise create CLAUDE.md with only # Project Conventions, and AGENTS.md with exactly:

@CLAUDE.local.md
@CLAUDE.md

16. Validate and report. Parse changed JSON/TOML, run available offline config-load checks, and test ignore matching without reading secrets. Report selections, changes, protected paths, limitations, Git decisions, and conflicts; if skills are ignored, point to Core's ### Skills restore command for fresh clones.

Update

Refresh only installed items from current assets, without asking: invoking update pre-authorizes every overwrite, overriding every ask, confirm, or stop-and-ask step in Workflow and the reference. New selections need full setup-rules. Skip Workflow steps 2–10, 13, 15.

1. Root. As Workflow 1; stop if CLAUDE.local.md is missing.

2. Detect. Match CLAUDE.local.md H2s to convention first H2s; existing targets mark installed subagents/adapters/skillsw; existing denies mark sensitive targets. Keep every unmatched H2 section, appended last in original order, so no user content is lost.

3. Write. Diff targets against assets and skip identical ones. Rebuild CLAUDE.local.md in fixed order plus kept sections; copy agents/adapters/skillsw byte-for-byte, keeping skillsw executable; replace only this skill's hook in .cursor/hooks.json; re-merge existing sensitive targets. On unparseable config or incompatible policy, skip and report that target.

4. Report. As Workflow 16, plus overwritten files, kept unmatched sections, and skipped targets.

Comments

Markdown supported