agentleFS
pr-pmpr-pm/prpm/.cursor/rules/creating-kiro-packages.md

prpm / rules

Cursor rule122 starsChanged 9 months agoMITView on GitHub

Guidelines for creating Kiro steering files and hooks with inclusion modes, foundational files, and event-driven automation

The file

We split this creating-kiro-packages.md into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Start with foundational files: product.md, tech.md, structure.md

    line 280
  2. Distinctive:

    Use always for core patterns: Code style, architecture principles

    line 281
  3. Distinctive:

    Use fileMatch for specific contexts: Component rules, API patterns

    line 282

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
creating-kiro-packages.md

Creating Kiro Packages

Quick reference for creating Kiro steering files and hooks with context-aware inclusion and event handling.

Package Types

TypeLocationFormatPurpose
Steering Files.kiro/steering/*.mdMarkdown + YAMLContext-aware instructions
Hooks.kiro/hooks/*.jsonJSONEvent-driven automation

Steering Files

Inclusion Modes

ModeFrontmatterWhen Applied
always (default)inclusion: alwaysAll contexts
fileMatchinclusion: fileMatch + fileMatchPatternFiles matching pattern
manualinclusion: manualUser manually triggers

Frontmatter Reference

---
inclusion: always  # always, fileMatch, or manual
fileMatchPattern: "components/**/*.tsx"  # REQUIRED for fileMatch
domain: testing  # Optional: for organization
---

Always Included (Default)

Workspace-wide standards applied to all contexts.

---
inclusion: always
---

# Core Technology Stack

## Stack
- Frontend: React 18 + TypeScript + Vite
- Backend: Node.js + Express + Prisma
- Database: PostgreSQL

## Universal Principles
- Write self-documenting code
- Keep functions under 50 lines

FileMatch (Conditional)

Applied when working with files matching the pattern.

---
inclusion: fileMatch
fileMatchPattern: "components/**/*.tsx"
domain: frontend
---

# React Component Guidelines

## Component Standards
- Use functional components with hooks
- Keep components under 200 lines
- Extract logic into custom hooks

Manual (On-Demand)

User explicitly activates when needed.

---
inclusion: manual
domain: performance
---

# Performance Optimization Guide

## Profiling First
- Always measure before optimizing
- Use Chrome DevTools
- Identify actual bottlenecks

Common FileMatch Patterns

# React components
fileMatchPattern: "*.tsx"
fileMatchPattern: "components/**/*.tsx"

# API routes
fileMatchPattern: "app/api/**/*"

# Tests
fileMatchPattern: "**/*.test.*"

# Documentation
fileMatchPattern: "*.md"

Foundational Files

Special steering files with reserved names:

product.md

---
inclusion: always
foundationalType: product
---

# Product Context

## Mission
Build the best task management app for remote teams.

## Key Features
1. Real-time collaboration
2. Offline-first architecture
3. Natural language task input

## User Personas
- Project Manager: Needs overview and reporting
- Team Member: Needs task details and updates

tech.md

---
inclusion: always
foundationalType: tech
---

# Technical Architecture

## Stack
- Frontend: React 18 + TypeScript + Vite
- Backend: Node.js + Express + Prisma
- Database: PostgreSQL
- Cache: Redis

## Architecture Patterns
- Clean architecture (domain/application/infrastructure)
- CQRS for complex operations
- Repository pattern for data access

structure.md

---
inclusion: always
foundationalType: structure
---

# Project Structure

## Directory Layout

src/ api/ # API routes and controllers domain/ # Business logic and entities services/ # Application services repositories/ # Data access layer


## File Naming Conventions
- Components: PascalCase (e.g., `UserProfile.tsx`)
- Services: camelCase with Service suffix (e.g., `userService.ts`)
- Types: PascalCase (e.g., `User.ts`)

Hooks

JSON configuration files for event-driven automation.

Hook Structure

{
  "name": "Hook Name",
  "description": "What this hook does",
  "version": "1",
  "when": {
    "type": "eventType",
    "patterns": ["glob", "patterns"]
  },
  "then": {
    "type": "actionType",
    "prompt": "Instructions for agent"
  }
}

Event Types

EventTriggers When
fileCreatedNew files created matching patterns
fileModifiedFiles modified matching patterns
fileDeletedFiles deleted matching patterns

Action Types

ActionBehavior
askAgentAsks Kiro agent to perform task
runCommandExecutes shell command

Example: Auto Test Files

.kiro/hooks/auto-test-files.json:

{
  "name": "Auto Test Files",
  "description": "Creates test files for new components",
  "version": "1",
  "when": {
    "type": "fileCreated",
    "patterns": ["src/components/**/*.tsx"]
  },
  "then": {
    "type": "askAgent",
    "prompt": "A new component was created. Create a corresponding test file following our testing patterns. Use React Testing Library and include tests for rendering and key interactions."
  }
}

Example: Dependency Checker

.kiro/hooks/dependency-checker.json:

{
  "name": "Dependency Update Checker",
  "description": "Checks for breaking changes in package.json",
  "version": "1",
  "when": {
    "type": "fileModified",
    "patterns": ["package.json"]
  },
  "then": {
    "type": "askAgent",
    "prompt": "package.json was modified. Check if any dependencies were updated and review the changelog for breaking changes. Suggest any code updates needed."
  }
}

Common Mistakes

MistakeFix
Missing fileMatchPattern with fileMatchfileMatchPattern is REQUIRED when inclusion is fileMatch
Missing inclusion fieldDefaults to always if omitted
Using regex in fileMatchPatternGlobs only, no regex support
Multiple patterns in fileMatchPatternUse single pattern string only
Forgetting domain fieldUse domain for organization and discovery

Validation

Schema: https://github.com/pr-pm/prpm/blob/main/packages/converters/schemas/kiro-steering.schema.json

Best Practices

Steering Files

  1. Start with foundational files: product.md, tech.md, structure.md
  2. Use always for core patterns: Code style, architecture principles
  3. Use fileMatch for specific contexts: Component rules, API patterns
  4. Group by domain: Consistent naming helps discovery
  5. Manual for workflows: Special procedures, optimization guides

Hooks

  1. Specific patterns: Use precise globs to avoid unnecessary triggers
  2. Clear prompts: Write detailed agent prompts with context
  3. Idempotent actions: Ensure hooks can run multiple times safely
  4. Performance: Avoid hooks on frequently modified files
  5. Testing: Test hooks in isolation before deploying

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.