Tooling Lab
30 minutes
prompts
workflow
automation
Agentic Workflow Step
Implement prompt templates and repo rules for effective agent collaboration in real projects.
Overview
This lab teaches you how to set up reusable prompt templates and repository rules that make AI agents more effective and consistent in your projects.
Prompt Template System
Directory Structure
your-project/
├── .github/
│ └── prompts/
│ ├── feature.md
│ ├── bugfix.md
│ ├── refactor.md
│ └── review.md
├── AGENTS.md
└── ...
Feature Request Template
Create .github/prompts/feature.md:
Feature Request Template
engineer
Structured template for requesting new features
# Feature Request: {{feature_name}} ## Requirements {{requirements}} ## Technical Constraints - Follow existing patterns in src/ - Add tests for new functionality - Update documentation if needed ## Deliverables 1. Implementation in appropriate module 2. Unit tests with >80% coverage 3. Update CHANGELOG.md ## Quality Checklist - [ ] TypeScript types are complete - [ ] No eslint warnings - [ ] Tests pass - [ ] Reviewed for security concerns
Variables:
{{feature_name}}
{{requirements}}
{{constraints}}
Bug Fix Template
Create .github/prompts/bugfix.md:
Bug Fix Template
engineer
Template for requesting bug fixes
# Bug Fix Request ## Issue {{issue}} ## Expected Behavior {{expected}} ## Actual Behavior {{actual}} ## Investigation Steps 1. Identify root cause 2. Propose minimal fix 3. Explain why fix works ## Constraints - Minimal change to fix the issue - Don't refactor unrelated code - Add regression test
Variables:
{{issue}}
{{expected}}
{{actual}}
Repository Rules (AGENTS.md)
Create a comprehensive AGENTS.md:
markdown# AGENTS.md - AI Assistant Guidelines ## Project Context This is a [project type] built with [tech stack]. ## Code Standards ### Naming Conventions - Files: kebab-case (user-profile.ts) - Components: PascalCase (UserProfile.tsx) - Functions: camelCase (getUserProfile) - Constants: SCREAMING_SNAKE_CASE ### File Organization - Components in src/components/ - Utilities in src/lib/ - Types in src/types/ - Tests alongside source files ## AI Behavior Rules ### DO - Follow existing code patterns - Add types to all new code - Write tests for new features - Explain changes in commit messages ### DON'T - Modify package-lock.json directly - Add new dependencies without approval - Use console.log in production code - Skip error handling ## Testing Requirements - Unit tests for utilities - Integration tests for API routes - Component tests for complex UI ## Security - Never commit secrets - Validate all user input - Use parameterized queries - Sanitize output ## Review Checklist Before suggesting changes, verify: - [ ] Code compiles without errors - [ ] Tests pass - [ ] Lint passes - [ ] No security vulnerabilities
Workflow Automation
Pre-Commit Hooks
Create .husky/pre-commit:
bash#!/bin/sh npm run lint npm run typecheck npm test -- --passWithNoTests
AI-Friendly Git Messages
Configure commit message templates:
bashgit config commit.template .gitmessage
Create .gitmessage:
# <type>(<scope>): <subject>
#
# Types: feat, fix, docs, style, refactor, test, chore
#
# Body: explain what and why
#
# Footer: reference issues
Prompt Chaining
For complex tasks, break into steps:
Step 1: Analysis
Analysis Step
engineer
First step - understand the problem
Before making changes, analyze: 1. What files are involved? 2. What are the dependencies? 3. What tests cover this code? 4. What could break? Provide your analysis before suggesting code.
Step 2: Plan
Planning Step
engineer
Second step - plan the changes
Based on your analysis, create a plan: 1. List files to modify 2. Order of changes 3. Risks and mitigations 4. Testing approach Get approval before implementing.
Step 3: Implement
Implementation Step
engineer
Third step - make changes
Implement the approved plan: - One file at a time - Show diff for each change - Run tests after each file - Stop if tests fail
Verification
Your workflow is set up correctly if:
- AGENTS.md exists with clear guidelines
- Prompt templates are in .github/prompts/
- Pre-commit hooks run on commit
- AI responses follow your conventions
Common Mistakes
| Mistake | Fix |
|---|---|
| Vague prompts | Use structured templates |
| No constraints | Add explicit limits |
| Skipping review | Always verify before commit |
| Too much context | Focus on relevant files only |