naravid19/ai-project-rules-generator
generating-project-rules
VerifiedMake sure to use this skill WHENEVER the user mentions creating, generating, or updating project rules files (.cursorrules, AGENTS.md, CLAUDE.md, GEMINI.md, or equivalent) for any software project. This is essential when a user wants to integrate AI skills into their development workflow, or when they need cross-platform AI tool configuration. Skip this for general code generation, refactoring, or tasks unrelated to AI agent configuration files.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 21.0 KB |
| assets/i18n/README.md | markdown | 2.9 KB |
| assets/images/logo.png | binary | 14.1 KB |
| assets/templates/README.md | markdown | 3.1 KB |
| assets/templates/mcp_registry.yaml | config | 1.2 KB |
| assets/templates/rulesrc-template.yaml | config | 7.3 KB |
| scripts/audit.py | script | 6.5 KB |
| scripts/config_runtime.py | script | 4.0 KB |
| scripts/discover-skills.py | script | 26.4 KB |
| scripts/extract-capabilities.py | script | 2.0 KB |
| scripts/indexer.py | script | 15.3 KB |
| scripts/lib/__init__.py | script | 74 B |
| scripts/lib/confidence.py | script | 1.8 KB |
| scripts/lib/config_runtime.py | script | 1.1 KB |
| scripts/lib/design_tokens.py | script | 4.7 KB |
| scripts/lib/semantic_matcher.py | script | 2.1 KB |
| scripts/log_viewer.py | script | 2.7 KB |
| scripts/memory_manager.py | script | 4.6 KB |
| scripts/project_rules_runtime.py | script | 27.3 KB |
| scripts/remote_source.py | script | 2.1 KB |
| scripts/rules_config.py | script | 5.7 KB |
| scripts/skill_metadata.py | script | 7.2 KB |
| scripts/traceability.py | script | 2.9 KB |
| scripts/validate-output.ps1 | script | 24.5 KB |
| scripts/validate-output.sh | script | 19.9 KB |
| scripts/wizard.py | script | 18.1 KB |
scripts/memory_manager.py
View on GitHubfrom __future__ import annotations
import argparse
import json
from pathlib import Path
from typing import Any
def compute_state_diff(old_state: dict[str, Any], new_state: dict[str, Any]) -> dict[str, Any]:
diff = {}
ignore_keys = {"session_id", "timestamp_utc", "project_root"}
for key in new_state:
if key in ignore_keys:
continue
old_val = old_state.get(key)
new_val = new_state.get(key)
if isinstance(new_val, list) and isinstance(old_val, list):
if sorted(map(str, new_val)) != sorted(map(str, old_val)):
diff[key] = {"old": old_val, "new": new_val}
elif new_val != old_val:
diff[key] = {"old": old_val, "new": new_val}
return diff
def format_state_change_notice(diff: dict[str, Any]) -> str:
# Deprecated: Kept for API compatibility but returns empty string to prevent transient state in memory
return ""
def summarize_recent_logs(project_root: Path, max_logs: int = 10) -> str:
root = Path(project_root).resolve()
log_dir = root / ".agent" / "logs"
events = _load_recent_events(log_dir, max_logs=max_logs)
lines = [
"# Project State Memory",
"> This file maintains the high-level, stable context for the AI agent. Transient execution logs are intentionally excluded.",
"",
f"- **Project Root**: `{root}`",
]
if not events:
lines.extend(
[
"- **Status**: No audited execution has been recorded yet.",
]
)
return "\n".join(lines) + "\n"
latest = events[-1]
matched_skills = _flatten_unique(events, "matched_skill_paths")
outputs = _flatten_unique(events, "output_files")
platforms = _flatten_unique(events, "platform_targets")
mcps = _flatten_unique(events, "recommended_mcp_servers")
# Extract only stable, architectural, and intent-driven context
lines.extend(
[
f"- **Active Phase**: `{latest.get('action', 'unknown')}`",
f"- **Target Platforms**: `{', '.join(platforms) or 'auto'}`",
f"- **Confirmed Skill Source**: `{latest.get('confirmed_skill_source_path', 'unknown')}`",
f"- **Active User Intent**: `{', '.join(latest.get('selected_keywords', [])) or 'none'}`",
f"- **Active Skills**: `{', '.join(matched_skills) or 'none'}`",
f"- **Recommended MCPs**: `{', '.join(mcps) or 'none'}`",
f"- **Latest Managed Files**: `{', '.join(outputs) or 'none'}`",
]
)
# Note: We intentionally DO NOT include transient metrics like duration_ms, stack_traces,
# or step-by-step change logs here to adhere to the Superpowers Memory Management rule:
# "Never save transient session state, summaries of code changes, bug fixes, or task-specific findings"
return "\n".join(lines) + "\n"
def refresh_project_state(project_root: Path, max_logs: int = 10) -> Path:
root = Path(project_root).resolve()
memory_dir = root / ".agent" / "memory"
memory_dir.mkdir(parents=True, exist_ok=True)
summary_path = memory_dir / "project_state.md"
summary_path.write_text(summarize_recent_logs(root, max_logs=max_logs), encoding="utf-8")
return summary_path
def _load_recent_events(log_dir: Path, max_logs: int) -> list[dict[str, Any]]:
if not log_dir.exists():
return []
log_files = sorted(
log_dir.glob("log_*.json"),
key=lambda path: path.name,
)[-max_logs:]
events: list[dict[str, Any]] = []
for log_file in log_files:
try:
payload = json.loads(log_file.read_text(encoding="utf-8"))
except (OSError, json.JSONDecodeError):
continue
if isinstance(payload, dict):
events.append(payload)
return events
def _flatten_unique(events: list[dict[str, Any]], key: str) -> list[str]:
unique: list[str] = []
for event in events:
raw_value = event.get(key, [])
if not isinstance(raw_value, list):
continue
for item in raw_value:
text = str(item).strip()
if text and text not in unique:
unique.append(text)
return unique
def main() -> None:
parser = argparse.ArgumentParser(description="Summarize project-local audit logs into project state memory.")
parser.add_argument("--project-root", default=".", help="Project root that owns .agent/logs")
parser.add_argument("--max-logs", type=int, default=10, help="Number of recent logs to summarize")
args = parser.parse_args()
output_path = refresh_project_state(Path(args.project_root), max_logs=args.max_logs)
print(output_path)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 321k | Updated | Claude CodeCodex | Verified | Install |