Generate a personalized Second Brain PRD from a completed requirements template. Use when the user has filled out my-second-brain-requirements.md and wants to generate their build plan. Triggers on "create my second brain PRD", "generate my PRD", "build my second brain plan", "/create-second-brain-prd", or after completing the requirements template.
52
58%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Fix and improve this skill with Tessl
tessl review fix ./.claude/skills/create-second-brain-prd/SKILL.mdGenerate a personalized Product Requirements Document for building an AI Second Brain, based on the user's completed requirements template.
A blank template is bundled with this skill at ${CLAUDE_SKILL_DIR}/my-second-brain-requirements.md. Copy it to your workspace and fill it out before running this skill.
$0 (required) — Path to the filled-out requirements file (e.g., ./my-second-brain-requirements.md)$1 (optional) — Output path for the PRD. Defaults to .agent/plans/second-brain-prd.mdRead the requirements — Read the filled-out requirements file at $0. If no argument was provided, ask the user for the path. If they haven't filled one out yet, tell them a blank template is available at ${CLAUDE_SKILL_DIR}/my-second-brain-requirements.md — they should copy it to their workspace and fill it out first.
Load the architecture reference — Read ${CLAUDE_SKILL_DIR}/references/architecture-reference.md for the blueprint.
Research ALL tools and APIs — Do not assume familiarity with any platform or library. Even common APIs like Gmail or Slack have nuances, rate limits, and SDK-specific patterns that matter for implementation. For every tool in the user's stack, do web research to ensure the PRD contains accurate, specific guidance.
Always research these core dependencies:
For every platform the user selected (Gmail, Slack, Linear, HubSpot, etc.):
The goal: Every phase in the PRD should contain enough technical specificity that a coding agent can implement it without guessing. Don't bloat the PRD with raw research - distill it into actionable implementation notes per phase.
Generate the PRD — Create a phased build plan at the output path ($1, or .agent/plans/second-brain-prd.md if not specified) with these sections:
The output PRD should have:
Header:
Phase 1: Foundation (Memory Layer)
MyVault/Memory/). Do NOT hardcode "Dynamous" — always use their chosen name.Phase 2: Hooks (Context Persistence)
memory_flush.py)memory_flush.py: Background Agent SDK script spawned by PreCompact/SessionEnd. Uses Claude with allowed_tools=[] (pure reasoning, no tools) to intelligently decide what decisions, lessons, and facts from the conversation are worth saving. Writes bullet-point summary to daily log. Has deduplication and file locking. This is critical — without it, daily logs contain mechanical transcript excerpts instead of intelligent summaries that the daily reflection can actually promote to MEMORY.md.os.environ["CLAUDE_INVOKED_BY"] = "<name>". SessionEnd and PreCompact hooks check this env var and skip if set — this prevents Agent SDK exits from triggering additional flushes, which would cause duplicate log entries or infinite recursion.shared.py): Cross-platform file locking (file_lock() using msvcrt on Windows / fcntl on Unix) for concurrent write safety, retry with exponential backoff (with_retry()) for external API calls, and atomic state writes. Multiple processes (heartbeat, reflection, chat, flush) write to daily logs and state files concurrently — without file locking, they corrupt each other.Phase 3: Memory Search (Hybrid RAG)
Phase 4: Integrations (Their Top 3 First)
Phase 5: Skills (Starter Pack)
Phase 6: Proactive Systems (Heartbeat + Reflection)
{verdict: "pass"|"fail"|"suspicious"} before the main heartbeat agent ever sees it; fail aborts the run, suspicious proceeds with warning) → (4) main Claude Agent SDK reasoning call with tools → (5) notify. The pre-flight guardrail step is not optional — it is the only semantic injection check in the security stack and must be wired directly into the heartbeat pipeline, not bolted on as a separate phase.build_snapshot(gmail_data, asana_data, slack_data, calendar_data, ...) and diff_snapshot(current, previous) functions that produce a hashable snapshot of each integration's current state and compute the delta vs. the previous run. Persist state at .claude/data/state/heartbeat-state.json (atomic writes via shared.py). Only the delta — new emails, newly overdue tasks, newly unread Slack messages — is passed into the main Claude reasoning call. This is the notification-fatigue solution: without state diffing, every 30-minute run re-surfaces the same unread emails and the user gets paged endlessly. Without this mechanism the heartbeat is unusable in production. Must be a named deliverable with these exact function names so students can trace the pattern in the generated PRD.drafts/sent/ for voice-matching (memory_search.py --path-prefix drafts/sent), (3) write drafts as markdown files in drafts/active/ with YAML frontmatter (type, source_id, recipient, subject, context, created, status) + Original Message + Draft Reply sections, (4) expire drafts >24h old with no action by moving to drafts/expired/, (5) detect when the user has actually replied on the platform and move the file to drafts/sent/ capturing their real reply text. The heartbeat Agent SDK session needs Write/Edit tools to create draft files — read-only tools are insufficient. Drafting criteria should be defined in USER.md (what to draft, what to skip).Phase 7: Chat Interface (Optional)
Phase 8: Security Hardening
block-secrets.py): PreToolUse hook that intercepts ALL file-access tools (Read, Bash, Grep, Edit, Write, Glob) and blocks access to .env files, API tokens, OAuth credentials, SSH keys, and other secrets. Also blocks Bash commands that would expose environment variables, and blocks writing scripts that would exfiltrate secrets to stdout. This is the most critical security component — without it, the LLM can accidentally read and expose every API key. Must be implemented as a separate, dedicated hook (not combined with the general command guard).TRUST_BOUNDARY_INSTRUCTION in the system prompt that explicitly tells Claude to treat anything inside <external_data> tags as data, not instructions — the wrapper without the instruction is half a defense.allowed_tools=[] that receives the sanitized context and returns {"verdict": "pass"|"fail"|"suspicious"}. On fail → abort the heartbeat run and log the blocked content. On suspicious → proceed with a warning in the daily log. On pass → continue to the main reasoning call. This is the only semantic check in the security stack (the other layers are all pattern-based) and catches injection attempts that slip past deterministic regex. Wire it into the Phase 6 heartbeat flow between state-diffing and the main agent call — not as a standalone utility.DANGEROUS_BASH_PATTERNS list in shared.py with 30+ patterns covering destructive operations (rm -rf, dd, mkfs), credential exfiltration bypasses (curl to unknown hosts, wget piped to shell), package installation (pip install, npm install, brew install), privilege escalation (sudo, chmod 777), and outbound network calls to non-allowlisted domains. The check must recursively extract subshell $(...) and backtick `...` constructs and re-check their contents (naive string matching is bypassable via $(echo rm\ -rf\ /)). Strip common binary path prefixes (/usr/bin/, /bin/) before matching. This is distinct from block-secrets.py (which protects credential files) — DANGEROUS_BASH_PATTERNS protects against destructive and exfiltration commands, and both hooks run on every PreToolUse Bash call.Phase 9: Deployment
Memory/daily/*.md) are append-only and get written concurrently by heartbeat, reflection, chat, and flush processes on both machines — naive Git merging produces conflicts on every sync. Solution: register a custom concat-both merge driver in .gitattributes that maps Memory/daily/*.md to a script which concatenates additions from both sides instead of conflicting. The driver script (git-merge-concat) takes ancestor/local/remote versions, uses remote as base, appends any lines local added that aren't already present. Without this driver, vault sync will break within the first day of real use and the user will abandon the system. Must be a named deliverable with the script path, .gitattributes entry, and the git config merge.concat-both.driver registration command per machine.Each phase includes:
Footer:
SecondBrain/Memory/, SecondBrain/Memory/daily/, etc.74f7544
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.