| name | meta-42cog |
| description | This skill should be used when initializing a new project with Cognitive Agile methodology. It automatically generates real.md (reality constraints) and cog.md (cognitive model) by scanning the project directory and identifying key patterns. |
Meta Skill - Cognitive Agile Foundation Generator
Overview
This is the meta skill for Cognitive Agile methodology (认知敏捷法). It generates the two foundational documents that all other skills depend on:
- real.md - Reality Constraints Document
- cog.md - Cognitive Model Document
These documents follow the RCSW workflow:
Real → Cog → Spec → Work
When to Use This Skill
- Starting a new project with Cognitive Agile methodology
- When real.md or cog.md is missing and another skill needs them
- When project structure has significantly changed and foundation documents need regeneration
- When onboarding a project to Cognitive Agile workflow
Core Principles
This skill follows the Supreme Principle of Cognitive Agile:
Accelerate the Hybrid Intelligence Loop — All designs should be evaluated by whether they accelerate the human-AI collaboration cycle.
Four Specific Principles
- Independent Operation: Let AI work autonomously
- Focus on Output: Care about final results, not intermediate steps
- Consider Exceptions: Handle cases AI might not anticipate
- Continuous Reflection: Generate more skills from experience
Process
Phase 1: Project Scanning
Scan the project directory to identify:
Technical Stack Detection:
package.json → Node.js/JavaScript project, dependencies
requirements.txt / pyproject.toml → Python project
Cargo.toml → Rust project
go.mod → Go project
*.csproj → .NET project
Framework Detection:
- Next.js, React, Vue, Angular (frontend)
- Express, FastAPI, Django, Rails (backend)
- Drizzle, Prisma, TypeORM (ORM)
Database Detection:
- Schema files, migration files
- Connection strings in environment files
Sensitive Data Patterns:
- User credentials (passwords, tokens)
- API keys
- Personal information (email, phone, address)
- Payment information
Phase 2: Generate real.md
Format: Markdown + XML semantic closure tags
Structure:
# [Project Name] - Reality Constraints Document
<meta>
<document-id>[project]-real</document-id>
<version>1.0.0</version>
<project>[Project Name]</project>
<type>Reality Constraints</type>
<created>[Date]</created>
</meta>
## Document Purpose
[Brief description of what this document defines]
<constraints>
## Required Constraints (Maximum 4)
<constraint required="true" id="C1">
<title>[Constraint Title]</title>
<description>[What must be done or avoided]</description>
<rationale>[Why this constraint exists]
[What happens if violated]
[... up to 4 required constraints]
[Constraint Title]
[What should be done or avoided]
[Why this is recommended]
[... up to 3 optional constraints]
[Technology stack details]
[Checkboxes for verification]
Constraint Identification Guidelines:
| Priority | Type | Examples |
|---|
| Required | Security | Password hashing, API key encryption, data ownership validation |
| Required | Data Integrity | First-user-admin rule, unique constraints |
| Required | Compliance | GDPR, data residency, audit logging |
| Optional | UX Simplification | Avatar generation, file type limits |
| Optional | Performance | Caching rules, rate limits |
Key Rule: Focus on constraints that AI might not anticipate but would cause real-world damage if violated.
Phase 3: Generate cog.md
Format: Markdown + XML semantic closure tags
Core Framework: Agents + Information + Context
Structure:
# [Project Name] - Cognitive Model Document
<meta>
<document-id>[project]-cog</document-id>
<version>1.0.0</version>
<project>[Project Name]</project>
<type>Cognitive Model</type>
<created>[Date]</created>
<depends>real.md</depends>
</meta>
## Document Purpose
[Brief description based on "Agents + Information + Context" framework]
---
## 1. Agents
<agents>
### 1.1 Human Agents
<agent type="human" id="A1">
<name>[Agent Name]</name>
<identifier>[How to uniquely identify - UUID, email, etc.]
[Category 1] | [Category 2]
[What they can do]
[What they want to achieve]
[AI Agent Name]
[How to identify - provider + model]
[Categories]
[Input/Output patterns]
---
[Entity Name]
[How to uniquely identify]
[Categories]
[Key attributes]
[Relationships: 1:1, 1:N, N:N]
[Agent] → [Action] → [System] → [Response] → [Agent]
---
[Web app, mobile app, CLI tool, etc.]
[Architecture, protocols, security measures]
[Emotional goals, interaction style]
---
[Importance weights for entities and interactions]
---
[Checkboxes for validation]
Entity Identification Guidelines:
For each entity, define:
- Unique Code: How AI can locate and identify it (UUID, slug, compound key)
- Classification: Human-defined categories (AI tends to classify arbitrarily)
Phase 4: Validation
After generating both documents:
-
Cross-reference Check:
- All entities in cog.md should respect constraints in real.md
- Security-sensitive entities should have corresponding constraints
-
Completeness Check:
- real.md: 4-7 constraints total
- cog.md: All major entities identified with unique codes and classifications
-
Format Check:
- XML tags are properly closed
- Markdown structure is clean
- No code fences around constraint/entity definitions
Output
Generate two files in the project's cognitive agile directory:
.42cog/ (or project-specific location)
├── real.md # Reality Constraints
└── cog.md # Cognitive Model
Quality Checklist
Integration with Other Skills
| Skill | Relationship |
|---|
| All 01-11 skills | Output: real.md and cog.md are prerequisites |
| product-requirements | Depends on cog.md for entity understanding |
| database-design | Depends on cog.md for entity relationships |
| coding | Depends on real.md for security constraints |
Trigger Conditions
This skill is automatically invoked when:
- Any other skill detects missing real.md or cog.md
- User explicitly requests foundation document generation
- Project is being initialized with Cognitive Agile methodology