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/rules_config.py
View on GitHubfrom __future__ import annotations
import os
import re
from dataclasses import dataclass
from pathlib import Path
from typing import Any
TOP_LEVEL_SCALAR_PATTERN = re.compile(r"^(?P<key>[A-Za-z_][A-Za-z0-9_]*)\s*:\s*(?P<value>.+?)\s*$")
SKILL_SOURCES_KEY = "skill_sources"
@dataclass(frozen=True)
class SkillSourceConfig:
path: str
format: str = ""
confirmed: bool = False
type: str = "local" # local | global | remote
source_name: str = "" # human-readable label for this source
def resolved_path(self, project_root: Path) -> Path:
candidate = Path(os.path.expanduser(self.path))
if candidate.is_absolute():
return candidate
return (project_root / candidate).resolve()
def load_rules_config(config_path: Path) -> dict[str, Any]:
config_file = Path(config_path)
if not config_file.exists():
return {}
lines = config_file.read_text(encoding="utf-8").splitlines()
return {
"skill_sources": load_skill_sources(config_file),
"quality_threshold": _load_top_level_int(lines, "quality_threshold"),
"confidence_threshold": _load_top_level_int(lines, "confidence_threshold"),
"skill_match_limit": _load_top_level_int(lines, "skill_match_limit"),
"agentic_match_limit": _load_top_level_int(lines, "agentic_match_limit"),
"project_intent_override": _load_top_level_string(lines, "project_intent_override"),
}
def load_skill_sources(config_path: Path) -> list[SkillSourceConfig]:
config_file = Path(config_path)
if not config_file.exists():
return []
lines = config_file.read_text(encoding="utf-8").splitlines()
source_index = _find_section_index(lines, SKILL_SOURCES_KEY)
if source_index is None:
return []
entries: list[SkillSourceConfig] = []
current: dict[str, Any] | None = None
for raw_line in lines[source_index + 1 :]:
if not raw_line.strip() or raw_line.lstrip().startswith("#"):
continue
if _is_new_top_level_key(raw_line):
break
stripped = raw_line.strip()
if stripped.startswith("- "):
if current is not None:
entries.append(_build_skill_source(current))
current = _parse_skill_source_item(stripped[2:])
continue
if current is None or ":" not in stripped:
continue
key, raw_value = stripped.split(":", 1)
current[key.strip()] = _parse_scalar(raw_value.strip())
if current is not None:
entries.append(_build_skill_source(current))
return [entry for entry in entries if entry.path]
def load_confirmed_skill_sources(config_path: Path) -> list[SkillSourceConfig]:
return [entry for entry in load_skill_sources(config_path) if entry.confirmed]
def load_all_skill_sources(config_path: Path) -> list[SkillSourceConfig]:
"""Load all skill sources (not just confirmed ones)."""
return [entry for entry in load_skill_sources(config_path) if entry.path]
def normalize_config_path(path_value: str) -> str:
normalized = path_value.replace("\\", "/")
return normalized.rstrip("/") or normalized
def format_yaml_path(path_value: str) -> str:
normalized = normalize_config_path(path_value)
if any(character in normalized for character in (":", " ")):
return f'"{normalized}"'
return normalized
def _find_section_index(lines: list[str], key: str) -> int | None:
for index, raw_line in enumerate(lines):
if raw_line.lstrip().startswith("#"):
continue
if re.match(rf"^\s*{re.escape(key)}\s*:\s*$", raw_line):
return index
return None
def _is_new_top_level_key(raw_line: str) -> bool:
return bool(raw_line and not raw_line.startswith((" ", "\t")) and ":" in raw_line)
def _parse_skill_source_item(raw_item: str) -> dict[str, Any]:
stripped = raw_item.strip()
if ":" in stripped:
key, raw_value = stripped.split(":", 1)
return {key.strip(): _parse_scalar(raw_value.strip())}
return {"path": _parse_scalar(stripped)}
def _build_skill_source(raw_entry: dict[str, Any]) -> SkillSourceConfig:
return SkillSourceConfig(
path=str(raw_entry.get("path") or "").strip(),
format=str(raw_entry.get("format") or "").strip(),
confirmed=bool(raw_entry.get("confirmed") is True),
type=str(raw_entry.get("type") or "local").strip(),
source_name=str(raw_entry.get("source_name") or "").strip(),
)
def _load_top_level_int(lines: list[str], key: str) -> int | None:
for raw_line in lines:
if raw_line.lstrip().startswith("#"):
continue
match = TOP_LEVEL_SCALAR_PATTERN.match(raw_line.strip())
if match is None or match.group("key") != key:
continue
value = _parse_scalar(match.group("value"))
if isinstance(value, int):
return value
return None
def _load_top_level_string(lines: list[str], key: str) -> str | None:
for raw_line in lines:
if raw_line.lstrip().startswith("#"):
continue
match = TOP_LEVEL_SCALAR_PATTERN.match(raw_line.strip())
if match is None or match.group("key") != key:
continue
value = _parse_scalar(match.group("value"))
if isinstance(value, str):
return value
return None
def _parse_scalar(raw_value: str) -> Any:
value = raw_value.strip()
if not value:
return ""
if value.startswith('"') and value.endswith('"'):
return value[1:-1]
if value.startswith("'") and value.endswith("'"):
return value[1:-1]
lowered = value.lower()
if lowered == "true":
return True
if lowered == "false":
return False
if re.fullmatch(r"-?\d+", value):
return int(value)
return value
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: 470k | Updated | Claude CodeCodex | Unverified | 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: 322k | 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: 322k | 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: 322k | Updated | Claude CodeCodex | Verified | Install |