Skip to content

Commit 4f79871

Browse files
authored
Reorganize template setup workflow for better agent clarity (#11)
* feat: add self-disable step to template setup workflow - Add final step to change alwaysApply from true to false after template initialization - Prevents detailed template setup instructions from consuming context window space - Ensures template setup rules are visible during one-time setup but hidden afterwards - Maintains accessibility via reference in workflow.mdc if needed later * feat(template): Add branch protection and issues setup to template workflow - Add GitHub CLI commands to enable issues in new repos - Include complete branch protection rules that match template repo - Provide both CLI and manual setup instructions - Document all protection settings for consistency across projects * refactor(template): Reorganize template setup workflow for better clarity - Nest Environment File Distinction under step 2 (Remove template content) - Nest Branch Protection Rules Summary and Manual Setup under step 4 - Eliminate duplicate sections and improve contextual flow - Group related information with their respective steps - Reduce cognitive load for agents following the workflow * docs: add step to return to main after creating PR - Added step 6 to git workflow: 'Return to Main' - Ensures developers always checkout main and pull after creating PR - Prevents feature mixing and keeps local environment current - Renumbered final step to 7 for clarity
1 parent 2133ff0 commit 4f79871

2 files changed

Lines changed: 42 additions & 60 deletions

File tree

.cursor/rules/template_setup.mdc

Lines changed: 40 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -16,68 +16,49 @@ When a user prompts "initialize this project as <my project name>", I will **ONL
1616
- Update `SECURITY.md` to remove template references
1717
- Remove or update any hardcoded paths in configuration files
1818

19+
**Environment File Distinction:**
20+
- **Template `.env.example`**: Contains TaskMaster CLI configuration (ANTHROPIC_API_KEY, PERPLEXITY_API_KEY, etc.)
21+
- **Project `.env`**: Will contain application-specific configuration (database URLs, app API keys, etc.)
22+
- **Never mix these**: TaskMaster configuration is separate from project application configuration
23+
3. **Enable Issues** (if GitHub repository):
24+
```bash
25+
gh api repos/OWNER/REPO --method PATCH --field has_issues=true
26+
```
27+
4. **Set Branch Protection Rules** (if GitHub repository):
28+
```bash
29+
gh api repos/OWNER/REPO/branches/main/protection \
30+
--method PUT \
31+
--field required_status_checks='{"strict":true,"contexts":[],"checks":[]}' \
32+
--field required_pull_request_reviews='{"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"require_last_push_approval":false,"required_approving_review_count":1}' \
33+
--field required_signatures='{"enabled":false}' \
34+
--field enforce_admins='{"enabled":false}' \
35+
--field required_linear_history='{"enabled":false}' \
36+
--field allow_force_pushes='{"enabled":true}' \
37+
--field allow_deletions='{"enabled":false}' \
38+
--field block_creations='{"enabled":false}' \
39+
--field required_conversation_resolution='{"enabled":false}' \
40+
--field lock_branch='{"enabled":false}' \
41+
--field allow_fork_syncing='{"enabled":false}'
42+
```
43+
44+
**Branch Protection Rules Summary:**
45+
- **Pull Request Reviews**: 1 approval required
46+
- **Status Checks**: Strict mode enabled
47+
- **Force Pushes**: Allowed
48+
- **Branch Deletions**: Disabled
49+
- **Admin Enforcement**: Disabled (admins can bypass)
50+
51+
**Manual Setup Alternative:**
52+
If CLI commands fail, manually configure in GitHub:
53+
1. Go to repository Settings → Branches
54+
2. Add rule for `main` branch
55+
3. Enable "Require a pull request before merging" (1 approval)
56+
4. Enable "Require status checks to pass before merging" (strict mode)
57+
5. **Remove from Context Window** - Change `alwaysApply: true` to `alwaysApply: false` in the frontmatter of `.cursor/rules/template_setup.mdc`
58+
1959
## What NOT to Include in Template Initialization
2060
- **Do NOT set up TaskMaster** - This is a separate workflow that requires explicit user request
2161
- **Do NOT create PRDs** - Project Requirements Documents are separate from template setup
2262
- **Do NOT copy `.env.example` to `.env`** - Only do this if user specifically requests TaskMaster CLI setup
2363
- **Do NOT initialize git repository** - Template initialization is separate from git setup
2464
- **Do NOT create tasks or project management files** - Focus only on template structure
25-
26-
## Environment File Distinction
27-
- **Template `.env.example`**: Contains TaskMaster CLI configuration (ANTHROPIC_API_KEY, PERPLEXITY_API_KEY, etc.)
28-
- **Project `.env`**: Will contain application-specific configuration (database URLs, app API keys, etc.)
29-
- **Never mix these**: TaskMaster configuration is separate from project application configuration
30-
31-
## Branch Protection Setup (Optional)
32-
If the new project is a GitHub repository, consider setting up branch protection rules to match the template:
33-
34-
### Enable Issues
35-
First, ensure issues are enabled in the repository:
36-
37-
```bash
38-
# Enable issues in the repository
39-
gh api repos/OWNER/REPO --method PATCH --field has_issues=true
40-
```
41-
42-
### Required Branch Protection Rules
43-
Apply these settings to the `main` branch:
44-
45-
```bash
46-
# Enable branch protection with pull request reviews
47-
gh api repos/OWNER/REPO/branches/main/protection \
48-
--method PUT \
49-
--field required_status_checks='{"strict":true,"contexts":[],"checks":[]}' \
50-
--field required_pull_request_reviews='{"dismiss_stale_reviews":false,"require_code_owner_reviews":false,"require_last_push_approval":false,"required_approving_review_count":1}' \
51-
--field required_signatures='{"enabled":false}' \
52-
--field enforce_admins='{"enabled":false}' \
53-
--field required_linear_history='{"enabled":false}' \
54-
--field allow_force_pushes='{"enabled":true}' \
55-
--field allow_deletions='{"enabled":false}' \
56-
--field block_creations='{"enabled":false}' \
57-
--field required_conversation_resolution='{"enabled":false}' \
58-
--field lock_branch='{"enabled":false}' \
59-
--field allow_fork_syncing='{"enabled":false}'
60-
```
61-
62-
### Branch Protection Summary
63-
- **Pull Request Reviews**: 1 approval required
64-
- **Status Checks**: Strict mode enabled
65-
- **Force Pushes**: Allowed
66-
- **Branch Deletions**: Disabled
67-
- **Admin Enforcement**: Disabled (admins can bypass)
68-
69-
### Alternative: Manual Setup
70-
1. Go to repository Settings → Branches
71-
2. Add rule for `main` branch
72-
3. Enable "Require a pull request before merging"
73-
4. Set "Required number of approvals before merging" to 1
74-
5. Enable "Require status checks to pass before merging"
75-
6. Check "Require branches to be up to date before merging"
76-
77-
## After Template Initialization
78-
Template initialization is complete after customizing the project files. TaskMaster, PRD creation, and git setup are separate workflows that require explicit user requests.
79-
80-
### Final Step: Remove from Context Window
81-
After completing template initialization, update this rule file to stop consuming context space:
82-
- **Change `alwaysApply: true` to `alwaysApply: false`** in the frontmatter of `.cursor/rules/template_setup.mdc`
83-
- This prevents the detailed template setup instructions from taking up context window space after the one-time setup is complete

.cursor/rules/workflow.mdc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ For detailed steps on initializing a git repository when cloning the template di
4848
3. **Commit Changes**: `git add .` and `git commit -m "descriptive message"`
4949
4. **Push Branch**: `git push -u origin feature/descriptive-name`
5050
5. **🚨 CRITICAL: Open Pull Request**: `gh pr create --title "Title" --body "Description"` or use GitHub web interface - **THIS STEP IS MANDATORY**
51-
6. **Merge via PR**: Never use `git push origin main` directly
51+
6. **Return to Main**: `git checkout main && git pull origin main` - **ALWAYS do this after creating PR to prepare for next task**
52+
7. **Merge via PR**: Never use `git push origin main` directly
5253
- **Branch Naming Conventions**:
5354
- `feature/feature-name` for new features
5455
- `fix/bug-description` for bug fixes

0 commit comments

Comments
 (0)