/skills:second-brain-prd <path-to-requirements> [output-path]from Cole's AI Skills
Generates a personalized, phased PRD for building an AI second brain in TypeScript from a filled-out requirements template. Covers memory, hooks, hybrid search, integrations, skills, proactive heartbeat, chat, security, and deployment in build order.
Ships in Cole's AI Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Generate a personalized Product Requirements Document for building an AI Second Brain in TypeScript, based on the user's completed requirements template.
A blank template is bundled with this skill at ${CLAUDE_SKILL_DIR}/requirements-template.md, and a filled-out one at ${CLAUDE_SKILL_DIR}/example-requirements.md. example-prd.md is a finished PRD for that example, for people to read. Do not load it while generating, because each PRD gets written fresh from the user's answers. Copy the template to your workspace and fill it out before running this skill.
$0 (required), Path to the filled-out requirements file (e.g., ./my-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}/requirements-template.md, they should copy it to their workspace and fill it out first.
Load the references: Read ${CLAUDE_SKILL_DIR}/references/architecture-reference.md for the blueprint and ${CLAUDE_SKILL_DIR}/references/typescript-stack.md for the runtime, the packages and the gotchas found by running this stack. Use the package and file names those files give, and name anything they don't cover in the same kebab-case style.
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:
@anthropic-ai/claude-agent-sdk): how to create conversations with query(), system prompt presets, settingSources, allowedTools, tools, streaming input, credential handling@huggingface/transformers): ONNX model loading, batch embedding API, model cache configuration, supported modelsFor every platform the user selected (Gmail, Slack, Linear, HubSpot, etc.):
googleapis, @slack/web-api, @octokit/rest)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/). Always use their chosen name.MEMORY.md is the index, loaded every session: current state, decisions, lessons, and a one-line [[wiki-link]] to every page. Pages live in the folders that come from their memory categories. The agent reads the index, opens the page, acts, then writes back to the page and its index line. State this recall order in SOUL.md: index first, memory search second. Most lookups end here, with no database involved.Phase 2: Hooks (Context Persistence)
memory-flush.ts)memory-flush.ts: Background Agent SDK script spawned by PreCompact/SessionEnd. Uses Claude with tools: [] and settingSources: [] (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.process.env.CLAUDE_INVOKED_BY = "<name>". SessionEnd and PreCompact hooks check this env var and skip if set, and SessionStart skips BOOTSTRAP.md if set, so a scheduled run never gets the onboarding interview, this prevents Agent SDK exits from triggering additional flushes, which would cause duplicate log entries or infinite recursion.shared.ts): Cross-platform file locking (withFileLock() built on proper-lockfile) for concurrent write safety, retry with exponential backoff (withRetry()) 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)
typescript-stack.md)Phase 4: Integrations (Top 3 First)
integrations/integration-template.ts as the pattern each integration copiesPhase 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, saves the snapshot so one hostile message can't block every later run, and notifies the user; 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.buildSnapshot(...) with one argument per integration, such as buildSnapshot(gmailData, slackData, calendarData) and diffSnapshot(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.ts). 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 the pattern is easy to trace in the generated PRD.drafts/sent/ for voice-matching (memory-search.ts --path-prefix drafts/sent), seeded from their recent sent messages because the folder starts empty, (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.ts): PreToolUse hook that intercepts ALL file-access tools (Read, Bash, Grep, Edit, Write, Glob, and PowerShell on Windows) 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).block-secrets before the first integration token exists (Phase 4) and the guardrail with the heartbeat (Phase 6). Do not wait for Phase 8 to add them.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.tools: [] and settingSources: [] 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.ts with 30+ patterns covering destructive operations (rm -rf, dd, mkfs), credential exfiltration bypasses (curl to unknown hosts, wget piped to shell), package installation (npm install, pnpm add, npx, brew install, with an allowlist for the project's own npm ci, npm run and npx tsc), 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.ts (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: add a custom concat-both merge driver: an entry in the vault's .gitattributes 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. Run the driver with node. 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:
.ts files and npm packages only, and the deterministic layer is "TypeScript gathers data, Claude reasons".SecondBrain/Memory/, SecondBrain/Memory/daily/, etc.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub coleam00/skills --plugin skills40 skills in this plugin
/ablate-ai-layerMeasure whether a repository's AI instructions still earn their place, by running the same real task many times with the layer intact and with it stripped, then grading every rule against what actually changed. Runs both arms itself in throwaway git worktrees and never touches the working tree. Agent-agnostic across CLAUDE.md, AGENTS.md, .claude/, .agents/, .cursor/rules, .clinerules, .windsurfrules and copilot-instructions. Use when the user wants to prune, audit, clean up, shrink or "delete" their CLAUDE.md, AGENTS.md, cursor rules, agent instructions or AI layer; when they ask whether their rules are still needed, whether their context is bloated, or what to cut; or when they mention ablating, ablation, or testing their agent without its instructions./agent-browserBrowser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools./agent-config-auditRead-only audit of everything a repository's coding-agent config can run on its own - Claude Code hooks, status lines and helper commands, MCP servers, Codex and Cursor hooks, Gemini CLI settings, VS Code folder-open tasks, plugin marketplaces, permission allow rules, MCP auto-approval, and skills that run inline shell - plus the project's dependencies (missing lockfiles, known-poisoned releases, code-running .pth files), secrets saved in settings.local.json or pasted into stored Claude Code and Codex conversations, and known-bad editor extensions. Explains each risky entry in plain words and how to fix it, and never prints secret values. Use when the user says "audit my agent config", "what runs when I open this repo", "check my repos for malicious hooks", "is this repo safe to open", before trusting or opening a cloned repo, after pulling changes to .claude, .mcp.json, .codex, .cursor or .vscode, or after a supply-chain incident./ast-grepGuide for writing ast-grep rules to perform structural code search and analysis. Use when users need to search codebases using Abstract Syntax Tree (AST) patterns, find specific code structures, or perform complex code queries that go beyond simple text search. This skill should be used when users ask to search for code patterns, find specific language constructs, or locate code with particular structural characteristics./build-dark-factoryTake a PRD and build a dark factory around it - a repository that takes work in as an issue and ships validated code out with nobody at the keyboard - one component at a time, into the user's actual repo. Covers the five components in construction order - the guidance layer, the validation harness, the workflow-driven repo, deployment, and the trigger that makes it autonomous - and is agnostic about which coding agent runs underneath (Claude Code, Codex, Archon, the Agent SDK, Cline, Goose, Amp, Pi). It encodes the AI coding process the user already runs rather than replacing it. Requires a PRD as input and deliberately does not write one. Use when the user wants to build a dark factory, an autonomous or self-driving repository, a software factory, an agent that ships its own code, an unattended or overnight coding loop, or asks how to get to level 4 or level 5 of AI coding autonomy; and when they mention dark factory, lights-out coding, autonomous PRs, or a repo that maintains itself./build-signal-engineBuild a personal signal engine from scratch - a system that reads every source someone cares about each day (changelogs and release notes, communities, feeds, videos, papers), makes a quick decision on every item, lets an LLM read only what survives, and delivers one short digest. Interviews the user first to pin down what they need to keep up with, the sources where it actually shows up, and the one question that decides what is worth their time, then builds it one stage at a time into their own repo, proving each stage on real data. Agnostic about the coding agent, the decision model and where the data comes from. Use when the user wants to keep up with AI or their field without doomscrolling, build an AI news digest, a daily briefing, a content engine, a research or competitor monitor, a changelog watcher, or "something that reads everything and tells me what matters"; and when they mention signal vs noise, an information diet, or falling behind.Other plugins' skills for the same job